Skip to content

Commit 4307889

Browse files
committed
specialize allowImplicitRead in unsafe-shell-command-construction to fix performance
1 parent 8b99e8a commit 4307889

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ class Configuration extends TaintTracking::Configuration {
3333
result instanceof DataFlow::FeatureHasSourceCallContext
3434
}
3535

36-
override predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet c) {
36+
override predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet set) {
37+
// allow implicit reads of array elements
3738
this.isSink(node) and
38-
c.isKnownOrUnknownElement(_)
39+
set.isKnownOrUnknownElement(any(DataFlow::Content::KnownElementContent content |
40+
content.getIndex().getValueType() = "int"
41+
))
3942
}
4043
}

0 commit comments

Comments
 (0)