File tree Expand file tree Collapse file tree
javascript/ql/test/library-tests/TaintTracking Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as dummy from 'dummy' ;
2+
3+ function testGetterSource ( ) {
4+ class C {
5+ get x ( ) {
6+ return source ( ) ;
7+ }
8+ } ;
9+ sink ( new C ( ) . x ) ; // NOT OK
10+
11+ function indirection ( c ) {
12+ if ( c ) {
13+ sink ( c . x ) ; // NOT OK
14+ }
15+ }
16+ indirection ( new C ( ) ) ;
17+ indirection ( null ) ;
18+ }
19+
20+ function testSetterSink ( ) {
21+ class C {
22+ set x ( v ) {
23+ sink ( v ) ; // NOT OK
24+ }
25+ } ;
26+ function indirection ( c ) {
27+ c . x = source ( ) ;
28+ }
29+ indirection ( new C ( ) ) ;
30+ indirection ( null ) ;
31+ }
32+
33+ function testFlowThroughGetter ( ) {
34+ class C {
35+ constructor ( x ) {
36+ this . _x = x ;
37+ }
38+
39+ get x ( ) {
40+ return this . _x ;
41+ }
42+ } ;
43+
44+ function indirection ( c ) {
45+ sink ( c . x ) ; // NOT OK
46+ }
47+ indirection ( new C ( source ( ) ) ) ;
48+ indirection ( null ) ;
49+
50+ function getX ( c ) {
51+ return c . x ;
52+ }
53+ sink ( getX ( new C ( source ( ) ) ) ) ; // NOT OK
54+ sink ( getX ( new C ( source ( ) ) ) ) ; // NOT OK
55+ }
You can’t perform that action at this time.
0 commit comments