[FF] token_exchange_autoflow_audience -- Lets selected users mint gitlab-autoflow tokens through the token exchange API

Summary

Roll out the feature currently behind the token_exchange_autoflow_audience feature flag, introduced in !267945 (merged).

With the flag enabled for a user, POST /api/v4/token_exchange mints tokens for the gitlab-autoflow audience, so that user can run AutoFlow workflows on Runway staging through Relay's public API. This is a short-term solution until STS and Trigger provide proper authentication and authorization for AutoFlow.

The flag limits who can mint. It does NOT limit what a token can do: AutoFlow lets anyone holding one start arbitrary workflow definitions in the namespace of the token's organization, and those workflows run with AutoFlow's own permissions, not the user's. So we only enable it on staging.gitlab.com, for a few named users, and never for a percentage or globally.

  • DRI: @timofurrer
  • Team Slack channel: #g_workflow-engine

Note

Process and guidance live in the docs - this issue is just the commands and a place to track the rollout. "Rolling out" means incrementally enabling the flag on GitLab.com to validate stability - it is not the same as releasing the feature, which happens when the flag is removed. Feature flag controls · Feature flag lifecycle

What could go wrong?

A user with the flag gets a token that can start arbitrary workflow definitions in the namespace of the user's organization on the Relay it's presented to, and those workflows run with AutoFlow's own permissions, not the user's. That's why the flag stays per user on staging. CI job tokens can't mint this audience, even for a flagged user. Users without the flag see no change: a gitlab-autoflow request fails with the same 400 as an unknown audience, and the gitlab-artifact-registry audience is untouched.

Events

These links point at production logs. The rollout is staging only, so they should stay empty.

Rollout

Run all /chatops in #production and cross-post the results to #g_workflow-engine.

Non-production - per user on staging only:

/chatops gitlab run feature set --user=<username> token_exchange_autoflow_audience true --staging
  • @timofurrer
  • other users, added here as they're enabled

Production - not planned. The flag is NOT enabled on GitLab.com production, neither for actors nor by percentage, until AutoFlow authorizes its callers.

Before global rollout

Not applicable: there is no global rollout. Once STS and Trigger provide authentication and authorization for AutoFlow, we remove the flag together with the gitlab-autoflow audience in token exchange, see Cleanup.

Cleanup

Remove the flag once STS/Trigger take over minting for AutoFlow, together with the gitlab-autoflow audience in ee/lib/api/authn/token_exchange.rb. It's a gitlab_com_derisk flag, so it has to go within 2 months of the MR merging. If STS/Trigger aren't ready by then, we revisit the flag type. Track it here, or open a follow-up Feature Flag Cleanup issue. Remove the flag and its YAML definition from the codebase, then:

/chatops gitlab run release check <merge-request-url> <milestone>
/chatops gitlab run feature delete token_exchange_autoflow_audience --dev --pre --staging --staging-ref --production

Rollback

/chatops gitlab run feature set token_exchange_autoflow_audience false --staging                                   # staging
/chatops gitlab run feature delete token_exchange_autoflow_audience --dev --pre --staging --staging-ref --production  # remove entirely
Edited by Timo Furrer