Skip to content

Commit 4bb2e8b

Browse files
committed
JS: Update test externs and include array indices
1 parent f23c603 commit 4bb2e8b

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ module DOM {
309309
not read.mayHavePropertyName(_)
310310
or
311311
read.mayHavePropertyName(getADomPropertyName())
312+
or
313+
read.mayHavePropertyName(any(string s | exists(s.toInt())))
312314
)
313315
or
314316
this = domElementCreationOrQuery()

javascript/ql/test/query-tests/Security/CWE-079/externs.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@
2525
function EventTarget() {}
2626

2727
/**
28-
* @type {!EventTarget}
28+
* Stub for the DOM hierarchy.
29+
*
30+
* @constructor
31+
* @extends {EventTarget}
32+
*/
33+
function DomObjectStub() {}
34+
35+
/**
36+
* @type {!DomObjectStub}
37+
*/
38+
DomObjectStub.prototype.body;
39+
40+
/**
41+
* @type {!DomObjectStub}
42+
*/
43+
DomObjectStub.prototype.value;
44+
45+
/**
46+
* @type {!DomObjectStub}
2947
*/
3048
var document;

0 commit comments

Comments
 (0)