File tree Expand file tree Collapse file tree 7 files changed +25
-0
lines changed
src/semmle/javascript/dataflow
test/library-tests/ClassNode Expand file tree Collapse file tree 7 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1313
1414* The analysis of sanitizer guards has improved, leading to fewer false-positive results from the security queries.
1515
16+ * Calls can now be resolved to class members in more cases, leading to more results from the security queries.
17+
1618* Support for the following frameworks and libraries has been improved:
1719 - [ Electron] ( https://electronjs.org/ )
1820 - [ Handlebars] ( https://www.npmjs.com/package/handlebars )
Original file line number Diff line number Diff line change @@ -1036,6 +1036,9 @@ module ClassNode {
10361036 kind = MemberKind:: of ( method ) and
10371037 result = method .getBody ( ) .flow ( )
10381038 )
1039+ or
1040+ kind = MemberKind:: method ( ) and
1041+ result = getConstructor ( ) .getReceiver ( ) .getAPropertySource ( name )
10391042 }
10401043
10411044 override FunctionNode getAnInstanceMember ( MemberKind kind ) {
@@ -1045,6 +1048,9 @@ module ClassNode {
10451048 kind = MemberKind:: of ( method ) and
10461049 result = method .getBody ( ) .flow ( )
10471050 )
1051+ or
1052+ kind = MemberKind:: method ( ) and
1053+ result = getConstructor ( ) .getReceiver ( ) .getAPropertySource ( )
10481054 }
10491055
10501056 override FunctionNode getStaticMethod ( string name ) {
@@ -1063,6 +1069,8 @@ module ClassNode {
10631069 method .isStatic ( ) and
10641070 result = method .getBody ( ) .flow ( )
10651071 )
1072+ or
1073+ result = getAPropertySource ( )
10661074 }
10671075
10681076 override DataFlow:: Node getASuperClassNode ( ) { result = astNode .getSuperClass ( ) .flow ( ) }
Original file line number Diff line number Diff line change 1+ | fields.ts:2:16:2:32 | (x: string) => {} | Foo.m | method |
12| namespace.js:5:32:5:44 | function() {} | Baz.method | method |
23| tst2.js:6:9:9:3 | () {\\n ... .x;\\n } | C.method | method |
34| tst2.js:11:13:13:3 | () {\\n ... .x;\\n } | C.getter | getter |
5+ | tst2.js:18:14:18:22 | (x) => {} | D.f | method |
46| tst.js:4:17:4:21 | () {} | A.instanceMethod | method |
57| tst.js:7:6:7:10 | () {} | A.bar | method |
68| tst.js:9:10:9:14 | () {} | A.baz | getter |
Original file line number Diff line number Diff line change 1+ | fields.ts:2:16:2:32 | (x: string) => {} | Foo.m |
12| namespace.js:5:32:5:44 | function() {} | Baz.method |
23| tst2.js:6:9:9:3 | () {\\n ... .x;\\n } | C.method |
4+ | tst2.js:18:14:18:22 | (x) => {} | D.f |
35| tst.js:4:17:4:21 | () {} | A.instanceMethod |
46| tst.js:7:6:7:10 | () {} | A.bar |
57| tst.js:17:19:17:31 | function() {} | B.foo |
Original file line number Diff line number Diff line change 1+ class Foo {
2+ public m = ( x : string ) => { } ;
3+ }
Original file line number Diff line number Diff line change 1+ | fields.ts:1:1:3:1 | class F ... > {};\\n} | fields.ts:1:11:1:10 | this |
12| namespace.js:3:15:3:31 | function Baz() {} | namespace.js:3:15:3:14 | this |
23| namespace.js:3:15:3:31 | function Baz() {} | namespace.js:5:32:5:31 | this |
34| tst2.js:1:1:14:1 | class C ... ;\\n }\\n} | tst2.js:2:14:2:13 | this |
45| tst2.js:1:1:14:1 | class C ... ;\\n }\\n} | tst2.js:6:9:6:8 | this |
56| tst2.js:1:1:14:1 | class C ... ;\\n }\\n} | tst2.js:11:13:11:12 | this |
7+ | tst2.js:16:1:20:1 | class D ... ;\\n }\\n} | tst2.js:17:14:17:13 | this |
68| tst.js:3:1:10:1 | class A ... () {}\\n} | tst.js:3:9:3:8 | this |
79| tst.js:3:1:10:1 | class A ... () {}\\n} | tst.js:4:17:4:16 | this |
810| tst.js:3:1:10:1 | class A ... () {}\\n} | tst.js:7:6:7:5 | this |
Original file line number Diff line number Diff line change @@ -12,3 +12,9 @@ class C {
1212 return this . x ;
1313 }
1414}
15+
16+ class D {
17+ constructor ( ) {
18+ this . f = ( x ) => { } ;
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments