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

Screenshots or screen recordings

Not applicable, there is no UI change.

How to set up and validate locally

  1. Create a personal access token with the api scope.

  2. Request a token for the new audience and print its aud claim:

    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'
  3. Check that aud is ["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.

Edited by Romuald Atchadé

Merge request reports

Loading
Loading