-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14681 from atorralba/atorralba/java/weak-randomne…
…ss-cve-coverage Java: Add more sinks to the Insecure Randomness query
- Loading branch information
Showing
12 changed files
with
179 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extensions: | ||
- addsTo: | ||
pack: codeql/java-all | ||
extensible: sinkModel | ||
data: | ||
- ["org.pac4j.jwt.config.encryption", "SecretEncryptionConfiguration", True, "SecretEncryptionConfiguration", "", "", "Argument[0]", "credentials-key", "manual"] | ||
- ["org.pac4j.jwt.config.encryption", "SecretEncryptionConfiguration", True, "setSecret", "", "", "Argument[0]", "credentials-key", "manual"] | ||
- ["org.pac4j.jwt.config.encryption", "SecretEncryptionConfiguration", True, "setSecretBase64", "", "", "Argument[0]", "credentials-key", "manual"] | ||
- ["org.pac4j.jwt.config.encryption", "SecretEncryptionConfiguration", True, "setSecretBytes", "", "", "Argument[0]", "credentials-key", "manual"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extensions: | ||
- addsTo: | ||
pack: codeql/java-all | ||
extensible: sinkModel | ||
data: | ||
- ["org.pac4j.jwt.config.signature", "SecretSignatureConfiguration", True, "SecretEncryptionConfiguration", "", "", "Argument[0]", "credentials-key", "manual"] | ||
- ["org.pac4j.jwt.config.signature", "SecretSignatureConfiguration", True, "setSecret", "", "", "Argument[0]", "credentials-key", "manual"] | ||
- ["org.pac4j.jwt.config.signature", "SecretSignatureConfiguration", True, "setSecretBase64", "", "", "Argument[0]", "credentials-key", "manual"] | ||
- ["org.pac4j.jwt.config.signature", "SecretSignatureConfiguration", True, "setSecretBytes", "", "", "Argument[0]", "credentials-key", "manual"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** Provides definitions related to the Netty framework. */ | ||
|
||
import java | ||
|
||
/** The interface `Cookie` in the packages `io.netty.handler.codec.http` and `io.netty.handler.codec.http.cookie`. */ | ||
class NettyCookie extends Interface { | ||
NettyCookie() { this.hasQualifiedName("io.netty.handler.codec.http" + [".cookie", ""], "Cookie") } | ||
} | ||
|
||
/** The class `DefaultCookie` in the packages `io.netty.handler.codec.http` and `io.netty.handler.codec.http.cookie`. */ | ||
class NettyDefaultCookie extends Class { | ||
NettyDefaultCookie() { | ||
this.hasQualifiedName("io.netty.handler.codec.http" + [".cookie", ""], "DefaultCookie") | ||
} | ||
} | ||
|
||
/** The method `setValue` of the interface `Cookie` or a class implementing it. */ | ||
class NettySetCookieValueMethod extends Method { | ||
NettySetCookieValueMethod() { | ||
this.getDeclaringType*() instanceof NettyCookie and | ||
this.hasName("setValue") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** Provides definitions to reason about HTTP cookies. */ | ||
|
||
import java | ||
private import semmle.code.java.frameworks.Netty | ||
private import semmle.code.java.frameworks.Servlets | ||
|
||
/** An expression setting the value of a cookie. */ | ||
abstract class SetCookieValue extends Expr { } | ||
|
||
private class ServletSetCookieValue extends SetCookieValue { | ||
ServletSetCookieValue() { | ||
exists(Call c | | ||
c.(ClassInstanceExpr).getConstructedType() instanceof TypeCookie and | ||
this = c.getArgument(1) | ||
or | ||
c.(MethodCall).getMethod() instanceof CookieSetValueMethod and | ||
this = c.getArgument(0) | ||
) | ||
} | ||
} | ||
|
||
private class NettySetCookieValue extends SetCookieValue { | ||
NettySetCookieValue() { | ||
exists(Call c | | ||
c.(ClassInstanceExpr).getConstructedType() instanceof NettyDefaultCookie and | ||
this = c.getArgument(1) | ||
or | ||
c.(MethodCall).getMethod() instanceof NettySetCookieValueMethod and | ||
this = c.getArgument(0) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/apache-commons-lang3-3.7:${testdir}/../../../stubs/esapi-2.0.1 | ||
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/apache-commons-lang3-3.7:${testdir}/../../../stubs/esapi-2.0.1:${testdir}/../../../stubs/netty-4.1.x |
6 changes: 6 additions & 0 deletions
6
java/ql/test/stubs/netty-4.1.x/io/netty/handler/codec/http/Cookie.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
java/ql/test/stubs/netty-4.1.x/io/netty/handler/codec/http/DefaultCookie.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.