Merge pull request #4600 from porcupineyhairs/urirefactor

Java : Refactor all instances of `java.net.URI` into TypeUri
This commit is contained in:
Anders Schack-Mulligen
2020-11-06 09:35:09 +01:00
committed by GitHub
3 changed files with 10 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ private import semmle.code.java.Maps
private import semmle.code.java.dataflow.internal.ContainerFlow
private import semmle.code.java.frameworks.spring.SpringController
private import semmle.code.java.frameworks.spring.SpringHttp
private import semmle.code.java.frameworks.Networking
import semmle.code.java.dataflow.FlowSteps
/**
@@ -341,7 +342,7 @@ private predicate taintPreservingQualifierToMethod(Method m) {
m.getDeclaringType() instanceof TypeFile and
m.hasName("toURI")
or
m.getDeclaringType().hasQualifiedName("java.net", "URI") and
m.getDeclaringType() instanceof TypeUri and
m.hasName("toURL")
or
m instanceof GetterMethod and m.getDeclaringType() instanceof SpringUntrustedDataType
@@ -469,7 +470,7 @@ private predicate taintPreservingArgumentToMethod(Method method, int arg) {
arg = 0
or
// A URI created from a tainted string is still tainted.
method.getDeclaringType().hasQualifiedName("java.net", "URI") and
method.getDeclaringType() instanceof TypeUri and
method.hasName("create") and
arg = 0
or

View File

@@ -19,6 +19,11 @@ class TypeUrl extends RefType {
TypeUrl() { hasQualifiedName("java.net", "URL") }
}
/** The type `java.net.URI`. */
class TypeUri extends RefType {
TypeUri() { hasQualifiedName("java.net", "URI") }
}
/** The method `java.net.URLConnection::getInputStream`. */
class URLConnectionGetInputStreamMethod extends Method {
URLConnectionGetInputStreamMethod() {