Skip to content

Commit dfeca63

Browse files
author
Max Schaefer
committed
JavaScript: Fix characteristic predicate of XMLParent.
The database type `@xmlparent` is defined a bit too loosely in that it includes all of `@file`, not just XML files. Fixing that would involve fiddling with the extractor/dbscheme, so I have opted to fix it at the QL level instead.
1 parent cb8e5fa commit dfeca63

File tree

1 file changed

+6
-0
lines changed
  • javascript/ql/src/semmle/javascript

1 file changed

+6
-0
lines changed

javascript/ql/src/semmle/javascript/XML.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ abstract class XMLLocatable extends @xmllocatable {
3434
* both of which can contain other elements.
3535
*/
3636
class XMLParent extends @xmlparent {
37+
XMLParent() {
38+
// explicitly restrict `this` to be either an `XMLElement` or an `XMLFile`;
39+
// the type `@xmlparent` currently also includes non-XML files
40+
this instanceof @xmlelement or xmlEncoding(this, _)
41+
}
42+
3743
/**
3844
* Gets a printable representation of this XML parent.
3945
* (Intended to be overridden in subclasses.)

0 commit comments

Comments
 (0)