Skip to content

Commit 58bc1e8

Browse files
ddamkeddamke
authored andcommitted
add Sonar issue description
1 parent 7b505c4 commit 58bc1e8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/main/java/de/doubleslash/keeptime/common/SvgNodeProvider.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,22 @@ public static String getSvgPathWithXMl(Resources.RESOURCE resource){
2424
String svgPath;
2525
Document document;
2626
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
27-
/* try {
27+
try {
2828
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
2929
} catch (ParserConfigurationException e) {
3030
throw new RuntimeException(e);
31-
}*/
31+
}
32+
33+
/* Fixes Sonar Vulnerability Issue "XML parsers should not be vulnerable to XXE attacks"
34+
* XML standard allows the use of entities, declared in the DOCTYPE of the document, which can be internal or external.
35+
Problem:
36+
When parsing the XML file, the content of the external entities is retrieved from an external storage such as the file system or network,
37+
which may lead, if no restrictions are put in place, to arbitrary file disclosures or server-side request forgery (SSRF) vulnerabilities.
3238
39+
Solution:
40+
*It’s recommended to limit resolution of external entities by using one of these solutions:
41+
If DOCTYPE is not necessary, completely disable all DOCTYPE declarations.
42+
* */
3343

3444
DocumentBuilder db;
3545

0 commit comments

Comments
 (0)