Commit dc16cbe
committed
Java: model org.apache.commons.xml XmlFactories as safe XXE sources
Recognize the hardened JAXP factories returned by
`org.apache.commons.xml.XmlFactories` (Apache Commons XML) as safely
configured, so parsers created from them are no longer reported by the
XXE query (CWE-611).
Adds an extensible `SafeXmlFactorySource` class to XmlParsers.qll and
wires it into the five existing safe-factory flow sources
(DocumentBuilderFactory, SAXParserFactory, XMLInputFactory,
TransformerFactory, SchemaFactory). `newXPathFactory` is matched for
completeness but has no XXE safety chain to feed. The framework model
lives in the existing frameworks/apache/CommonsXml.qll.
Includes a test stub, safe-case tests, and a change note.
Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 1c0ae0f commit dc16cbe
6 files changed
Lines changed: 148 additions & 1 deletion
File tree
- java/ql
- lib
- change-notes
- semmle/code/java
- frameworks/apache
- security
- test
- query-tests/security/CWE-611
- stubs/apache-commons-xml-0.1.0/org/apache/commons/xml
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
59 | 68 | | |
60 | 69 | | |
61 | 70 | | |
| |||
156 | 165 | | |
157 | 166 | | |
158 | 167 | | |
| 168 | + | |
| 169 | + | |
159 | 170 | | |
160 | 171 | | |
161 | 172 | | |
| |||
219 | 230 | | |
220 | 231 | | |
221 | 232 | | |
| 233 | + | |
| 234 | + | |
222 | 235 | | |
223 | 236 | | |
224 | 237 | | |
| |||
456 | 469 | | |
457 | 470 | | |
458 | 471 | | |
| 472 | + | |
| 473 | + | |
459 | 474 | | |
460 | 475 | | |
461 | 476 | | |
| |||
831 | 846 | | |
832 | 847 | | |
833 | 848 | | |
| 849 | + | |
| 850 | + | |
834 | 851 | | |
835 | 852 | | |
836 | 853 | | |
| |||
920 | 937 | | |
921 | 938 | | |
922 | 939 | | |
| 940 | + | |
| 941 | + | |
923 | 942 | | |
924 | 943 | | |
925 | 944 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments