Conversation
Does not build on main: jwtKeyStrengthWarnings does not exist yet. Today a 1024- or 2048-bit RSA key or an ES256 key starts the server silently. Pins the contract: weak keys keep working and log one warning each with how to rotate; the secondary (verification-only) key gets its own advice; the size is read from the signing key; strong, HMAC and unparseable keys log nothing here.
Logs one warning per JWT key that still works but is below current guidance, with how to rotate. Nothing is refused and no flag changes. - RSA under 2048 bits: below NIST SP 800-131A. - RSA under 3072 bits, or ES256: below NSA's CNSA suite (RSA-3072, P-384). - The primary's size is read from its signing key; the secondary's from its verifying key, with advice to remove it once the longest token lifetime has passed (it never signs). make dev now uses a 3072-bit dev key, so local runs start without the warning.
- RSA under 1024 bits: say tokens cannot be signed or verified (Go refuses the key) instead of 'it still works'. - Judge the primary by its signing key only and the secondary by its verifying key only; no fallback, so a broken key is never reported as working. - ES256: parse the key and warn only for a real P-256 key (not for garbage, an RSA key, or a secondary with no keys). - Cite NSA's CNSA 1.0 suite. Recommend ES384/ES512 for P-256 (RS256 at any size is not an upgrade over P-256 for CNSA). - Secondary advice no longer says to generate a new key, and names when to remove it: --refresh-token-expires-in (30 days by default) and the 30-day CIBA id_token_hint window. - perf/ uses the same 3072-bit dev key as make dev.
A public key in --jwt-private-key, or a private key in --jwt-secondary-public-key, cannot be used there, but was sized with the other parser and reported as "It still works". Size the signing key only as a private key and the secondary only as a public key. Note that Go refuses RSA under 1024 bits by default (GODEBUG can lift it).
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.
What does this PR do?
Logs one start-up warning per JWT key that is below current guidance. Nothing is refused, and no flag or default changes.
ES256with a P-256 key--jwt-secondary-*, verification-only) gets its own advice: remove it once its tokens have expired (--refresh-token-expires-in, 30 days by default; CIBA also accepts an expiredid_token_hintfor up to 30 days).token.Newonly checks keys are non-empty, so such a key still fails when a token is first signed or verified, as today.make devnow uses a freshly generated 3072-bit dev key (PKCS#1, like the one it replaces), so local runs start without the warning.Tests. The first commit adds
TestJWTKeyStrengthWarningsalone. It does not build on main because the function doesn't exist; today these keys start silently. It covers:Verified:
go build ./...,go vet ./...,make test(3,501 passed, 0 failed, 25 skipped),make lint(0 issues),make smoke(94 passed; the smoke suite still boots with its RSA-2048 and ES256 keys, so existing configs start unchanged).Which issue(s) does this PR fix?
None filed; part of the signing-key strength review.
If this PR affects any API reference documentation, please share the updated endpoint references
No API change. Key-choice guidance is in the docs PR.
Review follow-up (2bac407)
An adversarial review found no blockers. The follow-up commit:
perf/to the same 3072-bit dev key asmake dev.The test now also covers:
Verification on the branch:
make test: 3506 passed, 25 skipped.make lint: 0 issues.make smoke: 94 passed.Second review (4e51472)
An independent re-review found that each key slot was still sized with both parsers. A public key in
--jwt-private-key, or a private key in--jwt-secondary-public-key, was reported as "It still works", but the server cannot use either. The signing key is now sized only as a private key and the secondary only as a public key, so "There is no fallback" above is now true. Four new cases cover this, and all four fail on the previous head. The under-1024 message now says Go refuses such keys by default, sinceGODEBUG=rsa1024min=0lifts the limit.Verification on the branch:
go build,go vet,make test(3510 passed, 0 failed) andmake lint(0 issues).