Skip to content

fix: refuse to start when JWT secret is shorter than 32 bytes - #413

Open
BetterAndBetterII wants to merge 1 commit into
coaidev:mainfrom
BetterAndBetterII:fix/refuse-weak-secret
Open

BetterAndBetterII wants to merge 1 commit into
coaidev:mainfrom
BetterAndBetterII:fix/refuse-weak-secret

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Summary

Default deployments copy secret: secret from the example config. ReadConf only logged a warning and slept 10 seconds, then continued signing JWTs with that short key, so an attacker could forge an admin token offline (see #411).

This change makes ReadConf panic when the configured secret is shorter than 32 bytes, instead of starting insecurely.

Test plan

  • go test -vet=off ./utils -run TestValidateSecret -count=1
  • Confirm a deployment with a ≥32-byte secret still starts
  • Confirm a deployment with the default short secret fails fast at startup

Fixes #411

Default deployments used a predictable short secret and only warned.
Panic on weak secrets so admin JWTs cannot be forged offline.
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.

Default JWT signing key is predictable, allowing admin token forgery in default deployments

1 participant