Skip to content

Commit c784f15

Browse files
committed
Python: Rename more XML classes to follow convention
- `XMLEtree` to `XmlEtree` - `XMLSax` to `XmlSax` - `LXML` to `Lxml` - `XMLParser` to `XmlParser`
1 parent 23637fd commit c784f15

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

python/ql/lib/semmle/python/frameworks/Lxml.qll

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ private module Lxml {
109109
*
110110
* See https://lxml.de/apidoc/lxml.etree.html?highlight=xmlparser#lxml.etree.XMLParser
111111
*/
112-
module XMLParser {
112+
module XmlParser {
113113
/**
114114
* A source of instances of `lxml.etree` parsers, extend this class to model new instances.
115115
*
116116
* This can include instantiations of the class, return values from function
117117
* calls, or a special parameter that will be set when functions are called by an external
118118
* library.
119119
*
120-
* Use the predicate `XMLParser::instance()` to get references to instances of `lxml.etree` parsers.
120+
* Use the predicate `XmlParser::instance()` to get references to instances of `lxml.etree` parsers.
121121
*/
122122
abstract class InstanceSource extends DataFlow::LocalSourceNode {
123123
/** Holds if this instance is vulnerable to `kind`. */
@@ -129,8 +129,8 @@ private module Lxml {
129129
*
130130
* See https://lxml.de/apidoc/lxml.etree.html?highlight=xmlparser#lxml.etree.XMLParser
131131
*/
132-
private class LXMLParser extends InstanceSource, DataFlow::CallCfgNode {
133-
LXMLParser() {
132+
private class LxmlParser extends InstanceSource, DataFlow::CallCfgNode {
133+
LxmlParser() {
134134
this = API::moduleImport("lxml").getMember("etree").getMember("XMLParser").getACall()
135135
}
136136

@@ -159,8 +159,8 @@ private module Lxml {
159159
*
160160
* See https://lxml.de/apidoc/lxml.etree.html?highlight=xmlparser#lxml.etree.get_default_parser
161161
*/
162-
private class LXMLDefaultParser extends InstanceSource, DataFlow::CallCfgNode {
163-
LXMLDefaultParser() {
162+
private class LxmlDefaultParser extends InstanceSource, DataFlow::CallCfgNode {
163+
LxmlDefaultParser() {
164164
this =
165165
API::moduleImport("lxml").getMember("etree").getMember("get_default_parser").getACall()
166166
}
@@ -196,8 +196,8 @@ private module Lxml {
196196
/**
197197
* A call to the `feed` method of an `lxml` parser.
198198
*/
199-
private class LXMLParserFeedCall extends DataFlow::MethodCallNode, XML::XmlParsing::Range {
200-
LXMLParserFeedCall() { this.calls(instance(_), "feed") }
199+
private class LxmlParserFeedCall extends DataFlow::MethodCallNode, XML::XmlParsing::Range {
200+
LxmlParserFeedCall() { this.calls(instance(_), "feed") }
201201

202202
override DataFlow::Node getAnInput() { result in [this.getArg(0), this.getArgByName("data")] }
203203

@@ -233,8 +233,8 @@ private module Lxml {
233233
* - https://lxml.de/apidoc/lxml.etree.html?highlight=parseids#lxml.etree.parse
234234
* - https://lxml.de/apidoc/lxml.etree.html?highlight=parseids#lxml.etree.parseid
235235
*/
236-
private class LXMLParsing extends DataFlow::CallCfgNode, XML::XmlParsing::Range {
237-
LXMLParsing() {
236+
private class LxmlParsing extends DataFlow::CallCfgNode, XML::XmlParsing::Range {
237+
LxmlParsing() {
238238
this =
239239
API::moduleImport("lxml")
240240
.getMember("etree")
@@ -257,7 +257,7 @@ private module Lxml {
257257
DataFlow::Node getParserArg() { result in [this.getArg(1), this.getArgByName("parser")] }
258258

259259
override predicate vulnerableTo(XML::XmlParsingVulnerabilityKind kind) {
260-
this.getParserArg() = XMLParser::instanceVulnerableTo(kind)
260+
this.getParserArg() = XmlParser::instanceVulnerableTo(kind)
261261
or
262262
kind.isXxe() and
263263
not exists(this.getParserArg())
@@ -284,8 +284,8 @@ private module Lxml {
284284
* - https://lxml.de/apidoc/lxml.etree.html?highlight=parseids#lxml.etree.parse
285285
* - https://lxml.de/apidoc/lxml.etree.html?highlight=parseids#lxml.etree.parseid
286286
*/
287-
private class FileAccessFromLXMLParsing extends LXMLParsing, FileSystemAccess::Range {
288-
FileAccessFromLXMLParsing() {
287+
private class FileAccessFromLxmlParsing extends LxmlParsing, FileSystemAccess::Range {
288+
FileAccessFromLxmlParsing() {
289289
this = API::moduleImport("lxml").getMember("etree").getMember(["parse", "parseid"]).getACall()
290290
// I considered whether we should try to reduce FPs from people passing file-like
291291
// objects, which will not be a file system access (and couldn't cause a
@@ -305,9 +305,9 @@ private module Lxml {
305305
* See
306306
* - https://lxml.de/apidoc/lxml.etree.html?highlight=parseids#lxml.etree.iterparse
307307
*/
308-
private class LXMLIterparseCall extends DataFlow::CallCfgNode, XML::XmlParsing::Range,
308+
private class LxmlIterparseCall extends DataFlow::CallCfgNode, XML::XmlParsing::Range,
309309
FileSystemAccess::Range {
310-
LXMLIterparseCall() {
310+
LxmlIterparseCall() {
311311
this = API::moduleImport("lxml").getMember("etree").getMember("iterparse").getACall()
312312
}
313313

python/ql/lib/semmle/python/frameworks/Stdlib.qll

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,15 +3191,15 @@ private module StdlibPrivate {
31913191
* - https://docs.python.org/3.10/library/xml.etree.elementtree.html#xml.etree.ElementTree.XMLParser
31923192
* - https://docs.python.org/3.10/library/xml.etree.elementtree.html#xml.etree.ElementTree.XMLPullParser
31933193
*/
3194-
module XMLParser {
3194+
module XmlParser {
31953195
/**
31963196
* A source of instances of `xml.etree` parsers, extend this class to model new instances.
31973197
*
31983198
* This can include instantiations of the class, return values from function
31993199
* calls, or a special parameter that will be set when functions are called by an external
32003200
* library.
32013201
*
3202-
* Use the predicate `XMLParser::instance()` to get references to instances of `xml.etree` parsers.
3202+
* Use the predicate `XmlParser::instance()` to get references to instances of `xml.etree` parsers.
32033203
*/
32043204
abstract class InstanceSource extends DataFlow::LocalSourceNode { }
32053205

@@ -3236,8 +3236,8 @@ private module StdlibPrivate {
32363236
/**
32373237
* A call to the `feed` method of an `xml.etree` parser.
32383238
*/
3239-
private class XMLEtreeParserFeedCall extends DataFlow::MethodCallNode, XML::XmlParsing::Range {
3240-
XMLEtreeParserFeedCall() { this.calls(instance(), "feed") }
3239+
private class XmlEtreeParserFeedCall extends DataFlow::MethodCallNode, XML::XmlParsing::Range {
3240+
XmlEtreeParserFeedCall() { this.calls(instance(), "feed") }
32413241

32423242
override DataFlow::Node getAnInput() { result in [this.getArg(0), this.getArgByName("data")] }
32433243

@@ -3274,8 +3274,8 @@ private module StdlibPrivate {
32743274
* - https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.parse
32753275
* - https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.iterparse
32763276
*/
3277-
private class XMLEtreeParsing extends DataFlow::CallCfgNode, XML::XmlParsing::Range {
3278-
XMLEtreeParsing() {
3277+
private class XmlEtreeParsing extends DataFlow::CallCfgNode, XML::XmlParsing::Range {
3278+
XmlEtreeParsing() {
32793279
this =
32803280
API::moduleImport("xml")
32813281
.getMember("etree")
@@ -3325,8 +3325,8 @@ private module StdlibPrivate {
33253325
* - https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.parse
33263326
* - https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.iterparse
33273327
*/
3328-
private class FileAccessFromXMLEtreeParsing extends XMLEtreeParsing, FileSystemAccess::Range {
3329-
FileAccessFromXMLEtreeParsing() {
3328+
private class FileAccessFromXmlEtreeParsing extends XmlEtreeParsing, FileSystemAccess::Range {
3329+
FileAccessFromXmlEtreeParsing() {
33303330
this =
33313331
API::moduleImport("xml")
33323332
.getMember("etree")
@@ -3445,9 +3445,9 @@ private module StdlibPrivate {
34453445
*
34463446
* See https://docs.python.org/3/library/xml.sax.reader.html#xml.sax.xmlreader.XMLReader.parse
34473447
*/
3448-
private class XMLSaxInstanceParsing extends DataFlow::MethodCallNode, XML::XmlParsing::Range,
3448+
private class XmlSaxInstanceParsing extends DataFlow::MethodCallNode, XML::XmlParsing::Range,
34493449
FileSystemAccess::Range {
3450-
XMLSaxInstanceParsing() {
3450+
XmlSaxInstanceParsing() {
34513451
this =
34523452
API::moduleImport("xml")
34533453
.getMember("sax")
@@ -3496,8 +3496,8 @@ private module StdlibPrivate {
34963496
* - https://docs.python.org/3.10/library/xml.sax.html#xml.sax.parse
34973497
* - https://docs.python.org/3.10/library/xml.sax.html#xml.sax.parseString
34983498
*/
3499-
private class XMLSaxParsing extends DataFlow::CallCfgNode, XML::XmlParsing::Range {
3500-
XMLSaxParsing() {
3499+
private class XmlSaxParsing extends DataFlow::CallCfgNode, XML::XmlParsing::Range {
3500+
XmlSaxParsing() {
35013501
this =
35023502
API::moduleImport("xml").getMember("sax").getMember(["parse", "parseString"]).getACall()
35033503
}
@@ -3535,8 +3535,8 @@ private module StdlibPrivate {
35353535
* - https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.parse
35363536
* - https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.iterparse
35373537
*/
3538-
private class FileAccessFromXMLSaxParsing extends XMLSaxParsing, FileSystemAccess::Range {
3539-
FileAccessFromXMLSaxParsing() {
3538+
private class FileAccessFromXmlSaxParsing extends XmlSaxParsing, FileSystemAccess::Range {
3539+
FileAccessFromXmlSaxParsing() {
35403540
this = API::moduleImport("xml").getMember("sax").getMember("parse").getACall()
35413541
// I considered whether we should try to reduce FPs from people passing file-like
35423542
// objects, which will not be a file system access (and couldn't cause a

0 commit comments

Comments
 (0)