Skip to content

Commit 07578f1

Browse files
committed
Java: Convert hardcoded-jwt-key models to data extensions.
1 parent ab12b6c commit 07578f1

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/java-all
4+
extensible: extExperimentalSummaryModel
5+
data:
6+
- ["com.auth0.jwt.interfaces", "Verification", True, "acceptExpiresAt", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
7+
- ["com.auth0.jwt.interfaces", "Verification", True, "acceptIssuedAt", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
8+
- ["com.auth0.jwt.interfaces", "Verification", True, "acceptLeeway", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
9+
- ["com.auth0.jwt.interfaces", "Verification", True, "acceptNotBefore", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
10+
- ["com.auth0.jwt.interfaces", "Verification", True, "build", "", "", "Argument[-1]", "ReturnValue", "taint", "manual", "hardcoded-jwt-key"]
11+
- ["com.auth0.jwt.interfaces", "Verification", True, "ignoreIssuedAt", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
12+
- ["com.auth0.jwt.interfaces", "Verification", True, "withAnyOfAudience", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
13+
- ["com.auth0.jwt.interfaces", "Verification", True, "withArrayClaim", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
14+
- ["com.auth0.jwt.interfaces", "Verification", True, "withAudience", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
15+
- ["com.auth0.jwt.interfaces", "Verification", True, "withClaim", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
16+
- ["com.auth0.jwt.interfaces", "Verification", True, "withClaimPresence", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
17+
- ["com.auth0.jwt.interfaces", "Verification", True, "withIssuer", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
18+
- ["com.auth0.jwt.interfaces", "Verification", True, "withJWTId", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]
19+
- ["com.auth0.jwt.interfaces", "Verification", True, "withSubject", "", "", "Argument[-1]", "ReturnValue", "value", "manual", "hardcoded-jwt-key"]

java/ql/src/experimental/Security/CWE/CWE-321/HardcodedJwtKey.qll

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import java
66
private import semmle.code.java.dataflow.ExternalFlow
77
private import semmle.code.java.dataflow.FlowSources
88

9+
private class ActivateModels extends ActiveExperimentalModels {
10+
ActivateModels() { this = "hardcoded-jwt-key" }
11+
}
12+
913
/** The class `com.auth0.jwt.JWT`. */
1014
class Jwt extends RefType {
1115
Jwt() { this.hasQualifiedName("com.auth0.jwt", "JWT") }
@@ -125,21 +129,3 @@ class HardcodedJwtKeyConfiguration extends TaintTracking::Configuration {
125129
)
126130
}
127131
}
128-
129-
/** Taint model related to verifying JWT tokens. */
130-
private class VerificationFlowStep extends SummaryModelCsv {
131-
override predicate row(string row) {
132-
row =
133-
[
134-
"com.auth0.jwt.interfaces;Verification;true;build;;;Argument[-1];ReturnValue;taint;manual",
135-
"com.auth0.jwt.interfaces;Verification;true;" +
136-
["acceptLeeway", "acceptExpiresAt", "acceptNotBefore", "acceptIssuedAt", "ignoreIssuedAt"]
137-
+ ";;;Argument[-1];ReturnValue;value;manual",
138-
"com.auth0.jwt.interfaces;Verification;true;with" +
139-
[
140-
"Issuer", "Subject", "Audience", "AnyOfAudience", "ClaimPresence", "Claim",
141-
"ArrayClaim", "JWTId"
142-
] + ";;;Argument[-1];ReturnValue;value;manual"
143-
]
144-
}
145-
}

0 commit comments

Comments
 (0)