File tree Expand file tree Collapse file tree
javascript/ql/test/query-tests/Security/CWE-079/UnsafeHtmlConstruction Expand file tree Collapse file tree Original file line number Diff line number Diff 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 |
129129subpaths
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 |
Original file line number Diff line number Diff 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
1111export function id ( s : string ) {
@@ -17,4 +17,3 @@ export function notVulnerable() {
1717 const html = "<span>" + s + "</span>" ;
1818 document . body . innerHTML = html ;
1919}
20-
You can’t perform that action at this time.
0 commit comments