From 9004a8e71f5ff0e225fba0794a728bc8a28d3403 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Mon, 16 Dec 2019 13:31:48 +0100 Subject: [PATCH] Python: Fix characteristic predicate of `XMLParent` Like in https://github.com/Semmle/ql/pull/2520 --- python/ql/src/semmle/python/xml/XML.qll | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/ql/src/semmle/python/xml/XML.qll b/python/ql/src/semmle/python/xml/XML.qll index 13cc8d84f371..f2da6606463d 100755 --- a/python/ql/src/semmle/python/xml/XML.qll +++ b/python/ql/src/semmle/python/xml/XML.qll @@ -29,6 +29,13 @@ abstract class XMLLocatable extends @xmllocatable { * both of which can contain other elements. */ class XMLParent extends @xmlparent { + + XMLParent() { + // explicitly restrict `this` to be either an `XMLElement` or an `XMLFile`; + // the type `@xmlparent` currently also includes non-XML files + this instanceof @xmlelement or xmlEncoding(this, _) + } + /** * A printable representation of this XML parent. * (Intended to be overridden in subclasses.)