Skip to content

Reject weak JWT signing secrets at startup#2

Merged
raphaelbauer merged 1 commit into
mainfrom
fix/weak-jwt-secret
Jun 15, 2026
Merged

Reject weak JWT signing secrets at startup#2
raphaelbauer merged 1 commit into
mainfrom
fix/weak-jwt-secret

Conversation

@raphaelbauer

Copy link
Copy Markdown
Owner

HS256 requires a 256-bit key, but NinjaSessionConverter used the Base64-decoded secret directly with no length check, so a weak or empty secret produced working-but-forgeable session tokens. Enforce a minimum of 32 bytes and fail fast at startup otherwise.

Replace the 'changeme' demo default (which decoded to ~6 bytes) with a real 256-bit secret in the demo configs to keep them starting.

HS256 requires a 256-bit key, but NinjaSessionConverter used the
Base64-decoded secret directly with no length check, so a weak or empty
secret produced working-but-forgeable session tokens. Enforce a minimum
of 32 bytes and fail fast at startup otherwise.

Replace the 'changeme' demo default (which decoded to ~6 bytes) with a
real 256-bit secret in the demo configs to keep them starting.
@raphaelbauer raphaelbauer merged commit 1cd9861 into main Jun 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant