File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
src/semmle/code/java/dataflow/internal
test/library-tests/dataflow/taint Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -377,7 +377,13 @@ private predicate taintPreservingQualifierToMethod(Method m) {
377377 m .getDeclaringType ( ) .hasQualifiedName ( "java.nio" , "ByteBuffer" ) and
378378 m .hasName ( "get" )
379379 or
380- m .getDeclaringType ( ) .hasQualifiedName ( "java.io" , "File" ) and
380+ m .getDeclaringType ( ) instanceof TypeFile and
381+ m .hasName ( "toPath" )
382+ or
383+ m .getDeclaringType ( ) instanceof TypePath and
384+ m .hasName ( "toFile" )
385+ or
386+ m .getDeclaringType ( ) instanceof TypeFile and
381387 m .hasName ( "toURI" )
382388 or
383389 m .getDeclaringType ( ) .hasQualifiedName ( "java.net" , "URI" ) and
Original file line number Diff line number Diff line change @@ -132,6 +132,12 @@ public static void maintest() {
132132 // Tainted file path and URI
133133 sink (new java .io .File (s ).toURI ().toURL ());
134134
135+ // Tainted file to Path
136+ sink (new java .io .File (s ).toPath ());
137+
138+ // Tainted File to Path to File
139+ sink (new java .io .File (s ).toPath ().toFile ());
140+
135141 return ;
136142 }
137143
Original file line number Diff line number Diff line change 3434| B.java:15:21:15:27 | taint(...) | B.java:128:10:128:22 | taintedArray2 |
3535| B.java:15:21:15:27 | taint(...) | B.java:130:10:130:22 | taintedArray3 |
3636| B.java:15:21:15:27 | taint(...) | B.java:133:10:133:44 | toURL(...) |
37+ | B.java:15:21:15:27 | taint(...) | B.java:136:10:136:37 | toPath(...) |
38+ | B.java:15:21:15:27 | taint(...) | B.java:139:10:139:46 | toFile(...) |
3739| MethodFlow.java:7:22:7:28 | taint(...) | MethodFlow.java:8:10:8:16 | tainted |
3840| MethodFlow.java:9:31:9:37 | taint(...) | MethodFlow.java:10:10:10:17 | tainted2 |
3941| MethodFlow.java:11:35:11:41 | taint(...) | MethodFlow.java:12:10:12:17 | tainted3 |
You can’t perform that action at this time.
0 commit comments