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 {
159
159
Expr singleSafeConfig ( ) {
160
160
result .( ConstantStringExpr ) .getStringValue ( ) =
161
161
"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
- )
171
162
}
172
163
173
164
/**
Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ public void enableSecurityFeature(Socket sock) throws Exception {
25
25
DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance ();
26
26
factory .setFeature (XMLConstants .FEATURE_SECURE_PROCESSING , true );
27
27
DocumentBuilder builder = factory .newDocumentBuilder ();
28
- builder .parse (sock .getInputStream ()); //safe
28
+ builder .parse (sock .getInputStream ()); //unsafe -- secure-processing by itself is insufficient
29
29
}
30
30
31
31
public void enableSecurityFeature2 (Socket sock ) throws Exception {
32
32
DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance ();
33
33
factory .setFeature ("http://javax.xml.XMLConstants/feature/secure-processing" , true );
34
34
DocumentBuilder builder = factory .newDocumentBuilder ();
35
- builder .parse (sock .getInputStream ()); //safe
35
+ builder .parse (sock .getInputStream ()); //unsafe -- secure-processing by itself is insufficient
36
36
}
37
37
38
38
public void enableDTD (Socket sock ) throws Exception {
Original file line number Diff line number Diff line change 77
77
| XPathExpressionTests.java:27:37:27:57 | getInputStream(...) : InputStream | XPathExpressionTests.java:27:21:27:58 | new InputSource(...) |
78
78
nodes
79
79
| 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(...) |
80
82
| DocumentBuilderTests.java:42:19:42:39 | getInputStream(...) | semmle.label | getInputStream(...) |
81
83
| DocumentBuilderTests.java:49:19:49:39 | getInputStream(...) | semmle.label | getInputStream(...) |
82
84
| DocumentBuilderTests.java:64:19:64:39 | getInputStream(...) | semmle.label | getInputStream(...) |
@@ -250,6 +252,8 @@ nodes
250
252
subpaths
251
253
#select
252
254
| 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 |
253
257
| 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 |
254
258
| 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 |
255
259
| 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