Skip to content

Commit 435d1f9

Browse files
committed
Add sink for OpenSAML's RequestType.setID
1 parent 4cb53a7 commit 435d1f9

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Provides classes and predicates for working with the OpenSAML libraries.
3+
*/
4+
5+
import java
6+
private import semmle.code.java.security.InsecureRandomnessQuery
7+
8+
/** The interface `org.opensaml.saml.saml2.core.RequestAbstractType`. */
9+
class SamlRequestAbstractType extends Interface {
10+
SamlRequestAbstractType() {
11+
this.hasQualifiedName("org.opensaml.saml.saml2.core", "RequestAbstractType")
12+
}
13+
}
14+
15+
/** The method `setID` of the interface `RequestAbstractType`. */
16+
class SamlRequestSetIdMethod extends Method {
17+
SamlRequestSetIdMethod() {
18+
this.getDeclaringType() instanceof SamlRequestAbstractType and
19+
this.hasName("setID")
20+
}
21+
}
22+
23+
private class SamlRequestSetIdSink extends InsecureRandomnessSink {
24+
SamlRequestSetIdSink() {
25+
exists(MethodCall c | c.getMethod() instanceof SamlRequestSetIdMethod |
26+
c.getArgument(0) = this.asExpr()
27+
)
28+
}
29+
}

java/ql/lib/semmle/code/java/security/InsecureRandomnessQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** Provides classes and predicates for reasoning about insecure randomness. */
22

33
import java
4+
private import semmle.code.java.frameworks.OpenSaml
45
private import semmle.code.java.frameworks.Servlets
56
private import semmle.code.java.security.SensitiveActions
67
private import semmle.code.java.security.SensitiveApi
@@ -40,7 +41,7 @@ private class TypeHadoopOsSecureRandom extends SafeRandomImplementation {
4041
}
4142

4243
/**
43-
* A node representing an operation which should not use a Insecurely random value.
44+
* A node representing an operation which should not use an insecurely random value.
4445
*/
4546
abstract class InsecureRandomnessSink extends DataFlow::Node { }
4647

0 commit comments

Comments
 (0)