File tree Expand file tree Collapse file tree 3 files changed +6
-11
lines changed
lib/semmle/code/java/security
test/query-tests/security/CWE-611 Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -159,15 +159,6 @@ private class ConstantStringExpr extends Expr {
159159Expr singleSafeConfig ( ) {
160160 result .( ConstantStringExpr ) .getStringValue ( ) =
161161 "http://apache.org/xml/features/disallow-doctype-decl"
162- or
163- result .( ConstantStringExpr ) .getStringValue ( ) =
164- "http://javax.xml.XMLConstants/feature/secure-processing"
165- or
166- exists ( Field f |
167- result = f .getAnAccess ( ) and
168- f .hasName ( "FEATURE_SECURE_PROCESSING" ) and
169- f .getDeclaringType ( ) .hasQualifiedName ( "javax.xml" , "XMLConstants" )
170- )
171162}
172163
173164/**
Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ public void enableSecurityFeature(Socket sock) throws Exception {
2525 DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance ();
2626 factory .setFeature (XMLConstants .FEATURE_SECURE_PROCESSING , true );
2727 DocumentBuilder builder = factory .newDocumentBuilder ();
28- builder .parse (sock .getInputStream ()); //safe
28+ builder .parse (sock .getInputStream ()); //unsafe -- secure-processing by itself is insufficient
2929 }
3030
3131 public void enableSecurityFeature2 (Socket sock ) throws Exception {
3232 DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance ();
3333 factory .setFeature ("http://javax.xml.XMLConstants/feature/secure-processing" , true );
3434 DocumentBuilder builder = factory .newDocumentBuilder ();
35- builder .parse (sock .getInputStream ()); //safe
35+ builder .parse (sock .getInputStream ()); //unsafe -- secure-processing by itself is insufficient
3636 }
3737
3838 public void enableDTD (Socket sock ) throws Exception {
Original file line number Diff line number Diff line change 7777| XPathExpressionTests.java:27:37:27:57 | getInputStream(...) : InputStream | XPathExpressionTests.java:27:21:27:58 | new InputSource(...) |
7878nodes
7979| DocumentBuilderTests.java:14:19:14:39 | getInputStream(...) | semmle.label | getInputStream(...) |
80+ | DocumentBuilderTests.java:28:19:28:39 | getInputStream(...) | semmle.label | getInputStream(...) |
81+ | DocumentBuilderTests.java:35:19:35:39 | getInputStream(...) | semmle.label | getInputStream(...) |
8082| DocumentBuilderTests.java:42:19:42:39 | getInputStream(...) | semmle.label | getInputStream(...) |
8183| DocumentBuilderTests.java:49:19:49:39 | getInputStream(...) | semmle.label | getInputStream(...) |
8284| DocumentBuilderTests.java:64:19:64:39 | getInputStream(...) | semmle.label | getInputStream(...) |
@@ -250,6 +252,8 @@ nodes
250252subpaths
251253#select
252254| DocumentBuilderTests.java:14:19:14:39 | getInputStream(...) | DocumentBuilderTests.java:14:19:14:39 | getInputStream(...) | DocumentBuilderTests.java:14:19:14:39 | getInputStream(...) | Unsafe parsing of XML file from $@. | DocumentBuilderTests.java:14:19:14:39 | getInputStream(...) | user input |
255+ | DocumentBuilderTests.java:28:19:28:39 | getInputStream(...) | DocumentBuilderTests.java:28:19:28:39 | getInputStream(...) | DocumentBuilderTests.java:28:19:28:39 | getInputStream(...) | Unsafe parsing of XML file from $@. | DocumentBuilderTests.java:28:19:28:39 | getInputStream(...) | user input |
256+ | DocumentBuilderTests.java:35:19:35:39 | getInputStream(...) | DocumentBuilderTests.java:35:19:35:39 | getInputStream(...) | DocumentBuilderTests.java:35:19:35:39 | getInputStream(...) | Unsafe parsing of XML file from $@. | DocumentBuilderTests.java:35:19:35:39 | getInputStream(...) | user input |
253257| DocumentBuilderTests.java:42:19:42:39 | getInputStream(...) | DocumentBuilderTests.java:42:19:42:39 | getInputStream(...) | DocumentBuilderTests.java:42:19:42:39 | getInputStream(...) | Unsafe parsing of XML file from $@. | DocumentBuilderTests.java:42:19:42:39 | getInputStream(...) | user input |
254258| DocumentBuilderTests.java:49:19:49:39 | getInputStream(...) | DocumentBuilderTests.java:49:19:49:39 | getInputStream(...) | DocumentBuilderTests.java:49:19:49:39 | getInputStream(...) | Unsafe parsing of XML file from $@. | DocumentBuilderTests.java:49:19:49:39 | getInputStream(...) | user input |
255259| DocumentBuilderTests.java:64:19:64:39 | getInputStream(...) | DocumentBuilderTests.java:64:19:64:39 | getInputStream(...) | DocumentBuilderTests.java:64:19:64:39 | getInputStream(...) | Unsafe parsing of XML file from $@. | DocumentBuilderTests.java:64:19:64:39 | getInputStream(...) | user input |
You can’t perform that action at this time.
0 commit comments