jwtauthccl: support JSON Pointer for identity claim lookup#165085
Open
alex-berger wants to merge 1 commit intocockroachdb:masterfrom
Open
jwtauthccl: support JSON Pointer for identity claim lookup#165085alex-berger wants to merge 1 commit intocockroachdb:masterfrom
alex-berger wants to merge 1 commit intocockroachdb:masterfrom
Conversation
Kubernetes ServiceAccount tokens store the serviceaccount UID inside a nested claim at /kubernetes.io/serviceaccount/uid rather than in a top-level field. This change allows the identity claim setting to accept a JSON Pointer (RFC 6901) in addition to a simple claim name, enabling CockroachDB to extract identity from deeply nested token structures. Signed-off-by: Alexander Berger <alex-berger@gmx.ch>
Contributor
|
Merging to
|
|
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Member
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.
Release note: Allow using values from nested JWT claims as user identity.
This change allows the identity claim setting to accept a JSON Pointer (RFC 6901) in addition to a simple claim name, enabling CockroachDB to extract identity from deeply nested token structures.
Motivation
Kubernetes ServiceAccount tokens store the serviceaccount UID inside a nested claim at /kubernetes.io/serviceaccount/uid rather than in a top-level field, see below example of a Kubernetes ServiceAccount Token (JWT). With this PR we can for example set
server.jwt_authentication.claimto/kubernetes.io/serviceaccount/uidto use a ServiceAccount's unique identifier as user identity. So this is another mini-step towards #103110 - Scalable and flexible JWT based authentication.{ "aud": [ "cockroachdb" ], "exp": 1772783261, "iat": 1772696861, "iss": "https://my-issuer/...", "jti": "d536bab9-f0fc-46ad-a09d-5d85ac85dce1", "kubernetes.io": { "namespace": "my-namespace", "node": { "name": "ip-10-176-16-155.eu-central-1.compute.internal", "uid": "6c9b214a-b6d8-43f9-b1e0-0e15b6126eda" }, "pod": { "name": "my-workload-54b8897d8-88wzg", "uid": "c33ed74a-738c-499a-96d1-0bfdb68fee91" }, "serviceaccount": { "name": "my-service-account", "uid": "136f6af7-4e5a-4891-b778-992ad1674b02" }, "warnafter": 1772700468 }, "nbf": 1772696861, "sub": "system:serviceaccount:my-namespace:my-service-account" }