Loading
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:
- !259720 (merged) "Count CI job tokens sent as basic auth or bearer against the job user".
- !261357 (merged) "Treat Git info/refs without .git as Git over HTTP in rate limits".
- !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 nogit_http: falsematch 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 EErequest_authenticator_spec. request_authenticator_spec: the JWT job token and token-size contexts are left out. 19.4 has neitherCi::JobToken::JwtnorMAX_JOB_TOKEN_SIZE_BYTES.classified_request_spec: thegit_httpfact assertions are replaced withgit_http_non_lfsones, because 19.4 has no spec for thegit_httpfact.- 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 EElabkit_rack_rate_limit_specjob 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
- Issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/634147
- Master MRs: !259720 (merged), !261357 (merged), !263309 (merged)
- Handoff: https://gitlab.com/gitlab-com/gl-infra/production-engineering/-/work_items/30372
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-eejob has succeeded.
Edited by Navjot Bansal