Java: CWE-321 Query to detect hardcoded JWT secret keys#9036
Merged
atorralba merged 4 commits intogithub:mainfrom May 11, 2022
Merged
Java: CWE-321 Query to detect hardcoded JWT secret keys#9036atorralba merged 4 commits intogithub:mainfrom
atorralba merged 4 commits intogithub:mainfrom
Conversation
2 tasks
91a841c to
937ab41
Compare
ghost
reviewed
May 4, 2022
atorralba
reviewed
May 9, 2022
Contributor
atorralba
left a comment
There was a problem hiding this comment.
Hey @luchua-bc, thanks for your contribution. I added some inline comments.
java/ql/src/experimental/Security/CWE/CWE-321/HardcodedJwtKey.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-321/HardcodedJwtKey.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-321/HardcodedJwtKey.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-321/HardcodedJwtKey.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-321/HardcodedJwtKey.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-321/HardcodedJwtKey.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-321/HardcodedJwtKey.qll
Outdated
Show resolved
Hide resolved
Contributor
Author
|
Thank @atorralba for reviewing this PR. I've made all requested changes. Please review again when you have a chance. |
atorralba
reviewed
May 11, 2022
smowton
approved these changes
May 11, 2022
Contributor
Author
|
Thank @smowton for reviewing and approving this PR. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JWT (JSON Web Token) is an open standard (RFC 7519) that defines a way to provide information within a JSON object between two parties. JWT is widely used for sharing security information between two parties in web applications. Each JWT contains encoded JSON objects, including a set of claims. JWTs are signed using a cryptographic algorithm to ensure that the claims cannot be altered after the token is issued.
The most basic mistake is using hardcoded secrets for JWT generation/verification. This allows an attacker to forge the token if the source code (and JWT secret in it) is publicly exposed or leaked, which leads to authentication bypass or privilege escalation.
Auth0 implementation of JWT is the de facto library used in Java applications. This query detects insecure usage of hardcoded JWT secret keys in both signing and verification.
Please consider to merge the PR. Thanks.