File tree Expand file tree Collapse file tree 4 files changed +39
-0
lines changed
test/library-tests/frameworks/data Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -891,6 +891,17 @@ module API {
891
891
( propDesc = Promises:: errorProp ( ) or propDesc = "" )
892
892
}
893
893
894
+ pragma [ nomagic]
895
+ private DataFlow:: ClassNode getALocalSubclass ( DataFlow:: SourceNode node ) {
896
+ result .getASuperClassNode ( ) .getALocalSource ( ) = node
897
+ }
898
+
899
+ bindingset [ node]
900
+ pragma [ inline_late]
901
+ private DataFlow:: ClassNode getALocalSubclassFwd ( DataFlow:: SourceNode node ) {
902
+ result = getALocalSubclass ( node )
903
+ }
904
+
894
905
/**
895
906
* Holds if `ref` is a use of a node that should have an incoming edge from `base` labeled
896
907
* `lbl` in the API graph.
@@ -927,6 +938,15 @@ module API {
927
938
or
928
939
lbl = Label:: forwardingFunction ( ) and
929
940
DataFlow:: functionForwardingStep ( pred .getALocalUse ( ) , ref )
941
+ or
942
+ exists ( DataFlow:: ClassNode cls |
943
+ lbl = Label:: instance ( ) and
944
+ cls = getALocalSubclassFwd ( pred ) .getADirectSubClass * ( )
945
+ |
946
+ ref = cls .getAReceiverNode ( )
947
+ or
948
+ ref = cls .getAClassReference ( ) .getAnInstantiation ( )
949
+ )
930
950
)
931
951
or
932
952
exists ( DataFlow:: Node def , DataFlow:: FunctionNode fn |
Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ taintFlow
74
74
| test.js:249:28:249:35 | source() | test.js:249:28:249:35 | source() |
75
75
| test.js:252:15:252:22 | source() | test.js:252:15:252:22 | source() |
76
76
| test.js:254:32:254:39 | source() | test.js:254:32:254:39 | source() |
77
+ | test.js:262:10:262:31 | this.ba ... ource() | test.js:262:10:262:31 | this.ba ... ource() |
78
+ | test.js:265:6:265:39 | new MyS ... ource() | test.js:265:6:265:39 | new MyS ... ource() |
79
+ | test.js:269:10:269:31 | this.ba ... ource() | test.js:269:10:269:31 | this.ba ... ource() |
80
+ | test.js:272:6:272:40 | new MyS ... ource() | test.js:272:6:272:40 | new MyS ... ource() |
77
81
isSink
78
82
| test.js:54:18:54:25 | source() | test-sink |
79
83
| test.js:55:22:55:29 | source() | test-sink |
Original file line number Diff line number Diff line change @@ -256,3 +256,17 @@ function fuzzy() {
256
256
fuzzyCall ( source ( ) ) ; // OK - does not come from 'testlib'
257
257
require ( 'blah' ) . fuzzyCall ( source ( ) ) ; // OK - does not come from 'testlib'
258
258
}
259
+
260
+ class MySubclass extends testlib . BaseClass {
261
+ foo ( ) {
262
+ sink ( this . baseclassSource ( ) ) ; // NOT OK
263
+ }
264
+ }
265
+ sink ( new MySubclass ( ) . baseclassSource ( ) ) ; // NOT OK
266
+
267
+ class MySubclass2 extends MySubclass {
268
+ foo2 ( ) {
269
+ sink ( this . baseclassSource ( ) ) ; // NOT OK
270
+ }
271
+ }
272
+ sink ( new MySubclass2 ( ) . baseclassSource ( ) ) ; // NOT OK
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ class Sources extends ModelInput::SourceModelCsv {
80
80
"testlib;Member[ParamDecoratorSource].DecoratedParameter;test-source" ,
81
81
"testlib;Member[MethodDecorator].DecoratedMember.Parameter[0];test-source" ,
82
82
"testlib;Member[MethodDecoratorWithArgs].ReturnValue.DecoratedMember.Parameter[0];test-source" ,
83
+ "testlib;Member[BaseClass].Instance.Member[baseclassSource].ReturnValue;test-source" ,
83
84
]
84
85
}
85
86
}
You can’t perform that action at this time.
0 commit comments