Skip to content

Commit fb2d53e

Browse files
Salah Baddouchmodxxx
authored andcommitted
Address review: inline Woodstox into XmlParsers, move changelog to lib
1 parent f5131f9 commit fb2d53e

File tree

3 files changed

+27
-98
lines changed

3 files changed

+27
-98
lines changed
File renamed without changes.

java/ql/lib/semmle/code/java/frameworks/woodstox/WoodstoxXml.qll

Lines changed: 0 additions & 93 deletions
This file was deleted.

java/ql/lib/semmle/code/java/security/XmlParsers.qll

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ private module Frameworks {
1212
private import semmle.code.java.frameworks.javase.Beans
1313
private import semmle.code.java.frameworks.mdht.MdhtXml
1414
private import semmle.code.java.frameworks.rundeck.RundeckXml
15-
private import semmle.code.java.frameworks.woodstox.WoodstoxXml
1615
}
1716

1817
/**
@@ -180,12 +179,29 @@ class XmlInputFactory extends RefType {
180179
XmlInputFactory() { this.hasQualifiedName(javaxOrJakarta() + ".xml.stream", "XMLInputFactory") }
181180
}
182181

183-
/** A call to `XMLInputFactory.createXMLStreamReader`. */
182+
/**
183+
* The class `com.ctc.wstx.stax.WstxInputFactory` or its abstract supertype
184+
* `org.codehaus.stax2.XMLInputFactory2` from the Woodstox StAX library.
185+
*/
186+
class WstxInputFactory extends RefType {
187+
WstxInputFactory() {
188+
this.hasQualifiedName("com.ctc.wstx.stax", "WstxInputFactory") or
189+
this.hasQualifiedName("org.codehaus.stax2", "XMLInputFactory2")
190+
}
191+
}
192+
193+
/**
194+
* A call to `XMLInputFactory.createXMLStreamReader` or the equivalent method on the
195+
* Woodstox `WstxInputFactory`.
196+
*/
184197
class XmlInputFactoryStreamReader extends XmlParserCall {
185198
XmlInputFactoryStreamReader() {
186199
exists(Method m |
187200
this.getMethod() = m and
188-
m.getDeclaringType() instanceof XmlInputFactory and
201+
(
202+
m.getDeclaringType() instanceof XmlInputFactory or
203+
m.getDeclaringType() instanceof WstxInputFactory
204+
) and
189205
m.hasName("createXMLStreamReader")
190206
)
191207
}
@@ -213,7 +229,10 @@ class XmlInputFactoryEventReader extends XmlParserCall {
213229
XmlInputFactoryEventReader() {
214230
exists(Method m |
215231
this.getMethod() = m and
216-
m.getDeclaringType() instanceof XmlInputFactory and
232+
(
233+
m.getDeclaringType() instanceof XmlInputFactory or
234+
m.getDeclaringType() instanceof WstxInputFactory
235+
) and
217236
m.hasName("createXMLEventReader")
218237
)
219238
}
@@ -236,7 +255,10 @@ class XmlInputFactoryConfig extends ParserConfig {
236255
XmlInputFactoryConfig() {
237256
exists(Method m |
238257
m = this.getMethod() and
239-
m.getDeclaringType() instanceof XmlInputFactory and
258+
(
259+
m.getDeclaringType() instanceof XmlInputFactory or
260+
m.getDeclaringType() instanceof WstxInputFactory
261+
) and
240262
m.hasName("setProperty")
241263
)
242264
}

0 commit comments

Comments
 (0)