File tree Expand file tree Collapse file tree 4 files changed +23
-1
lines changed
lib/semmle/javascript/frameworks/data/internal
test/library-tests/frameworks/data Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,10 @@ bindingset[token]
133
133
API:: Node getExtraSuccessorFromInvoke ( API:: InvokeNode node , AccessPathToken token ) {
134
134
token .getName ( ) = "Instance" and
135
135
result = node .getInstance ( )
136
+ or
137
+ token .getName ( ) = "Argument" and
138
+ token .getAnArgument ( ) = "this" and
139
+ result .getARhs ( ) = node .( DataFlow:: CallNode ) .getReceiver ( )
136
140
}
137
141
138
142
/**
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ taintFlow
33
33
| test.js:95:17:95:24 | source() | test.js:95:17:95:24 | source() |
34
34
| test.js:96:17:96:24 | source() | test.js:96:17:96:24 | source() |
35
35
| test.js:97:17:97:24 | source() | test.js:97:17:97:24 | source() |
36
+ | test.js:102:16:102:34 | testlib.getSource() | test.js:103:8:103:13 | source |
37
+ | test.js:102:16:102:34 | testlib.getSource() | test.js:104:8:104:24 | source.continue() |
36
38
isSink
37
39
| test.js:54:18:54:25 | source() | test-sink |
38
40
| test.js:55:22:55:29 | source() | test-sink |
Original file line number Diff line number Diff line change @@ -97,3 +97,10 @@ function testSinks() {
97
97
testlib . sink3 ( source ( ) ) ; // NOT OK
98
98
testlib . sink4 ( source ( ) ) ; // OK
99
99
}
100
+
101
+ function testFlowThroughReceiver ( ) {
102
+ let source = testlib . getSource ( ) ;
103
+ sink ( source ) ; // NOT OK
104
+ sink ( source . continue ( ) ) ; // NOT OK
105
+ sink ( source . blah ( ) ) ; // OK
106
+ }
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ class Steps extends ModelInput::SummaryModelCsv {
12
12
"testlib;;Member[taintIntoCallbackThis];Argument[0];Argument[1..2].Parameter[this];taint" ,
13
13
"testlib;;Member[preserveArgZeroAndTwo];Argument[0,2];ReturnValue;taint" ,
14
14
"testlib;;Member[preserveAllButFirstArgument];Argument[1..];ReturnValue;taint" ,
15
- "testlib;;Member[preserveAllIfCall].Call;Argument[0..];ReturnValue;taint"
15
+ "testlib;;Member[preserveAllIfCall].Call;Argument[0..];ReturnValue;taint" ,
16
+ "testlib;;Member[getSource].ReturnValue.Member[continue];Argument[this];ReturnValue;taint" ,
16
17
]
17
18
}
18
19
}
@@ -36,11 +37,19 @@ class Sinks extends ModelInput::SinkModelCsv {
36
37
}
37
38
}
38
39
40
+ class Sources extends ModelInput:: SourceModelCsv {
41
+ override predicate row ( string row ) {
42
+ row = "testlib;;Member[getSource].ReturnValue;test-source"
43
+ }
44
+ }
45
+
39
46
class BasicTaintTracking extends TaintTracking:: Configuration {
40
47
BasicTaintTracking ( ) { this = "BasicTaintTracking" }
41
48
42
49
override predicate isSource ( DataFlow:: Node source ) {
43
50
source .( DataFlow:: CallNode ) .getCalleeName ( ) = "source"
51
+ or
52
+ source = ModelOutput:: getASourceNode ( "test-source" ) .getAnImmediateUse ( )
44
53
}
45
54
46
55
override predicate isSink ( DataFlow:: Node sink ) {
You can’t perform that action at this time.
0 commit comments