Skip to content

Commit 5814db1

Browse files
hmacnickrolfe
andauthored
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>
1 parent 3d96c5e commit 5814db1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ruby/ql/lib/codeql/ruby/security/InsecureDependencyQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private predicate hasInsecureProtocol(string s, string proto) {
5959
private predicate containsInsecureUrl(Expr e, string proto) {
6060
// Handle cases where the string as a whole has no constant value (due to interpolations)
6161
// but has a known prefix. E.g. "http://#{foo}"
62-
exists(StringComponent c | c = e.(StringlikeLiteral).getComponent(_) |
62+
exists(StringComponent c | c = e.(StringlikeLiteral).getComponent(0) |
6363
hasInsecureProtocol(c.getConstantValue().getString(), proto)
6464
)
6565
or

0 commit comments

Comments
 (0)