Repository navigation
fix(auth): refuse placeholder JWT signing secrets at startup - #587
Open
walsykerem wants to merge 2 commits into
Open
walsykerem wants to merge 2 commits into
walsykerem wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 486ce0f. Configure here.
Verification-only keys were only rejected when empty, so a placeholder copied from the example configs stayed trusted for every token and let anyone who read the repository mint tokens the API accepts. Both config validation and the verifier now reject empty or published values for verification entries, reusing the existing helper.
This branch has not been deployed
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.

Published JWT secret accepted at startup
Hypeman's macOS example config ships
jwt_secret: dev-secret-change-me, and the matching environment example repeats the same value. The loader only checked that the secret was not empty, so a server started from the documented copy path signed every token with a key printed in the repository. Anyone could mint an admin token.The fix adds a short list of published placeholders to the JWT verifier, exposed as
IsWeakSecret, and checks it when configuration loads. A placeholder now stops startup with a clear message asking for a unique random value. An empty secret stays handled by the existing server check, so nothing else moves.Strong secrets keep working: a 64 character hex value from
openssl rand -hex 32, the exact formscripts/install.shgenerates, is accepted, andJWT_SECRETstill overrides the file.Two files changed,
lib/jwtauth/verifier.goandcmd/api/config/config.go. The reproduction test fails on the original tree and passes after the change. Package tests,go vet, the build, and a container run of the test are green.Note
Medium Risk
Tightens authentication configuration validation and will refuse to start (or build a verifier) when secrets match documented placeholders; legitimate strong secrets are unchanged.
Overview
Blocks startup when JWT signing or verification keys are empty or match a fixed list of published example placeholders (e.g.
dev-secret-change-me,secret,change-me), exposed asjwtauth.IsWeakSecret.Loadnow rejects a non-empty weakjwt_secretwith guidance to generate a real secret.Config.ValidateandNewVerifieruse the same check forjwt_verification_secrets, since fallback keys are tried on every token and would be forgeable if they matched repo examples. Tests cover placeholder rejection, strong secrets, and error messages that avoid echoing secret values.Reviewed by Cursor Bugbot for commit d451d9d. Bugbot is set up for automated code reviews on this repo. Configure here.