File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
javascript/ql/test/library-tests/TripleDot Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -142,3 +142,34 @@ function t8() {
142142 const taint = source ( 't8.1' ) + ' taint' ;
143143 foo ( taint ) ;
144144}
145+
146+ function t9 ( ) { // same as t8 but with a SanitizerGuard that isn't just a variable access
147+ function foo ( x ) {
148+ const obj = { } ;
149+ obj . field = x ;
150+
151+ sink ( obj . field ) ; // $ hasTaintFlow=t9.1
152+
153+ if ( typeof obj !== "undefined" ) {
154+ sink ( obj . field ) ; // $ hasTaintFlow=t9.1
155+ } else {
156+ sink ( obj . field ) ;
157+ }
158+
159+ if ( typeof obj === "undefined" ) {
160+ sink ( obj . field ) ;
161+ } else {
162+ sink ( obj . field ) ; // $ hasTaintFlow=t9.1
163+ }
164+
165+ if ( typeof obj === "undefined" || typeof obj === "undefined" ) {
166+ sink ( obj . field ) ; // $ SPURIOUS: hasTaintFlow=t9.1
167+ } else {
168+ sink ( obj . field ) ; // $ hasTaintFlow=t9.1
169+ }
170+ }
171+
172+ // The guards used above are specific to taint-tracking, to ensure only taint flows in
173+ const taint = source ( 't9.1' ) + ' taint' ;
174+ foo ( taint ) ;
175+ }
You can’t perform that action at this time.
0 commit comments