Merge pull request #2435 from asger-semmle/phi-edge-barrier-guards

JS: Phi edge barrier guards
This commit is contained in:
Max Schaefer
2020-01-06 14:14:18 +00:00
committed by GitHub
6 changed files with 89 additions and 6 deletions

View File

@@ -77,6 +77,7 @@ typeInferenceMismatch
| sanitizer-guards.js:13:14:13:21 | source() | sanitizer-guards.js:26:9:26:14 | this.x |
| sanitizer-guards.js:43:11:43:18 | source() | sanitizer-guards.js:45:8:45:8 | x |
| sanitizer-guards.js:43:11:43:18 | source() | sanitizer-guards.js:48:10:48:10 | x |
| sanitizer-guards.js:68:11:68:18 | source() | sanitizer-guards.js:75:8:75:8 | x |
| spread.js:2:15:2:22 | source() | spread.js:4:8:4:19 | { ...taint } |
| spread.js:2:15:2:22 | source() | spread.js:5:8:5:43 | { f: 'h ... orld' } |
| spread.js:2:15:2:22 | source() | spread.js:7:8:7:19 | [ ...taint ] |

View File

@@ -53,6 +53,7 @@
| sanitizer-guards.js:43:11:43:18 | source() | sanitizer-guards.js:45:8:45:8 | x |
| sanitizer-guards.js:43:11:43:18 | source() | sanitizer-guards.js:48:10:48:10 | x |
| sanitizer-guards.js:43:11:43:18 | source() | sanitizer-guards.js:52:10:52:10 | x |
| sanitizer-guards.js:68:11:68:18 | source() | sanitizer-guards.js:75:8:75:8 | x |
| thisAssignments.js:4:17:4:24 | source() | thisAssignments.js:5:10:5:18 | obj.field |
| thisAssignments.js:7:19:7:26 | source() | thisAssignments.js:8:10:8:20 | this.field2 |
| tst.js:2:13:2:20 | source() | tst.js:4:10:4:10 | x |

View File

@@ -52,3 +52,25 @@ function reflective() {
sink(x); // OK
}
}
function phi() {
let x = source();
if (something(x) && isSafe(x)) {
// this input to the phi node for 'x' should be sanitized
} else {
x = null;
}
sink(x); // OK
}
function phi2() {
let x = source();
if (something(x) || isSafe(x)) {
// this input to the phi node for 'x' is not fully sanitized
} else {
x = null;
}
sink(x); // NOT OK
}