Accept the admin's token-exchange JWT with an autoflow audience on the API listener
Update 2026-10-13
AutoFlow moves to the 8150 listener (note). Rails on .com reaches a Runway workload only over Cloudflare and an external load balancer, so the port Rails calls is public either way, and 8153 is the port that must not be. AutoFlow is served on 8150 only: Rails calls it over the load balancer (#1213 (closed)), Trigger calls it over the headless Service inside the cluster. The Change section's "on the API listener" and "under api.listen" become the 8150 listener and its configuration; the acceptance bullet's api.listen.token_exchange becomes whichever setting the rework of !4627 (merged) gives the 8150 listener. Who calls does not change.
Separately, on the endpoint: the Oct 9 "must not" stands for as long as Relay's authorization relies on Rails being the only minter. Once AutoFlow authorizes every caller itself (ADR 0011, draft), the endpoint can offer gitlab-autoflow; the same rule applies to Trigger and Catalog.
Update 2026-10-09
The browser no longer calls AutoFlow. After the note below, the UI asks Rails and Rails calls the API listener on the admin's behalf with a gitlab-autoflow token it mints in-process, as it does for Artifact Registry and IAM. The public POST /api/v4/token_exchange does not offer that audience and must not: Relay's authorization relies on Rails being the only minter, so gitlab!260389 was closed. The audience is gitlab-autoflow, not autoflow.
This supersedes "Rails adds autoflow to the token-exchange endpoint's audience list" under Change, and the first acceptance bullet, which becomes:
- With
api.listen.token_exchangeset on staging, agitlab-autoflowtoken minted by staging Rails reads a workflow on the staging deployment over its load balancer (#1213 (closed)); a token for another audience is refused.
Rails reaching that listener is #1213 (closed). Setting token_exchange on staging follows !4627 (merged) in a second MR under this issue.
Problem
The Artifact Registry settings UI reads run records from AutoFlow in the browser as the admin, with the Rails token-exchange JWT it already uses for Artifact Registry and IAM (plan, AutoFlow epic). The API listener accepts only the Rails shared-secret JWT. Trigger has settled the same question in ADR 003 and S02: an RS256 token-exchange JWT for its own audience, verified locally with IAM's pkg/userauth against the instance's published keys, no call to Rails per request.
Change
- Accept a token-exchange JWT with audience
autoflowon the API listener, verified with IAMpkg/userauth: signature against the issuer's keys, issuer, audience, expiry, schema version,gitlabclaims;gitlab.originmust beorganization. Configuration: issuer URL and keys URL underapi.listen. - The verified identity goes on the request context;
GetWorkflowand the run-record reads authorize against it (authorization rules are a follow-up). - Rails adds
autoflowto the token-exchange endpoint's audience list (one config entry; ask in gitlab-org/gitlab). - Health and reflection stay open; the Rails shared secret keeps working for
StartWorkflowfrom Rails, where still used.
Acceptance
- A token minted by
POST /api/v4/token_exchangeon staging for audienceautoflowreads a workflow on the staging deployment; a token for another audience is refused. - Readiness waits for the first key fetch, as in Trigger S02.