File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
shogun-gs-interceptor/src/main/java/de/terrestris/shogun/interceptor/util Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -85,14 +85,10 @@ public static Document getDocumentFromString(String xml) throws IOException {
8585 InputSource source = new InputSource (new StringReader (xml ));
8686 DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance ();
8787
88- try {
89- // limit resolution of external entities, see https://rules.sonarsource.com/c/type/Vulnerability/RSPEC-2755
90- factory .setAttribute (XMLConstants .ACCESS_EXTERNAL_DTD , "" );
91- factory .setAttribute (XMLConstants .ACCESS_EXTERNAL_SCHEMA , "" );
92- } catch (IllegalArgumentException e ) {
93- log .error ("External DTD/Schema access properties not supported:"
94- + e .getMessage ());
95- }
88+ factory .setFeature (XMLConstants .FEATURE_SECURE_PROCESSING , true );
89+ factory .setFeature ("http://apache.org/xml/features/disallow-doctype-decl" , true );
90+ factory .setFeature ("http://xml.org/sax/features/external-general-entities" , false );
91+ factory .setFeature ("http://xml.org/sax/features/external-parameter-entities" , false );
9692
9793 DocumentBuilder builder = factory .newDocumentBuilder ();
9894 document = builder .parse (source );
You can’t perform that action at this time.
0 commit comments