mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Filter out sources from test directories
This commit is contained in:
@@ -66,7 +66,10 @@ predicate predictableInstruction(Instruction instr) {
|
||||
}
|
||||
|
||||
module ImproperArrayIndexValidationConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) { isFlowSource(source, _) }
|
||||
predicate isSource(DataFlow::Node source) {
|
||||
isFlowSource(source, _) and
|
||||
not source.asExpr().getFile().getRelativePath().regexpMatch("/tests?/")
|
||||
}
|
||||
|
||||
predicate isBarrier(DataFlow::Node node) {
|
||||
hasUpperBound(node.asExpr())
|
||||
@@ -116,15 +119,11 @@ 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,
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user