Skip to content

Commit 9ca4f6a

Browse files
authored
Merge pull request #2392 from asger-semmle/window-name-flow
Approved by max-schaefer
2 parents 793988a + 605c883 commit 9ca4f6a

File tree

2 files changed

+1
-8
lines changed
  • javascript/ql

2 files changed

+1
-8
lines changed

javascript/ql/src/semmle/javascript/security/dataflow/DOM.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private class WindowNameAccess extends RemoteFlowSource {
211211
this = DataFlow::globalObjectRef().getAPropertyRead("name")
212212
or
213213
// Reference to `name` on a container that does not assign to it.
214-
this.accessesGlobal("name") and
214+
this.asExpr().(GlobalVarAccess).getName() = "name" and
215215
not exists(VarDef def |
216216
def.getAVariable().(GlobalVariable).getName() = "name" and
217217
def.getContainer() = this.asExpr().getContainer()

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,10 @@ nodes
309309
| tst.js:277:22:277:29 | location |
310310
| tst.js:277:22:277:29 | location |
311311
| tst.js:282:9:282:29 | tainted |
312-
| tst.js:282:9:282:29 | tainted |
313312
| tst.js:282:19:282:29 | window.name |
314313
| tst.js:282:19:282:29 | window.name |
315314
| tst.js:285:59:285:65 | tainted |
316315
| tst.js:285:59:285:65 | tainted |
317-
| tst.js:285:59:285:65 | tainted |
318316
| tst.js:297:35:297:42 | location |
319317
| tst.js:297:35:297:42 | location |
320318
| tst.js:297:35:297:42 | location |
@@ -602,11 +600,8 @@ edges
602600
| tst.js:277:22:277:29 | location | tst.js:277:22:277:29 | location |
603601
| tst.js:282:9:282:29 | tainted | tst.js:285:59:285:65 | tainted |
604602
| tst.js:282:9:282:29 | tainted | tst.js:285:59:285:65 | tainted |
605-
| tst.js:282:9:282:29 | tainted | tst.js:285:59:285:65 | tainted |
606-
| tst.js:282:9:282:29 | tainted | tst.js:285:59:285:65 | tainted |
607603
| tst.js:282:19:282:29 | window.name | tst.js:282:9:282:29 | tainted |
608604
| tst.js:282:19:282:29 | window.name | tst.js:282:9:282:29 | tainted |
609-
| tst.js:285:59:285:65 | tainted | tst.js:285:59:285:65 | tainted |
610605
| tst.js:297:35:297:42 | location | tst.js:297:35:297:42 | location |
611606
| v-html.vue:6:42:6:58 | document.location | v-html.vue:2:8:2:23 | v-html=tainted |
612607
| v-html.vue:6:42:6:58 | document.location | v-html.vue:2:8:2:23 | v-html=tainted |
@@ -694,9 +689,7 @@ edges
694689
| tst.js:257:7:257:10 | name | tst.js:257:7:257:10 | name | tst.js:257:7:257:10 | name | Cross-site scripting vulnerability due to $@. | tst.js:257:7:257:10 | name | user-provided value |
695690
| tst.js:261:11:261:21 | window.name | tst.js:261:11:261:21 | window.name | tst.js:261:11:261:21 | window.name | Cross-site scripting vulnerability due to $@. | tst.js:261:11:261:21 | window.name | user-provided value |
696691
| tst.js:277:22:277:29 | location | tst.js:277:22:277:29 | location | tst.js:277:22:277:29 | location | Cross-site scripting vulnerability due to $@. | tst.js:277:22:277:29 | location | user-provided value |
697-
| tst.js:285:59:285:65 | tainted | tst.js:282:9:282:29 | tainted | tst.js:285:59:285:65 | tainted | Cross-site scripting vulnerability due to $@. | tst.js:282:9:282:29 | tainted | user-provided value |
698692
| tst.js:285:59:285:65 | tainted | tst.js:282:19:282:29 | window.name | tst.js:285:59:285:65 | tainted | Cross-site scripting vulnerability due to $@. | tst.js:282:19:282:29 | window.name | user-provided value |
699-
| tst.js:285:59:285:65 | tainted | tst.js:285:59:285:65 | tainted | tst.js:285:59:285:65 | tainted | Cross-site scripting vulnerability due to $@. | tst.js:285:59:285:65 | tainted | user-provided value |
700693
| tst.js:297:35:297:42 | location | tst.js:297:35:297:42 | location | tst.js:297:35:297:42 | location | Cross-site scripting vulnerability due to $@. | tst.js:297:35:297:42 | location | user-provided value |
701694
| v-html.vue:2:8:2:23 | v-html=tainted | v-html.vue:6:42:6:58 | document.location | v-html.vue:2:8:2:23 | v-html=tainted | Cross-site scripting vulnerability due to $@. | v-html.vue:6:42:6:58 | document.location | user-provided value |
702695
| winjs.js:3:43:3:49 | tainted | winjs.js:2:17:2:33 | document.location | winjs.js:3:43:3:49 | tainted | Cross-site scripting vulnerability due to $@. | winjs.js:2:17:2:33 | document.location | user-provided value |

0 commit comments

Comments
 (0)