Skip to content

Commit a3eecc3

Browse files
committed
Filter our sources in test folders
1 parent ebb37ac commit a3eecc3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cpp/ql/src/Security/CWE/CWE-129/ImproperArrayIndexValidation.ql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,15 @@ module ImproperArrayIndexValidationConfig implements DataFlow::ConfigSig {
116116

117117
module ImproperArrayIndexValidation = TaintTracking::Global<ImproperArrayIndexValidationConfig>;
118118

119+
predicate isInTestFile(ImproperArrayIndexValidation::PathNode node){
120+
node.getNode().asExpr().getFile().getRelativePath().regexpMatch("/tests?/")
121+
}
122+
119123
from
120124
ImproperArrayIndexValidation::PathNode source, ImproperArrayIndexValidation::PathNode sink,
121125
string sourceType
122126
where
127+
not isInTestFile(source) and
123128
ImproperArrayIndexValidation::flowPath(source, sink) and
124129
isFlowSource(source.getNode(), sourceType)
125130
select sink.getNode(), source, sink,

0 commit comments

Comments
 (0)