Draft: Backport of 'Count CI job token Git requests against the user's rate limit'
What does this MR do and why?
This MR backports the fix for https://gitlab.com/gitlab-org/gitlab/-/work_items/634147 to 19.4.
Git over HTTP requests that authenticate with a CI job token (gitlab-ci-token:<token>) skip throttle_authenticated_git_http. The rate limiter never resolves the job's user on Git paths, so these requests are only counted per IP. One bot account on a GitLab Dedicated instance drove about 955 req/s this way for weeks (S1, infradev, SLO missed). This change counts the requests against the job's user.
GitLab Dedicated needs it on 19.4. 19.4 lacks two earlier changes that the fix builds on, so this MR carries the changes of three merged 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".
It replaces !272099 (closed), whose danger-review failed on commit messages with short references.
Differences from master
ee/lib/ee/gitlab/auth/request_authenticator.rb(259720): already on 19.4, so no change.ee/lib/ee/gitlab/rate_limit/plan_rules.rb(261357): hunk dropped. The 19.4 unauthenticated rules have nogit_http: falsematch to remove.- Labkit
nrematcher (261357): not used. The 19.4 labkit gem rejects it (unknown type key :nre).throttle_unauthenticated_webkeepsgit_http: falseand thegit_httpfact stays.git_path?still uses the new anchoredrepository_git_http_route_regex, soinfo/refswithout.gitis still classed as Git.
Specs
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. The specs were applied as text edits and have not been run locally.
Not applied:
spec/requests/labkit_rack_rate_limit_git_ci_job_token_spec.rb: does not exist on 19.4.- EE
plan_rules_spec: covers the dropped hunk. - EE
labkit_rack_rate_limit_specjob token contexts: anchors differ on 19.4. - JWT job token and token-size contexts in
request_authenticator_spec: 19.4 has neitherCi::JobToken::JwtnorMAX_JOB_TOKEN_SIZE_BYTES.
Status
- The earlier pipeline failed 20
limiters_specexamples on thenreerror above. That is fixed in the latest commit, and the pipeline for it is still running. - The remaining danger-review output is warnings only (short references in older commit messages, no milestone, no
EE: truetrailer). - This MR is a draft until the pipeline is green.
References
- Issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/634147
- 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. (Merged 2026-11-16: confirm the deploy before merging.)
- The MR title is descriptive (e.g. "Backport of 'title of default branch MR'"). This is important, since the title will be copied to the patch blog post.
- Required labels have been applied to this merge request
- severity label and bug subtype labels (if applicable)
- If this MR fixes a bug that affects customers, the customer label has been applied.
- 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, or if it has failed, investigate the failures. If you determine the failures are unrelated, you may proceed.
Note to the merge request author and maintainer
If you have questions about the patch release process, please:
- Refer to the patch release runbook for engineers and maintainers for guidance.
- Ask questions on the
#releasesSlack channel (internal only). - Once the backport has been merged, the commit changes will be automatically deployed to a release environment that can be used for manual validation. See after merging runbook for details.