Skip to content

Add Organization id into OIDC JWT token claims #204

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

Open
pedroforesti opened this issue Apr 7, 2025 · 3 comments · May be fixed by #221
Open

Add Organization id into OIDC JWT token claims #204

pedroforesti opened this issue Apr 7, 2025 · 3 comments · May be fixed by #221
Assignees
Labels
enhancement New feature or request

Comments

@pedroforesti
Copy link
Contributor

Is your improvement proposal related to a problem? Please describe.

Currently, in the OIDC token generation it would be good to include an immutable claim field for the organization that is not its name.

Describe the solution you'd like

Include the organization Id in the default JWT Claims and maybe in the SUB claim composition.
As described here: https://docs.semaphoreci.com/reference/openid

Describe alternatives you've considered

No response

Additional context

The JWT implementation can be found here: https://github.com/semaphoreio/semaphore/blob/main/secrethub/lib/secrethub/open_id_connect/jwt.ex

@pedroforesti pedroforesti added the enhancement New feature or request label Apr 7, 2025
@pedroforesti pedroforesti changed the title Add Organization id into OIDC JWT token Add Organization id into OIDC JWT token claims Apr 7, 2025
@colemickens colemickens linked a pull request Apr 14, 2025 that will close this issue
2 tasks
@colemickens
Copy link

I think that prj and org are also appropriate to add. As far as I can tell, proj is not included anywhere in current claims. And repo != project. Similarly it's nice to be able to get org without needing to deconstruct the sub claim.

@dexyk
Copy link
Contributor

dexyk commented Apr 30, 2025

Hi @colemickens, Thanks again for pushing this forward.

A couple of thoughts on the proposed org and proj claims:

  • proj - We already include prj_id, which uniquely identifies the project (ref). Adding a separate proj (project name) claim would duplicate this information.

  • org - The organization context is already present in the iss and aud claims , e.g., https://<organization-name>.semaphoreci.com (ref). While this isn't a clean organization name, it still conveys the organization identity. A standalone org claim would duplicate that context.

In general, we aim to keep tokens lean and avoid adding claims that duplicate existing data.

Do you have a specific use case in mind where these additional claims would provide value that the current ones cannot?

@colemickens
Copy link

@dexyk Thanks for the response!

For the org name, that's fine, but not 100% ideal.

For the prj, I have some counter-thoughts:

  1. You provide the repo name in the sub claim (albeit without a corresponding ID)
  2. But, repo is non-unique and doesn't really identify the identity of the project/workflow.
  3. We need to be able to derive/infer a project name on our side.

Without this, we will have to do something like use repo which would be quite incorrect in some scenarios I can easily imagine, and will cause further headaches for customers if they ever have multiple semaphore projects with the same repo in them.

Please note, GitHub and GitLab both offer both forms of these claims - their human readable (and mutable) names, as well as their immutable ids.

Additionally, I'm looking forward to BuildKite and they have quite an interesting offer in contrast, providing all of the claims I could hope for, then some, then with customization ability on top: https://buildkite.com/docs/agent/v3/cli-oidc

@AleksandarCole AleksandarCole moved this to Backlog in Roadmap May 9, 2025
@AleksandarCole AleksandarCole self-assigned this May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

4 participants