Skip to content

Commit e0045d2

Browse files
committed
filter out string literals from the taint-sink meta query
1 parent 1a6e16f commit e0045d2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ruby/ql/src/queries/meta/internal/TaintMetrics.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
private import ruby
12
private import codeql.files.FileSystem
2-
private import codeql.ruby.DataFlow
33
private import codeql.ruby.dataflow.RemoteFlowSources
44
private import codeql.ruby.security.CodeInjectionCustomizations
55
private import codeql.ruby.security.CommandInjectionCustomizations
@@ -34,6 +34,12 @@ DataFlow::Node relevantTaintSink(string kind) {
3434
kind = "UnsafeDeserialization" and result instanceof UnsafeDeserialization::Sink
3535
or
3636
kind = "UrlRedirect" and result instanceof UrlRedirect::Sink
37+
) and
38+
// the sink is not a string literal
39+
not exists(Ast::StringLiteral str |
40+
str = result.asExpr().getExpr() and
41+
// ensure there is no interpolation, as that is not a literal
42+
not str.getComponent(_) instanceof Ast::StringInterpolationComponent
3743
)
3844
}
3945

0 commit comments

Comments
 (0)