mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
Ruby: Fix bug in rb/insecure-dependency query
Only look at the first component of strings for the prefix. Co-authored-by: Nick Rolfe <nickrolfe@github.com>
This commit is contained in:
@@ -59,7 +59,7 @@ private predicate hasInsecureProtocol(string s, string proto) {
|
||||
private predicate containsInsecureUrl(Expr e, string proto) {
|
||||
// Handle cases where the string as a whole has no constant value (due to interpolations)
|
||||
// but has a known prefix. E.g. "http://#{foo}"
|
||||
exists(StringComponent c | c = e.(StringlikeLiteral).getComponent(_) |
|
||||
exists(StringComponent c | c = e.(StringlikeLiteral).getComponent(0) |
|
||||
hasInsecureProtocol(c.getConstantValue().getString(), proto)
|
||||
)
|
||||
or
|
||||
|
||||
Reference in New Issue
Block a user