@@ -21,7 +21,7 @@ To run these rules against your Java codebase:
21
21
codepathfinder ci --project /src/project --ruleset cpf/java
22
22
```
23
23
24
- #### Rules (4 )
24
+ #### Rules (7 )
25
25
26
26
<RuleSearch placeholder = " Search security rules and patterns..." />
27
27
@@ -117,6 +117,38 @@ SSLSocket socket = (SSLSocket) factory.createSocket("example.com", 443);`}
117
117
</Card >
118
118
</div >
119
119
120
+
121
+ <div class = " rule-card" data-severity = " high" data-type = " security" data-owasp = " xml-external-entities" >
122
+ <Card title = " XML External Entity (XXE) Vulnerability" icon = " warning" >
123
+ <div class = " description" >
124
+ ** Severity: High** | ** OWASP: XML External Entities (XXE)**
125
+ Identifies insecure XML parser configurations that could allow XXE attacks, potentially leading to data disclosure, denial of service, or server-side request forgery.
126
+ </div >
127
+ <div class = " code-section" >
128
+ <CollapsibleCode
129
+ code = { `
130
+ // ❌ Vulnerable: Disabling protection
131
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
132
+ dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
133
+ DocumentBuilder builder = dbf.newDocumentBuilder();
134
+
135
+ // ✅ Safe: Properly configured XML parser
136
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
137
+ dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
138
+ dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
139
+ dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
140
+ dbf.setXIncludeAware(false);
141
+ dbf.setExpandEntityReferences(false);
142
+ DocumentBuilder builder = dbf.newDocumentBuilder(); ` }
143
+ lang = " java"
144
+ title = " XML Parser Configuration Example"
145
+ marks = { [' Vulnerable' , ' Vulnerable' , ' Safe' ]}
146
+ />
147
+ </div >
148
+ </Card >
149
+ </div >
150
+
151
+
120
152
</div >
121
153
122
154
For more information on using Code PathFinder with Java, see our [ documentation] ( /overview ) .
0 commit comments