Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workload ID: Support custom claims in JWT-SVIDs #52861

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

boxofrad
Copy link
Contributor

@boxofrad boxofrad commented Mar 6, 2025

This is a potential option for #52500. I started hacking on it to understand the problem better, and realized I had something that works quite well!

It allows you to add arbitrarily nested claims as an object, and use templating in any of the string fields.

Example configuration:

kind: workload_identity
version: v1
metadata:
  name: my-workload
spec:
  spiffe:
    id: /foo/bar
    jwt:
      extra_claims:
        "simple-string-claim": "{{ join.kubernetes.pod.name }}"
        "something-more-complex":
          foo: "bar"
          baz:
            - true
            - 1234
            - "{{ user.name }}"
            - blah

Resulting JWT claims:

{
  "simple-string-claim": "billing-service",
  "something-more-complex": {
    "foo": "bar"
    "baz": [true, 1234, "robot", "blah"]
  }
}

It's implemented using the protobuf Struct WKT, which is more-or-less a way to represent arbitrary JSON objects as protobuf data, so we don't need to implement any custom marshaling.

changelog: Workload ID: Support for adding custom claims to JWT-SVIDs

@boxofrad
Copy link
Contributor Author

boxofrad commented Mar 6, 2025

Temporarily blocked by gravitational/protoc-gen-terraform#52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workload ID: JWT SVID custom claim injection
1 participant