Draft: Backport of 'Count CI job token Git requests against the user's rate limit'

What does this MR do and why?

Backports the fix for https://gitlab.com/gitlab-org/gitlab/-/work_items/634147 to 19.4. Git over HTTP requests authenticated with a CI job token bypass throttle_authenticated_git_http. GitLab Dedicated needs this on 19.4 (S1, infradev, SLO missed).

19.4 lacks the earlier job-token work that !263309 (merged) builds on, so this MR carries the changes of three master MRs, in order:

  1. !259720 (merged) "Count CI job tokens sent as basic auth or bearer against the job user".
  2. !261357 (merged) "Treat Git info/refs without .git as Git over HTTP in rate limits".
  3. !263309 (merged) "Count CI job token Git requests against the user's rate limit".

What differs from master

Source and docs:

  • ee/lib/ee/gitlab/auth/request_authenticator.rb (!259720 (merged)): already on 19.4, no change.
  • ee/lib/ee/gitlab/rate_limit/plan_rules.rb (!261357 (merged)): hunk dropped. The 19.4 unauthenticated rules have no git_http: false match to remove.

Specs (a first pass, not yet run in CI):

  • Applied: path_regex_spec, request_authenticator_spec, classified_request_spec, limiters_spec, throttle_registry_spec, rack_attack/request_spec, rack_attack_shared_context, labkit_rack_rate_limit_spec (CE), rack_attack_global_spec, and the EE request_authenticator_spec.
  • request_authenticator_spec: the JWT job token and token-size contexts are left out. 19.4 has neither Ci::JobToken::Jwt nor MAX_JOB_TOKEN_SIZE_BYTES.
  • classified_request_spec: the git_http fact assertions are replaced with git_http_non_lfs ones, because 19.4 has no spec for the git_http fact.
  • Not applied: spec/requests/labkit_rack_rate_limit_git_ci_job_token_spec.rb (file does not exist on 19.4), ee/spec/lib/ee/gitlab/rate_limit/plan_rules_spec.rb (matches the dropped source hunk), and the EE labkit_rack_rate_limit_spec job token contexts from !259720 (merged), !261357 (merged) and !263309 (merged) (the anchors differ on 19.4).

Spec edits were applied as exact-match text edits without running RSpec, so helper and factory mismatches only show up in the pipeline. Fix forward from the failing jobs.

References

MR acceptance checklist

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The MR that fixed the bug on the default branch has been deployed to GitLab.com (!263309 (merged) merged 2026-11-16).
  • The MR title is descriptive.
  • Required labels have been applied to this merge request.
  • This MR has been approved by a maintainer (only one approval is required). This touches authentication, so ask an Authentication maintainer.
  • Ensure the e2e:test-on-omnibus-ee job has succeeded.
Edited by Navjot Bansal

Merge request reports

Loading
Loading