Gate routing unknown OAuth clients to IAM behind a flag

What does this MR do and why?

Workhorse sends an OAuth authorize request with a missing or unknown client_id to Rails again, unless the new route_unknown_oauth_clients_to_iam flag is on. The flag is gitlab_com_derisk, default off, and checked with the :instance actor because it will only be toggled instance-wide.

Known OAuth applications are unaffected. They still route on the per-application proxy_oauth_requests_to_iam_service flag.

!256842 (merged) made oauth_routing send every missing or unknown client_id to the IAM Auth Service, with no flag. Once IAM_SERVICE_URL was set in production on 2026-10-22, about 48k bot requests a day started reaching IAM, which is not meant to serve production traffic yet. This flag restores the earlier behaviour until IAM launches. Unsetting IAM_SERVICE_URL was the only other off switch, and that would undo the Protocells configuration.

Turn this flag on before or together with proxy_dcr_to_iam. Clients registered on IAM exist only there, so with this flag off their authorize requests reach Rails and fail with invalid_client.

References

Screenshots or screen recordings

Not applicable: no UI change.

How to set up and validate locally

  1. Run IAM and point Workhorse at it with IAM_SERVICE_URL, as in the setup steps of !256842 (merged).
  2. With the flag off (the default), open https://gdk.test:3443/oauth/authorize?response_type=code&redirect_uri=http://localhost:1234/cb while signed out. Rails redirects to /users/sign_in.
  3. In the Rails console, run Feature.enable(:route_unknown_oauth_clients_to_iam).
  4. Open the same URL. IAM answers with a 401 JSON invalid_client body.

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 Andrew Evans

Merge request reports

Loading
Loading