-
Notifications
You must be signed in to change notification settings - Fork 1
/
jwt-hardcode2.yaml
70 lines (70 loc) · 1.89 KB
/
jwt-hardcode2.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
rules:
- id: java-jwt-hardcoded-secret
message: |
Hardcoded JWT secret or private key is used.
This is a Insufficiently Protected Credentials weakness: https://cwe.mitre.org/data/definitions/522.html
Consider using an appropriate security mechanism to protect the credentials (e.g. keeping secrets in environment variables)
metadata:
cwe: 'CWE-522: Insufficiently Protected Credentials'
owasp: 'A2: Broken Authentication'
source-rule-url: https://r2c.dev/blog/2020/hardcoded-secrets-unverified-tokens-and-other-common-jwt-mistakes/
category: security
technology:
- jwt
languages: [java]
severity: ERROR
pattern-either:
- pattern: |
com.auth0.jwt.algorithms.Algorithm.HMAC256("...");
- pattern: |
$SECRET = "...";
...
com.auth0.jwt.algorithms.Algorithm.HMAC256($SECRET);
- pattern: |
class $CLASS {
...
$TYPE $SECRET = "...";
...
$RETURNTYPE $FUNC (...) {
...
com.auth0.jwt.algorithms.Algorithm.HMAC256($SECRET);
...
}
...
}
- pattern: |
com.auth0.jwt.algorithms.Algorithm.HMAC384("...");
- pattern: |
$SECRET = "...";
...
com.auth0.jwt.algorithms.Algorithm.HMAC384($SECRET);
- pattern: |
class $CLASS {
...
$TYPE $SECRET = "...";
...
$RETURNTYPE $FUNC (...) {
...
com.auth0.jwt.algorithms.Algorithm.HMAC384($SECRET);
...
}
...
}
- pattern: |
com.auth0.jwt.algorithms.Algorithm.HMAC512("...");
- pattern: |
$SECRET = "...";
...
com.auth0.jwt.algorithms.Algorithm.HMAC512($SECRET);
- pattern: |
class $CLASS {
...
$TYPE $SECRET = "...";
...
$RETURNTYPE $FUNC (...) {
...
com.auth0.jwt.algorithms.Algorithm.HMAC512($SECRET);
...
}
...
}