Filter our sources in test folders

This commit is contained in:
Josh Brown
2024-03-22 14:47:14 -07:00
parent ebb37ac0c2
commit a3eecc33a8

View File

@@ -116,10 +116,15 @@ module ImproperArrayIndexValidationConfig implements DataFlow::ConfigSig {
module ImproperArrayIndexValidation = TaintTracking::Global<ImproperArrayIndexValidationConfig>;
predicate isInTestFile(ImproperArrayIndexValidation::PathNode node){
node.getNode().asExpr().getFile().getRelativePath().regexpMatch("/tests?/")
}
from
ImproperArrayIndexValidation::PathNode source, ImproperArrayIndexValidation::PathNode sink,
string sourceType
where
not isInTestFile(source) and
ImproperArrayIndexValidation::flowPath(source, sink) and
isFlowSource(source.getNode(), sourceType)
select sink.getNode(), source, sink,