bug: remove hardcoded JWT signing secret, load from JWT_SECRET env - #1063
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Comment on lines
+39
to
+45
| if (secret == null || secret.trim().isEmpty()) { | ||
| log.warn( | ||
| "No JWT signing secret configured (set the JWT_SECRET environment variable to at least " | ||
| + "{} bytes). Generating a random key: tokens will be invalidated on every restart " | ||
| + "and will not be accepted by other instances.", | ||
| MINIMUM_SECRET_BYTES); | ||
| return Keys.secretKeyFor(algorithm); |
Author
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.
Remove hardcoded JWT signing secret (load from JWT_SECRET env var)
Summary
Fixes code scan finding sfind-497b4c6e962a40a1ae0ac1597d478ae8: the HS512 JWT signing secret was committed in
application.properties, letting anyone with repo read access forge valid tokens for any user id (accepted byJwtTokenFilter).application.properties:jwt.secret=${JWT_SECRET:}— no committed default.DefaultJwtService: if the secret is empty, generates a random per-process key (with a warning); otherwise enforces ≥64 bytes for HS512.signWithpins HS512 explicitly.JWT_SECRET(e.g.openssl rand -base64 64).Rotation required: the leaked value in git history must be considered compromised; deployments must set a fresh
JWT_SECRET(owner: repo maintainers). No history rewrite performed.Note: this duplicates the fix already open in PR #1010/#1062 (same root cause, separate finding); whichever merges first, the others can be closed.
Verification
Local Gradle build is not possible in this environment (Maven Central/plugin portal blocked); repo has no CI. The change mirrors the previously reviewed patch applied cleanly on latest master.
This PR was written by Devin.
Devin-Org: engineering