File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling
lib/semmle/javascript/frameworks Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -120,13 +120,17 @@ predicate isBaseAdditionalFlowStep(
120
120
}
121
121
122
122
/**
123
+ * Gets a value that is (transitively) written to `query`, where `query` is a NoSQL sink.
124
+ *
123
125
* This predicate allows us to propagate data flow through property writes and array constructors
124
126
* within a query object, enabling the security query to pick up NoSQL injection vulnerabilities
125
127
* involving more complex queries.
126
128
*/
127
129
DataFlow:: Node getASubexpressionWithinQuery ( DataFlow:: Node query ) {
130
+ any ( NosqlInjectionATMConfig cfg ) .isEffectiveSink ( query ) and
128
131
exists ( DataFlow:: SourceNode receiver |
129
- receiver .flowsTo ( getASubexpressionWithinQuery * ( query .getALocalSource ( ) ) ) and
132
+ receiver = [ getASubexpressionWithinQuery ( query ) , query ] .getALocalSource ( )
133
+ |
130
134
result =
131
135
[ receiver .getAPropertyWrite ( ) .getRhs ( ) , receiver .( DataFlow:: ArrayCreationNode ) .getAnElement ( ) ]
132
136
)
Original file line number Diff line number Diff line change @@ -39,12 +39,14 @@ class BDDTest extends Test, @call_expr {
39
39
}
40
40
41
41
/**
42
- * Gets the test file for `f` with stem extension `stemExt`.
43
- * That is, a file named file named `<base>.<stemExt>.<ext>` in the
42
+ * Gets the test file for `f` with stem extension `stemExt`, where `stemExt` is "test" or "spec" .
43
+ * That is, a file named `<base>.<stemExt>.<ext>` in the
44
44
* same directory as `f` which is named `<base>.<ext>`.
45
45
*/
46
- bindingset [ stemExt ]
46
+ pragma [ noinline ]
47
47
File getTestFile ( File f , string stemExt ) {
48
+ stemExt = [ "test" , "spec" ] and
49
+ result .getBaseName ( ) .regexpMatch ( ".*\\.(test|spec)\\..*" ) and
48
50
result = f .getParentContainer ( ) .getFile ( f .getStem ( ) + "." + stemExt + "." + f .getExtension ( ) )
49
51
}
50
52
You can’t perform that action at this time.
0 commit comments