File tree Expand file tree Collapse file tree 4 files changed +8
-3
lines changed
test/query-tests/Security/CWE-079/DomBasedXss Expand file tree Collapse file tree 4 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ module DOM {
247247 ]
248248 |
249249 (
250- result = documentRef ( ) .getAMethodCall ( collectionName ) or
250+ result = domValueRef ( ) .getAMethodCall ( collectionName ) or
251251 result = DataFlow:: globalVarRef ( collectionName ) .getACall ( )
252252 )
253253 )
@@ -441,10 +441,12 @@ module DOM {
441441 DataFlow:: SourceNode domValueRef ( ) {
442442 result = domValueRef ( DataFlow:: TypeTracker:: end ( ) )
443443 or
444- result .hasUnderlyingType ( "Element" )
444+ result .hasUnderlyingType ( [ "Element" , "HTMLCollection" , "HTMLCollectionOf" ] )
445445 or
446446 result .hasUnderlyingType ( any ( string s | s .matches ( "HTML%Element" ) ) )
447447 or
448+ result = documentRef ( )
449+ or
448450 exists ( DataFlow:: ClassNode cls |
449451 cls .getASuperClassNode ( ) .getALocalSource ( ) =
450452 DataFlow:: globalVarRef ( any ( string s | s .matches ( "HTML%Element" ) ) ) and
Original file line number Diff line number Diff line change 5353| dates.js:57:31:57:101 | `Time i ... aint)}` | dates.js:54:36:54:55 | window.location.hash | dates.js:57:31:57:101 | `Time i ... aint)}` | Cross-site scripting vulnerability due to $@. | dates.js:54:36:54:55 | window.location.hash | user-provided value |
5454| dates.js:59:31:59:87 | `Time i ... aint)}` | dates.js:54:36:54:55 | window.location.hash | dates.js:59:31:59:87 | `Time i ... aint)}` | Cross-site scripting vulnerability due to $@. | dates.js:54:36:54:55 | window.location.hash | user-provided value |
5555| dates.js:61:31:61:88 | `Time i ... aint)}` | dates.js:54:36:54:55 | window.location.hash | dates.js:61:31:61:88 | `Time i ... aint)}` | Cross-site scripting vulnerability due to $@. | dates.js:54:36:54:55 | window.location.hash | user-provided value |
56+ | dom.js:4:20:4:30 | window.name | dom.js:4:20:4:30 | window.name | dom.js:4:20:4:30 | window.name | Cross-site scripting vulnerability due to $@. | dom.js:4:20:4:30 | window.name | user-provided value |
5657| dragAndDrop.ts:15:25:15:28 | html | dragAndDrop.ts:8:18:8:50 | dataTra ... /html') | dragAndDrop.ts:15:25:15:28 | html | Cross-site scripting vulnerability due to $@. | dragAndDrop.ts:8:18:8:50 | dataTra ... /html') | user-provided value |
5758| dragAndDrop.ts:24:23:24:57 | e.dataT ... /html') | dragAndDrop.ts:24:23:24:57 | e.dataT ... /html') | dragAndDrop.ts:24:23:24:57 | e.dataT ... /html') | Cross-site scripting vulnerability due to $@. | dragAndDrop.ts:24:23:24:57 | e.dataT ... /html') | user-provided value |
5859| dragAndDrop.ts:29:19:29:53 | e.dataT ... /html') | dragAndDrop.ts:29:19:29:53 | e.dataT ... /html') | dragAndDrop.ts:29:19:29:53 | e.dataT ... /html') | Cross-site scripting vulnerability due to $@. | dragAndDrop.ts:29:19:29:53 | e.dataT ... /html') | user-provided value |
@@ -937,6 +938,7 @@ nodes
937938| dates.js:61:31:61:88 | `Time i ... aint)}` | semmle.label | `Time i ... aint)}` |
938939| dates.js:61:42:61:86 | dayjs.s ... (taint) | semmle.label | dayjs.s ... (taint) |
939940| dates.js:61:81:61:85 | taint | semmle.label | taint |
941+ | dom.js:4:20:4:30 | window.name | semmle.label | window.name |
940942| dragAndDrop.ts:8:11:8:50 | html | semmle.label | html |
941943| dragAndDrop.ts:8:18:8:50 | dataTra ... /html') | semmle.label | dataTra ... /html') |
942944| dragAndDrop.ts:15:25:15:28 | html | semmle.label | html |
Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ nodes
138138| dates.js:61:31:61:88 | `Time i ... aint)}` | semmle.label | `Time i ... aint)}` |
139139| dates.js:61:42:61:86 | dayjs.s ... (taint) | semmle.label | dayjs.s ... (taint) |
140140| dates.js:61:81:61:85 | taint | semmle.label | taint |
141+ | dom.js:4:20:4:30 | window.name | semmle.label | window.name |
141142| dragAndDrop.ts:8:11:8:50 | html | semmle.label | html |
142143| dragAndDrop.ts:8:18:8:50 | dataTra ... /html') | semmle.label | dataTra ... /html') |
143144| dragAndDrop.ts:15:25:15:28 | html | semmle.label | html |
Original file line number Diff line number Diff line change 11function t1 ( ) {
22 const elm = document . getElementById ( "foo" ) ;
33 const e2 = elm . getElementsByTagName ( "bar" ) [ 0 ] ;
4- e2 . innerHTML = window . name ; // $ MISSING: Alert
4+ e2 . innerHTML = window . name ; // $ Alert
55}
You can’t perform that action at this time.
0 commit comments