Allow the gitlab-autoflow audience in token exchange
What does this MR do and why?
POST /api/v4/token_exchange can now mint tokens for a second audience, gitlab-autoflow. Before this change it only accepted gitlab-artifact-registry and rejected any other audience with a 400. AutoFlow's API on GitLab Relay will accept this token, so the Artifact Registry settings UI can read AutoFlow workflows from the browser as the admin. Every token this endpoint mints still also carries the gitlab-iam-data-access audience, as it does today.
Question for reviewers: What issuer (iss) does staging.gitlab.com put in these tokens? Relay needs it to configure token_exchange on staging.
References
- Related to gitlab-org/cluster-integration/gitlab-agent#1200 (closed)
- Relay-side verification: gitlab-org/auth/iam!793 (merged)
Screenshots or screen recordings
Not applicable, there is no UI change.
How to set up and validate locally
-
Create a personal access token with the
apiscope. -
Request a token for the new audience and print its
audclaim:curl --silent --request POST --header "PRIVATE-TOKEN: <your_token>" \ --data "audience=gitlab-autoflow" "http://gdk.test:3000/api/v4/token_exchange" \ | jq -r '.token | split(".")[1] | @base64d | fromjson | .aud' -
Check that
audis["gitlab-autoflow", "gitlab-iam-data-access"].
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.