ccl/jwtauthccl: allow inferring of key algorithm#89989
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Oct 19, 2022
Merged
ccl/jwtauthccl: allow inferring of key algorithm#89989craig[bot] merged 1 commit intocockroachdb:masterfrom
craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Member
2709ab5 to
3f8a45d
Compare
knz
approved these changes
Oct 17, 2022
Contributor
knz
left a comment
There was a problem hiding this comment.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @kpatron-cockroachlabs and @rafiss)
-- commits line 6 at r1:
nit: -from
-- commits line 15 at r1:
nit: "Addresses CC-8211." (period)
pkg/ccl/jwtauthccl/authentication_jwt_test.go line 186 at r1 (raw file):
_, key, _ := createJWKS(t) token := createJWT(t, username1, audience1, issuer1, timeutil.Now().Add(time.Hour), key, jwa.RS256) // Clear the algorithm
nit: period missing at end of sentence.
pkg/ccl/jwtauthccl/authentication_jwt_test.go line 199 at r1 (raw file):
JWTAuthJWKS.Override(ctx, &s.ClusterSettings().SV, jwkPublicKey) // Now the validate call gets past the token validity check and fails on the next check (subject matching user)
ditto
Previously, if a user failed to provide the algorithm claim within the JWKS, CRDB would not accept any JWTs that used that key. This change makes CRDB accept algorithms specified by a JWT so long as they are compatible with the key type (for example RSA and RSA256). This case only applies when the JWKS does not explicitly specify an algorithm. This came up because Azure's listed JWKS does not specify algorithms. Fixes CC-8211. Release note (bug fix): During JWT based auth, infer the algorithm type if it is not specified by the JWKS. This enbables support for a wider range of JWKSes. Release justification: low danger, usability fix.
3f8a45d to
6a3cdc3
Compare
Contributor
Author
kpatron-cockroachlabs
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @knz and @rafiss)
pkg/ccl/jwtauthccl/authentication_jwt_test.go line 199 at r1 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
ditto
Done.
pawalt
approved these changes
Oct 19, 2022
Contributor
Author
|
bors r+ |
1 similar comment
Contributor
Author
|
bors r+ |
Contributor
|
Build succeeded: |
This was referenced Oct 19, 2022
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.
Previously, if a user failed to provide the algorithm claim
within the JWKS, CRDB would not accept any JWTs that used
that key. This change makes CRDB accept algorithms from
specified by a JWT so long as they are compatible with the
key type (for example RSA and RSA256). This case only
applies when the JWKS does not explicitly specify an
algorithm.
This came up because Azure's listed JWKS does not specify
algorithms.
Fixes CC-8211.
Release note (bug fix): During JWT based auth, infer the
algorithm type if it is not specified by the JWKS. This
enbables support for a wider range of JWKSes.
Release justification: low danger, usability fix.