Skip to content

Commit 6f5ea86

Browse files
committed
JS: Accept test change in UnsafeHtmlConstruction
Our DOM model doesn't model 'document.implementation', and it seem we don't need to
1 parent 70c867a commit 6f5ea86

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

javascript/ql/test/query-tests/Security/CWE-079/UnsafeHtmlConstruction/UnsafeHtmlConstruction.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,3 @@ nodes
127127
| typed.ts:1:39:1:39 | s | semmle.label | s |
128128
| typed.ts:2:29:2:29 | s | semmle.label | s |
129129
subpaths
130-
testFailures
131-
| typed.ts:6:56:6:66 | // $ Source | Missing result: Source |
132-
| typed.ts:8:55:8:131 | // $ SP ... in DOM. | Fixed spurious result: Alert |

javascript/ql/test/query-tests/Security/CWE-079/UnsafeHtmlConstruction/typed.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ export function basicHtmlConstruction(s: string) { // $ Source
33
document.body.innerHTML = html;
44
}
55

6-
export function insertIntoCreatedDocument(s: string) { // $ Source
6+
export function insertIntoCreatedDocument(s: string) {
77
const newDoc = document.implementation.createHTMLDocument("");
8-
newDoc.body.innerHTML = "<span>" + s + "</span>"; // $ SPURIOUS: Alert - inserted into document disconnected from the main DOM.
8+
newDoc.body.innerHTML = "<span>" + s + "</span>"; // OK - inserted into document disconnected from the main DOM.
99
}
1010

1111
export function id(s: string) {
@@ -17,4 +17,3 @@ export function notVulnerable() {
1717
const html = "<span>" + s + "</span>";
1818
document.body.innerHTML = html;
1919
}
20-

0 commit comments

Comments
 (0)