@@ -66,7 +66,10 @@ predicate predictableInstruction(Instruction instr) {
66
66
}
67
67
68
68
module ImproperArrayIndexValidationConfig implements DataFlow:: ConfigSig {
69
- predicate isSource ( DataFlow:: Node source ) { isFlowSource ( source , _) }
69
+ predicate isSource ( DataFlow:: Node source ) {
70
+ isFlowSource ( source , _) and
71
+ not source .asExpr ( ) .getFile ( ) .getRelativePath ( ) .regexpMatch ( "/tests?/" )
72
+ }
70
73
71
74
predicate isBarrier ( DataFlow:: Node node ) {
72
75
hasUpperBound ( node .asExpr ( ) )
@@ -116,15 +119,11 @@ module ImproperArrayIndexValidationConfig implements DataFlow::ConfigSig {
116
119
117
120
module ImproperArrayIndexValidation = TaintTracking:: Global< ImproperArrayIndexValidationConfig > ;
118
121
119
- predicate isInTestFile ( ImproperArrayIndexValidation:: PathNode node ) {
120
- node .getNode ( ) .asExpr ( ) .getFile ( ) .getRelativePath ( ) .regexpMatch ( "/tests?/" )
121
- }
122
-
123
122
from
124
- ImproperArrayIndexValidation:: PathNode source , ImproperArrayIndexValidation:: PathNode sink ,
123
+ ImproperArrayIndexValidation:: PathNode source ,
124
+ ImproperArrayIndexValidation:: PathNode sink ,
125
125
string sourceType
126
126
where
127
- not isInTestFile ( source ) and
128
127
ImproperArrayIndexValidation:: flowPath ( source , sink ) and
129
128
isFlowSource ( source .getNode ( ) , sourceType )
130
129
select sink .getNode ( ) , source , sink ,
0 commit comments