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 13
13
14
14
* The analysis of sanitizer guards has improved, leading to fewer false-positive results from the security queries.
15
15
16
+ * Calls can now be resolved to class members in more cases, leading to more results from the security queries.
17
+
16
18
* Support for the following frameworks and libraries has been improved:
17
19
- [ Electron] ( https://electronjs.org/ )
18
20
- [ Handlebars] ( https://www.npmjs.com/package/handlebars )
Original file line number Diff line number Diff line change @@ -1036,6 +1036,9 @@ module ClassNode {
1036
1036
kind = MemberKind:: of ( method ) and
1037
1037
result = method .getBody ( ) .flow ( )
1038
1038
)
1039
+ or
1040
+ kind = MemberKind:: method ( ) and
1041
+ result = getConstructor ( ) .getReceiver ( ) .getAPropertySource ( name )
1039
1042
}
1040
1043
1041
1044
override FunctionNode getAnInstanceMember ( MemberKind kind ) {
@@ -1045,6 +1048,9 @@ module ClassNode {
1045
1048
kind = MemberKind:: of ( method ) and
1046
1049
result = method .getBody ( ) .flow ( )
1047
1050
)
1051
+ or
1052
+ kind = MemberKind:: method ( ) and
1053
+ result = getConstructor ( ) .getReceiver ( ) .getAPropertySource ( )
1048
1054
}
1049
1055
1050
1056
override FunctionNode getStaticMethod ( string name ) {
@@ -1063,6 +1069,8 @@ module ClassNode {
1063
1069
method .isStatic ( ) and
1064
1070
result = method .getBody ( ) .flow ( )
1065
1071
)
1072
+ or
1073
+ result = getAPropertySource ( )
1066
1074
}
1067
1075
1068
1076
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 |
1
2
| namespace.js:5:32:5:44 | function() {} | Baz.method | method |
2
3
| tst2.js:6:9:9:3 | () {\\n ... .x;\\n } | C.method | method |
3
4
| tst2.js:11:13:13:3 | () {\\n ... .x;\\n } | C.getter | getter |
5
+ | tst2.js:18:14:18:22 | (x) => {} | D.f | method |
4
6
| tst.js:4:17:4:21 | () {} | A.instanceMethod | method |
5
7
| tst.js:7:6:7:10 | () {} | A.bar | method |
6
8
| 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 |
1
2
| namespace.js:5:32:5:44 | function() {} | Baz.method |
2
3
| tst2.js:6:9:9:3 | () {\\n ... .x;\\n } | C.method |
4
+ | tst2.js:18:14:18:22 | (x) => {} | D.f |
3
5
| tst.js:4:17:4:21 | () {} | A.instanceMethod |
4
6
| tst.js:7:6:7:10 | () {} | A.bar |
5
7
| 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 |
1
2
| namespace.js:3:15:3:31 | function Baz() {} | namespace.js:3:15:3:14 | this |
2
3
| namespace.js:3:15:3:31 | function Baz() {} | namespace.js:5:32:5:31 | this |
3
4
| tst2.js:1:1:14:1 | class C ... ;\\n }\\n} | tst2.js:2:14:2:13 | this |
4
5
| tst2.js:1:1:14:1 | class C ... ;\\n }\\n} | tst2.js:6:9:6:8 | this |
5
6
| 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 |
6
8
| tst.js:3:1:10:1 | class A ... () {}\\n} | tst.js:3:9:3:8 | this |
7
9
| tst.js:3:1:10:1 | class A ... () {}\\n} | tst.js:4:17:4:16 | this |
8
10
| 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 {
12
12
return this . x ;
13
13
}
14
14
}
15
+
16
+ class D {
17
+ constructor ( ) {
18
+ this . f = ( x ) => { } ;
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments