Conversation
…ed once
Does not build on main: WeakJWSKey, the weak-signature counter and the
warn-once state do not exist yet. Today an ES256 or RSA-2048 signature from
a trusted issuer or SSO connection is accepted silently.
Pins the contract: such signatures keep verifying; each is counted under
authorizer_weak_signature_verifications_total{surface,alg}; each issuer or
connection key is logged once; 3072-bit RSA and P-384 are neither.
Client assertions (trusted issuers) and upstream ID tokens (SSO
connections) signed with RSA under 3072 bits or P-256 are still accepted;
nothing is refused. Now each such verification:
- counts authorizer_weak_signature_verifications_total{surface,alg}
(surface=client_assertion|sso_id_token; alg is allow-listed, so both
labels are bounded), and
- logs one warning per issuer or connection key per process, naming the
issuer, kid, alg and key size, asking the issuer to rotate.
The check uses the key the signature was actually verified with. Only
verified keys enter the warn-once sets, so they are bounded by the issuers'
real keys. verifyIDTokenAgainstJWKS keeps its signature; verifyIDTokenKey
also returns the verifying key.
…review) - Client assertions: the weak-key counter and warning ran right after the signature check, so expired, mis-addressed and replayed assertions were counted (and warned about as 'still accepted'). They are now recorded just before the assertion is accepted, matching the SSO side. - Warn-once sets are keyed by trust row / connection plus key class (e.g. RSA-2048), not by the token's kid. An org admin controls its OIDC connection's identity provider; keying by kid let it add a set entry and a log line (with a kid of up to ~1 MiB) on every login. kid is now truncated to 64 bytes in logs. - WeakJWSKey returns '' for nil or malformed keys instead of panicking. - New end-to-end test through verifySSOIDToken (JWKS over HTTP via the e2e seam): accepted weak ID tokens counted, a rejected one not.
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?
Signatures Authorizer verifies from outside parties are still accepted when the key is RSA under 3072 bits or P-256, but they are now visible. That covers client assertions from trusted issuers and upstream ID tokens from SSO connections. Nothing is refused.
authorizer_weak_signature_verifications_total{surface, alg}, incremented for every such token that is accepted. Rejected ones (expired, replayed, wrong audience) are not counted.surfaceisclient_assertionorsso_id_token.algcomes from the verifier's allow-list, so both labels are bounded.RSA-2048) per process. It names the issuer,kid(truncated to 64 bytes),algand key size, and asks the issuer to rotate.kid, so they are bounded by the number of configured issuers whatever an upstream puts in its headers.crypto.WeakJWSKey(key), a pure function. It looks at the key the signature was actually verified with, captured by wrapping the keyfunc, not at the JWKS or the header.verifyIDTokenAgainstJWKSkeeps its signature and its 10 test callers. The newverifyIDTokenKeyalso returns the verifying key.Tests. The first commit adds the tests alone. They don't build on main because the classifier, counter and warn-once state don't exist; today these signatures are accepted silently.
TestWeakIssuerKeysAcceptedCountedAndLoggedOnce:TestSSOIDTokenReportsVerifyingKeyandTestSSOWeakKeyCountedAndLoggedOnce: the same contract on the SSO side.TestWeakJWSKey: classifier cases.Existing SSO and client-assertion tests, which sign with RSA-2048, pass unchanged.
Verified:
go build ./...,go vet ./...,make test(3,494 passed, 0 failed, 25 skipped),make lint(0 issues).TestVerifySSOIDTokenCountsAcceptedWeakKeysexercises thenoteWeakSSOKeycall inverifySSOIDTokenend to end, against an httptest JWKS.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. The new metric is documented in the docs PR (Metrics & Monitoring).
Review follow-up (8a42d30)
An adversarial review found no blockers. Accept and reject decisions match
mainexactly. It found three things worth fixing, all fixed here:kidlet it add an entry and a log line on every login: +37 MiB over 200 logins with 64 KiBkids. The set is now keyed by connection and key class, andkidis truncated in logs.WeakJWSKeypanicked on nil or malformed keys; it now returns"".New tests:
TestVerifySSOIDTokenCountsAcceptedWeakKeys: end to end throughverifySSOIDToken, with the JWKS served over HTTP via the e2e seam. Two accepted, one rejected (bad nonce): the count is +2 and there is one log line.kids: one set entry, and the log stays under 2 KB.TruncateForLog.Scope, now stated in the docs:
Verification on the branch:
make test: 3496 passed, 25 skipped.make lint: 0 issues.-race -count=2.Second review
An independent re-review found nothing that changes whether a token is accepted. No code change; two notes: