@@ -30,24 +30,36 @@ DataFlow::Node shouldNotBeTainted() {
3030 )
3131}
3232
33- class TestTaintTrackingConfiguration extends TaintTracking:: Configuration {
34- TestTaintTrackingConfiguration ( ) { this = "TestTaintTrackingConfiguration" }
33+ // this module allows the configuration to be imported in other `.ql` files without the
34+ // top level query predicates of this file coming into scope.
35+ module Conf {
36+ class TestTaintTrackingConfiguration extends TaintTracking:: Configuration {
37+ TestTaintTrackingConfiguration ( ) { this = "TestTaintTrackingConfiguration" }
3538
36- override predicate isSource ( DataFlow:: Node source ) {
37- source .asCfgNode ( ) .( NameNode ) .getId ( ) in [
38- "TAINTED_STRING" , "TAINTED_BYTES" , "TAINTED_LIST" , "TAINTED_DICT"
39- ]
40- or
41- source instanceof RemoteFlowSource
42- }
39+ override predicate isSource ( DataFlow:: Node source ) {
40+ source .asCfgNode ( ) .( NameNode ) .getId ( ) in [
41+ "TAINTED_STRING" , "TAINTED_BYTES" , "TAINTED_LIST" , "TAINTED_DICT"
42+ ]
43+ or
44+ // User defined sources
45+ exists ( CallNode call |
46+ call .getFunction ( ) .( NameNode ) .getId ( ) = "taint" and
47+ source .( DataFlow:: CfgNode ) .getNode ( ) = call .getAnArg ( )
48+ )
49+ or
50+ source instanceof RemoteFlowSource
51+ }
4352
44- override predicate isSink ( DataFlow:: Node sink ) {
45- sink = shouldBeTainted ( )
46- or
47- sink = shouldNotBeTainted ( )
53+ override predicate isSink ( DataFlow:: Node sink ) {
54+ sink = shouldBeTainted ( )
55+ or
56+ sink = shouldNotBeTainted ( )
57+ }
4858 }
4959}
5060
61+ import Conf
62+
5163class InlineTaintTest extends InlineExpectationsTest {
5264 InlineTaintTest ( ) { this = "InlineTaintTest" }
5365
0 commit comments