Java: Add Spring flow out of HttpEntity and HttpHeader

This commit is contained in:
lcartey@github.com
2020-05-18 00:25:14 +01:00
parent 93c28d4c03
commit cd6339f5cd
2 changed files with 17 additions and 0 deletions

View File

@@ -393,6 +393,19 @@ private predicate taintPreservingQualifierToMethod(Method m) {
exists(SpringUntrustedDataType dt |
m.(GetterMethod) = dt.getAMethod()
)
or
exists(SpringHttpEntity sre |
m = sre.getAMethod() and
m.getName().regexpMatch("getBody|getHeaders")
)
or
exists(SpringHttpHeaders headers |
m = headers.getAMethod() |
m.getReturnType() instanceof TypeString
or
m.getReturnType().(RefType).getSourceDeclaration().getASourceSupertype*().hasQualifiedName("java.util", "List") and
m.getReturnType().(ParameterizedType).getTypeArgument(0) instanceof TypeString
)
}
private class StringReplaceMethod extends Method {

View File

@@ -32,4 +32,8 @@ class SpringResponseEntityBodyBuilder extends Interface {
getSourceDeclaration().getEnclosingType() = any(SpringResponseEntity sre) and
hasName("BodyBuilder")
}
}
class SpringHttpHeaders extends Class {
SpringHttpHeaders() { hasQualifiedName("org.springframework.http", "HttpHeaders") }
}