Commit 2ed10c0
jinsongzhou
[Security] Disable external entity processing in XML upload to prevent XXE
When uploading XML configuration files (e.g. core-site.xml, hdfs-site.xml),
the uploaded bytes are parsed by Hadoop's Configuration.addResource().
Although the current classpath includes Woodstox (which does not expand
external entities by default), this implicit protection is fragile and can
silently break if dependencies change.
This patch explicitly disables external entity processing using a
hardened XMLInputFactory before delegating to Hadoop Configuration,
ensuring XXE protection regardless of the underlying XML parser
implementation.
Changes:
- Pre-validate the XML stream with XMLInputFactory configured to:
- IS_SUPPORTING_EXTERNAL_ENTITIES = false
- SUPPORT_DTD = false
- FEATURE_SECURE_PROCESSING = true
- Switch to Configuration(false) to avoid loading default Hadoop configs1 parent 316f5e8 commit 2ed10c0
File tree
1 file changed
+12
-1
lines changed- amoro-ams/src/main/java/org/apache/amoro/server/dashboard/controller
1 file changed
+12
-1
lines changedLines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
55 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
56 | 67 | | |
57 | 68 | | |
58 | 69 | | |
| |||
0 commit comments