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
- Related to https://gitlab.com/gitlab-org/gitlab/-/work_items/639410, which found the bot traffic reaching IAM and proposes the IAM-side fixes
- Related to !256842 (merged), which added the unflagged fallback to IAM
- Rollout issue: #639452
- Related to #631994, the
proxy_dcr_to_iamrollout, which depends on this flag being on - Related to gitlab-com/gl-infra/k8s-workloads/gitlab-com!5908 (merged), which set
IAM_SERVICE_URLin production
Screenshots or screen recordings
Not applicable: no UI change.
How to set up and validate locally
- Run IAM and point Workhorse at it with
IAM_SERVICE_URL, as in the setup steps of !256842 (merged). - With the flag off (the default), open
https://gdk.test:3443/oauth/authorize?response_type=code&redirect_uri=http://localhost:1234/cbwhile signed out. Rails redirects to/users/sign_in. - In the Rails console, run
Feature.enable(:route_unknown_oauth_clients_to_iam). - Open the same URL. IAM answers with a 401 JSON
invalid_clientbody.
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.