Commit fcf5208
authored
fix: harden XML parser against XXE in Cloud Functions sample (#10236)
* fix: harden XML parser against XXE in Cloud Functions sample
DocumentBuilderFactory.newInstance() with default settings allows
external entity resolution. This enables XXE attacks (file read,
SSRF) when parsing untrusted XML input.
Add disallow-doctype-decl feature per OWASP XXE Prevention Cheat Sheet.
* address review: add defense-in-depth features, make field final, fix pom.xml target
- Make dbFactory final per review suggestion
- Add OWASP-recommended defense-in-depth features:
external-general-entities, external-parameter-entities,
load-external-dtd, XIncludeAware, ExpandEntityReferences
- Fix pom.xml functionTarget: ParseContentType -> ParseXml1 parent 42d5952 commit fcf5208
File tree
2 files changed
+17
-2
lines changed- functions/http/parse-xml
- src/main/java/functions
2 files changed
+17
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
36 | 51 | | |
37 | 52 | | |
38 | 53 | | |
| |||
0 commit comments