Add sink for OpenSAML's RequestType.setID

This commit is contained in:
Tony Torralba
2023-11-02 14:33:42 +01:00
parent 4cb53a76d6
commit 435d1f97a3
2 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
/**
* Provides classes and predicates for working with the OpenSAML libraries.
*/
import java
private import semmle.code.java.security.InsecureRandomnessQuery
/** The interface `org.opensaml.saml.saml2.core.RequestAbstractType`. */
class SamlRequestAbstractType extends Interface {
SamlRequestAbstractType() {
this.hasQualifiedName("org.opensaml.saml.saml2.core", "RequestAbstractType")
}
}
/** The method `setID` of the interface `RequestAbstractType`. */
class SamlRequestSetIdMethod extends Method {
SamlRequestSetIdMethod() {
this.getDeclaringType() instanceof SamlRequestAbstractType and
this.hasName("setID")
}
}
private class SamlRequestSetIdSink extends InsecureRandomnessSink {
SamlRequestSetIdSink() {
exists(MethodCall c | c.getMethod() instanceof SamlRequestSetIdMethod |
c.getArgument(0) = this.asExpr()
)
}
}

View File

@@ -1,6 +1,7 @@
/** Provides classes and predicates for reasoning about insecure randomness. */
import java
private import semmle.code.java.frameworks.OpenSaml
private import semmle.code.java.frameworks.Servlets
private import semmle.code.java.security.SensitiveActions
private import semmle.code.java.security.SensitiveApi
@@ -40,7 +41,7 @@ private class TypeHadoopOsSecureRandom extends SafeRandomImplementation {
}
/**
* A node representing an operation which should not use a Insecurely random value.
* A node representing an operation which should not use an insecurely random value.
*/
abstract class InsecureRandomnessSink extends DataFlow::Node { }