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 @@ -73,8 +73,8 @@ typeInferenceMismatch
7373| nested-props.js:43:13:43:20 | source() | nested-props.js:44:10:44:18 | id(obj).x |
7474| nested-props.js:67:31:67:38 | source() | nested-props.js:68:10:68:10 | x |
7575| nested-props.js:77:36:77:43 | source() | nested-props.js:78:10:78:10 | x |
76- | object-bypass-sanitizer.js:23:13:23:20 | source() | object-bypass-sanitizer.js:12 :14:12:18 | x .foo |
77- | object-bypass-sanitizer.js:23:13:23:20 | source() | object-bypass-sanitizer.js:17 :10:17:28 | sanitizer_id(x ).foo |
76+ | object-bypass-sanitizer.js:35:29:35:36 | source() | object-bypass-sanitizer.js:23 :14:23:20 | obj .foo |
77+ | object-bypass-sanitizer.js:35:29:35:36 | source() | object-bypass-sanitizer.js:28 :10:28:30 | sanitiz ... bj ).foo |
7878| partialCalls.js:4:17:4:24 | source() | partialCalls.js:17:14:17:14 | x |
7979| partialCalls.js:4:17:4:24 | source() | partialCalls.js:20:14:20:14 | y |
8080| partialCalls.js:4:17:4:24 | source() | partialCalls.js:30:14:30:20 | x.value |
Original file line number Diff line number Diff line change 4747| nested-props.js:35:13:35:20 | source() | nested-props.js:36:10:36:20 | doLoad(obj) |
4848| nested-props.js:43:13:43:20 | source() | nested-props.js:44:10:44:18 | id(obj).x |
4949| nested-props.js:67:31:67:38 | source() | nested-props.js:68:10:68:10 | x |
50- | object-bypass-sanitizer.js:21:7: 21:14 | source() | object-bypass-sanitizer.js:15:10:15:24 | sanitizer_id(x) |
51- | object-bypass-sanitizer.js:23:13:23:20 | source() | object-bypass-sanitizer.js:16 :10:16:28 | sanitizer_id(x .foo) |
52- | object-bypass-sanitizer.js:23:13:23:20 | source() | object-bypass-sanitizer.js:17 :10:17:28 | sanitizer_id(x ).foo |
50+ | object-bypass-sanitizer.js:32: 21:32:28 | source() | object-bypass-sanitizer.js:15:10:15:24 | sanitizer_id(x) |
51+ | object-bypass-sanitizer.js:35:29:35:36 | source() | object-bypass-sanitizer.js:27 :10:27:30 | sanitiz ... bj .foo) |
52+ | object-bypass-sanitizer.js:35:29:35:36 | source() | object-bypass-sanitizer.js:28 :10:28:30 | sanitiz ... bj ).foo |
5353| partialCalls.js:4:17:4:24 | source() | partialCalls.js:17:14:17:14 | x |
5454| partialCalls.js:4:17:4:24 | source() | partialCalls.js:20:14:20:14 | y |
5555| partialCalls.js:4:17:4:24 | source() | partialCalls.js:30:14:30:20 | x.value |
Original file line number Diff line number Diff line change @@ -6,19 +6,32 @@ function sanitizer_id(x) {
66 return null ;
77}
88
9- function f ( x ) {
9+ function useTaintedValue ( x ) {
1010 if ( isSafe ( x ) ) {
11- sink ( x ) ;
12- sink ( x . foo ) ; // NOT OK
11+ sink ( x ) ; // OK
12+ sink ( x . foo ) ; // OK
1313 }
1414
1515 sink ( sanitizer_id ( x ) ) ; // OK
1616 sink ( sanitizer_id ( x . foo ) ) ; // OK
17- sink ( sanitizer_id ( x ) . foo ) ; // NOT OK
17+ sink ( sanitizer_id ( x ) . foo ) ; // OK
1818}
1919
20- function g ( ) {
21- f ( source ( ) ) ; // OK
22- f ( null ) ;
23- f ( { foo : source ( ) } ) ; // NOT OK
20+ function useTaintedObject ( obj ) {
21+ if ( isSafe ( obj ) ) {
22+ sink ( obj ) ; // OK
23+ sink ( obj . foo ) ; // NOT OK
24+ }
25+
26+ sink ( sanitizer_id ( obj ) ) ; // OK
27+ sink ( sanitizer_id ( obj . foo ) ) ; // OK
28+ sink ( sanitizer_id ( obj ) . foo ) ; // NOT OK
29+ }
30+
31+ function test ( ) {
32+ useTaintedValue ( source ( ) ) ;
33+ useTaintedValue ( null ) ;
34+
35+ useTaintedObject ( { foo : source ( ) } ) ;
36+ useTaintedObject ( null ) ;
2437}
You can’t perform that action at this time.
0 commit comments