Skip to content

Bound the OAuth identity cache and the round trips that verify a new token - #1087

Merged
jmrplens merged 3 commits into
mainfrom
issue-950-oauth-bounds
Sep 30, 2026
Merged

jmrplens merged 3 commits into
mainfrom
issue-950-oauth-bounds

Conversation

@jmrplens

@jmrplens jmrplens commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

What was wrong

In oauth mode two things on the admission path grew with whatever callers sent. The verified-identity cache was a map that lost an entry only to its TTL, a lazy read or the sweep, so it held one entry for every credential verified inside one TTL, and a valid credential is cheap to mint on GitLab. The verifier sent GET /api/v4/user and up to two introspection requests for every token the cache did not hold, with no ceiling anywhere: the pool's probe ceiling counts only the pool's own GET /user, which runs after these have been sent, and the per-address budgets bound one source at a time. An oauth deployment reachable from many addresses relayed up to three GitLab requests per invented token. The register recorded both as F-29 (ADM-005) and F-30 (ADM-002, POL-006).

What changed

The identity cache holds at most 10000 identities (tenancy.OAuthCacheCapacity, the largest pool --max-http-clients allows, held equal to PoolSizeMax by the values test). When full it drops an expired identity if there is one, and otherwise the one used least recently, to hold the one GitLab has just verified: refusing the newcomer would refuse a credential GitLab accepted. It walks for an expired identity only once the earliest expiry it holds has passed, so a flood arriving at a cache of live identities costs one comparison each. Every read counts as a use, so what pushes a live identity out is 10000 other distinct credentials used since its last request, read or verified alike; on a deployment serving close to that many, every new verification does. The identity dropped costs its credential a re-verification and, while its address is blocked, the exemption a cached identity gives it. The expiry is judged under the same lock that removes the entry. It is a take across keys, so ADM-005 records the decision (EvictAcrossKeys, decided in issue 950) and INV-005 names it beside the pool entry.

The verifier's round trips run under slots of its own, keyed on the process and not configurable: sixteen verifications at once (tenancy.OAuthVerifications), separate from the pool's sixteen probes, so neither kind of work occupies the other's slots. It bounds concurrency, not rate: at 50 ms a round trip, sixteen slots send about 320 requests a second, which is above GitLab.com's allowance for unauthenticated traffic from one address, so what it holds is the load relayed in proportion to the instance's speed rather than to how many tokens arrive at once. The cache is read before a slot is asked for, so a cached credential never waits, and read again when the wait ends and once a slot is held, so a request that waited behind another carrying the same new token finds the identity that one verified rather than repeating its round trips or being refused. The order cache, then GET /user, then introspection is kept, with the slot held through introspection. A free slot is taken before anything else is looked at, so a request whose context has already ended is not refused with a slot free.

A new token waits up to five seconds (tenancy.OAuthVerificationWait) and is then refused with oauth.ErrVerificationBusy, which the bearer guard answers from the same return and in the same words as a verification with no verdict: 503, -50300, Retry-After: 30, "GitLab could not verify this token right now. Retry shortly. The token itself has not been rejected.", not cached and charged to no budget. The new register row is ADM-014, a process ceiling that waits then refuses; its refusal is ADM-002's, as POL-006's is ADM-001's, so the failure table keeps its 21 returns.

What a refused caller can learn. One that presents a new token to an instance it knows to be healthy and is refused after the slot wait can infer that other callers are verifying. That is the one bit INV-019 accepts for a bound keyed on the process, and ADM-014 is listed there and in ADR-0023 NEG-007 beside HLD-002, HLD-004 and RTC-007; the wording adds nothing to it. The operator tells the causes apart in the log: token verification refused: every verification slot stayed busy (WARN), token verification abandoned: the request ended before it was verified (INFO), token verification failed (ERROR); the first two are throttled and name neither the caller nor the token.

What it costs. A legitimate credential presented for the first time while a flood holds every slot waits in the flood's queue and is served only if a slot frees within its five seconds, so under a sustained flood about the slots' share of new credentials is served and the rest are refused like the flood. The ceiling protects the instance's load at the cost of admitting new credentials during a flood. Credentials already cached never wait for a slot, but they share the listener with the waiting flood. This layer's pages (the HTTP server mode guide, the security concept page, the troubleshooting pages, the site in English and Spanish, and the specification) state the cost as a refusal for as long as the flood lasts; a later layer of this stack, the OAuth driver for make bench-fairness, measures it (42 and 40 of 120 new credentials served at 100 ms under 400 invented tokens a second) and corrects them, with the descriptor and memory conditions on cached credentials.

F-29 and F-30 stay in AllFindings as issue 950's and no row carries them; TestDecisions_AFindingNoRowCarries_IsAnsweredByItsIssue names them in the answered set.

Two refactors ride along, both behaviour-neutral. The identity request moved out of the verifier closure into askIdentity, which brought the closure back under the cognitive complexity bound once it took a slot. And describeScopeShortfall's tagless switch became two conditions: gremlins reads a case expression as outside every covered block, so its mutants were reported as not covered however the tests drove them.

One test fix rides along too, in a test that was already on main: TestLimit_ProcessBoundsListingAcrossCredentials decided its arm with the rate limit off by the time measured after the drive returned, which also counts the time the workers took to stop, and on windows-latest, which outlists the process's refill by a narrow margin, that failed a run 77 tools short of a crossing the drive had already made. The verdict is now kept from the one instant both figures were read at. It sits in the bottom layer so that every layer above it, each of which runs that suite on Windows, carries it.

Figures

Measured through the verifier against a stand-in GitLab on truenas, 16 workers, distinct valid tokens, retained heap after GC:

Tokens Entries before Heap before Entries after Heap after
10 10 0.30 MB 10 0.33 MB
100 100 0.45 MB 100 0.40 MB
1000 1000 0.96 MB 1000 1.10 MB
10000 10000 6.58 MB 10000 7.11 MB
100000 100000 60.5 MB 10000 7.04 MB

About 605 bytes an entry before and 700 after (the recency list adds its element).

A flood of invented but valid tokens all at once, 50 ms a request at the stand-in:

Flood Peak in flight before Requests before Peak in flight after Requests after Verified after Refused busy after
200 200 600 16 600 200 0
2000 2000 6000 16 1584 528 1472

test/e2e/http pins the ceiling on the wire: twenty tokens, each forwarded by a trusted proxy for an address of its own, against an instance that holds each identity request; sixteen reach it and no more, four are refused 503 -50300 with Retry-After: 30, no challenge and ADM-002's words, a credential already cached is served while every slot is held, and with the per-address and distinct-credential budgets both blocking on their first charge a new token from every one of those twenty addresses is served afterwards.

Validation checklist (tenant-policy-spec.md)

  • VAL-001, question: both rows answer Admit.
  • VAL-002, key: ADM-005 stays on KeyVerified (a verified credential, cheap to mint: a personal access token is a form with no administrator); ADM-014 is on KeyProcess, which no caller can mint. No new key.
  • VAL-003, class: ADM-005 class C, ADM-014 class P; neither is class D, and ADM-014's stated reason ("counting work rather than callers") is in the process's unit.
  • VAL-004, ceiling or share: ADM-014 is a ceiling; ADM-005 a lifetime with a capacity. No share on any key.
  • VAL-005, process partner: ADM-014 is itself keyed on the process, protects the process's upstream load, and is a constant because an operator who could raise it could undo it (INV-004). The cache capacity is a constant on the one process-wide cache.
  • VAL-006, at capacity: ADM-005 evicts across keys, expired first, then least recently used (decided in issue 950: refusing would refuse a credential GitLab accepted); ADM-014 waits five seconds, then refuses.
  • VAL-007, refusal: ADM-014 on the HTTP gate only (OAuth mode is HTTP-only; StdioKey none): 503, JSON-RPC -50300, Retry-After fixed at 30 s, no challenge, retry-later class, ADM-002's text. ADM-005 refuses nothing.
  • VAL-008, charges: nothing. The failure table's verification-failed return is uncharged and G7 holds it; the unit test drives all three budgets (per-address, transport source, distinct credential) at a limit of one and the httpe2e test the two a flag reaches.
  • VAL-009, values: OAuthCacheCapacity 10000, OAuthVerifications 16, OAuthVerificationWait 5 s; constants, zero not applicable, no flag or variable, so no malformed-value policy; all three frozen in TestValues_HoldTheirPins.
  • VAL-010, telemetry: no metric was added; the two slot log lines carry the cause only, no token and no address.
  • VAL-011, stdio: none; OAuth verification runs only in HTTP mode.
  • VAL-012, measurement: ADM-014 does not claim to make a population better off than without it; it bounds what the process relays to GitLab. Its cost to the one population it reaches is measured in a later layer of this stack, which adds the OAuth driver to make bench-fairness (BOUND=oauth-verification): against a stand-in answering in 100 ms and a flood of 400 invented tokens a second, once the flood has settled into its queue, 42 and 40 of 120 new credentials were served in two runs, after 5.5 s rather than 0.5 s, and the rest refused; no cached request was refused in any arm, and their medians lay between 9 and 16 ms with the ceiling and without it; and the instance received about 160 requests a second, sixteen slots over the round trip, with at most 20 at once, against about 420 a second with up to 56 at once without the ceiling. A cached credential is outside the ceiling by construction (the cache is read before a slot is asked for), which the unit and httpe2e tests pin and the measurement confirms, as long as the process has a descriptor and memory for its connection: the waiting flood holds a descriptor and about 50 KiB for each waiting request, and the measurement ran under a descriptor limit of 1048576 with no memory limit reached.

Checks

  • Tests: internal/oauth, internal/tenancy, cmd/audit_tenancy and cmd/server pass with 100.0% statement coverage each; the whole test/e2e/http suite passes, and the flood test passed three runs in a row; internal/oauth passes -race and -shuffle=on -count=3, and the guard's tests pass -race.
  • Conditions (gobco v1.3.4): internal/oauth 214/214, internal/tenancy 408/408, cmd/audit_tenancy 1002/1002. cmd/server could not be instrumented in place when this was measured (The condition gate cannot instrument cmd/server: gobco panics on build-constrained duplicates #1017); the conditions this change adds there (logUnverified's two, describeScopeShortfall's two) are each driven both ways by a named test case.
  • Mutants (gremlins, --workers 2 --timeout-coefficient 20): internal/oauth killed 109, lived 0, not covered 0, timed out 0; internal/tenancy killed 226, lived 0, timed out 0, not covered 66, all arithmetic on constant initializers in values.go, codes.go and decision.go, which carry no statement counter (the known tool-artifact class). cmd/server: bearer_guard.go mutated against the whole package's suite with every other file excluded (the package's other files are unchanged here apart from one comment in main.go): killed 65, lived 0, not covered 0, timed out 0.
  • make check-tenancy: 82 rows, 21 failures and 280 declared sites over 202 packages (21 refusal returns, 76 refusals, 12 reasons and 31 settings read); 0 findings, 56 declarations exempted.
  • golangci-lint (e2e, httpe2e tags) on the five packages, check-test-subtests, check-test-goroutines, check-test-file-names, check-doc-tool-names, format_md_tables --check and markdownlint on the changed pages: clean.
  • The figures above were measured on this layer before it was rebased onto main at 5da9699. At its place in this stack on 50ef2cf, it built and vetted, the e2e gitlab, http and stdio packages compiled, the unit suites of cmd/server, internal/tenancy, internal/oauth and cmd/audit_tenancy passed, and make check-tenancy read the same 82 rows and 280 sites. The stack now sits on b44ab96, which adds Record the upstream state of 2026-09-30 in the register #1083, Record the merge of gitlab-org/gitlab!255702 and the rebase of gitlab-org/gitlab!255704 #1084 and Update the dependencies the cooldown admits, and pin the site past five advisories published on 29 September #1085; they change the upstream register, indirect module versions and the site's package pins, none of them a file this stack writes, and every commit of the stack applied unchanged.

Decisions I took here

  • The cache capacity is a constant 10000 rather than a setting: it equals PoolSizeMax, the largest --max-http-clients, so no configurable pool serves more credentials than the cache remembers, and at about 700 bytes an entry that is about 7 MB.
  • The verification ceiling mirrors POL-006's numbers (sixteen at once, a five-second wait, then refuse) on slots of its own, constant and not configurable (INV-004).
  • The ceiling is a new row, ADM-014, rather than a change to ADM-002, whose shape is a rule; ADM-002 and POL-006 drop F-30.
  • ADM-005 records its eviction as a take across keys (EvictAcrossKeys), and the specification's INV-005 and ADR-0023 name it beside the pool entry. No new capacity kind was added.
  • The refusal reuses ADM-002's words and return, following RTC-007 reusing RTC-003's, and ADM-014 joins INV-019's one-bit exceptions and ADR-0023 NEG-007. Both are decided: the listing because no wording closes the bit (NEG-007), and the words because what they tell the caller to do, retry shortly with its token intact, is right for a request GitLab never saw.
  • A request whose own context ends while it waits for a slot gets its own error rather than ErrVerificationBusy, and is answered by the same uncharged 503 path rather than the generic verification failure, which logs at ERROR.
  • The slot is held for the whole verification, introspection included, so all three requests a verification may send are counted.
  • VAL-012 is answered by a measurement rather than a statement: a later layer of this stack builds the OAuth driver make bench-fairness lacked, and the specification cites what it measured.

Not done

  • POL-006, the pool's probe ceiling, discloses the same one bit and is not listed in INV-019 or NEG-007. It was so before this change, and listing it, with the reason its refusal gives nothing more away than ADM-014's, is a follow-up of its own rather than part of this stack.
  • No per-key single flight for concurrent verifications of the same new token, and no handoff of the guard's verified identity to the SDK's own verify, which would close the narrow window in which that second verify can miss the stored identity. Both are described in the code comments.
  • The flood e2e test does not show eviction on the wire, which would take more than 10000 verifications through the binary; it is pinned at unit level, including 10000 flood entries into a cache of 100 while a credential in steady use keeps its entry.
  • No whole-package gremlins run on cmd/server: only bearer_guard.go was mutated, against the whole suite.
  • The first commit's message still carries the wording the review corrected; the second commit says what changed, and a squash takes this description.

Closes #950.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @jmrplens, your pull request is larger than the review limit of 150,000 diff characters

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: jmrplens/gitlab-mcp-server/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 0278d93f-5ece-461d-b7ee-b39c2bef447d

📥 Commits

Reviewing files that changed from the base of the PR and between aa47012 and 7e64430.

📒 Files selected for processing (32)
  • cmd/audit_tenancy/main_test.go
  • cmd/server/bearer_guard.go
  • cmd/server/bearer_guard_test.go
  • cmd/server/main.go
  • docs/concepts/security.md
  • docs/development/adr/adr-0023-tenant-policy-is-declared-once.md
  • docs/development/tenant-policy-spec.md
  • docs/guides/http-server-mode.md
  • docs/guides/oauth-app-setup.md
  • docs/guides/troubleshooting.md
  • docs/reference/cli.md
  • docs/reference/configuration.md
  • docs/reference/env.md
  • internal/oauth/cache.go
  • internal/oauth/cache_test.go
  • internal/oauth/doc.go
  • internal/oauth/verifier.go
  • internal/oauth/verifier_test.go
  • internal/tenancy/decisions.go
  • internal/tenancy/decisions_admit.go
  • internal/tenancy/decisions_test.go
  • internal/tenancy/failures.go
  • internal/tenancy/failures_test.go
  • internal/tenancy/values.go
  • internal/tenancy/values_test.go
  • site/src/content/docs/es/operations/http-server.mdx
  • site/src/content/docs/es/operations/security.mdx
  • site/src/content/docs/es/operations/troubleshooting.mdx
  • site/src/content/docs/operations/http-server.mdx
  • site/src/content/docs/operations/security.mdx
  • site/src/content/docs/operations/troubleshooting.mdx
  • test/e2e/http/oauth_test.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added security Security-related issue transport stdio and HTTP transports, the server process, and the transport e2e modules tooling The audit and generator commands under cmd/, and the Makefile targets that run them labels Sep 30, 2026
@jmrplens
jmrplens added this pull request to stack #1095 September 30, 2026 10:18
@jmrplens jmrplens added the v3.1.0 Targeted at the 3.1.0 release label Sep 30, 2026
@jmrplens jmrplens added this to the 3.1.0 milestone Sep 30, 2026
@jmrplens jmrplens changed the title issue 950 oauth bounds Bound the OAuth identity cache and the round trips that verify a new token Sep 30, 2026
@jmrplens jmrplens closed this Sep 30, 2026
@jmrplens jmrplens reopened this Sep 30, 2026
jmrplens added a commit that referenced this pull request Sep 30, 2026
The fix for #945 (#948) removed the workflow's own `actions/cache` step
for `~/.cache/golangci-lint` and left a second cache of that directory
in place: `golangci-lint-action` keeps one itself. `install-only: true`
returns after the install and nowhere else, so the action still restores
that cache before installing (`run()` calls `restoreCache` first) and
saves it again in its post step, under
`golangci-lint.cache-<os>-<interval>-<go.mod hash>` keys. The comment in
`ci.yml` said the cache was not restored and the static analysis page
that it was not kept between runs, and neither was true.

On 2026-09-30 the lint of #1088 to #1094, opened minutes before,
reported fifty unused `//nolint:staticcheck` directives on each layer,
in files the stack does not touch. Every one of those jobs restored, by
exact key, the entry main's push run of b44ab96 had saved at 09:07 UTC:
the key names only the OS, a seven-day interval and the hash of
`go.mod`, which the stack shares with main, so the analysis of main's
tree matched a different tree exactly. With that entry deleted, #1087's
second run and a rerun of #1088's commit fell back through the restore
key to main's entry of 2026-09-25 and linted clean, and a cold `make
golangci-lint` of the stack's tip reports nothing. That is the failure
#945 describes, a restored analysis disagreeing with the tree, coming
from the cache #948 did not see, and this time from main's entry rather
than the pull request's own.

`skip-cache: true` turns off both the restore and the save. The comment
above the step now says why it is needed alongside `install-only` and
what the key leaves out, and `docs/development/static-analysis.md` says
the same. The job's header comment no longer says the action caches the
linter binary, which it downloads on every run. The Go build and module
caches setup-go keeps are unaffected.

What it costs, measured on the whole job as #945 asks: the eight pushes
to main between 29 September 11:27 and 30 September 09:02 UTC each
restored a cache and took 214 to 319 s, the `make golangci-lint` step
190 to 298 s of it; this pull request's run, the only one with the
change so far, restored nothing and took 313 s, the step 287 s. All
eight restored the entry main saved on 25 September, which the action
does not save again while its key still matches, so the analysis they
reused was of a tree days older than theirs: it was not buying time the
spread between runs can show.

Closes #945
In oauth mode two things on the admission path grew with whatever callers
sent. The verified-identity cache was a map that lost an entry only to its
TTL, a lazy read or the sweep, so it held one entry for every credential
verified inside one TTL, and a valid credential is cheap to mint on GitLab.
The verifier sent GET /api/v4/user and up to two introspection requests for
every token the cache did not hold, with no ceiling anywhere: the pool's
probe ceiling counts only the pool's own GET /user, which runs after these
have been sent, and the per-address budgets bound one source at a time. An
oauth deployment reachable from many addresses relayed up to three GitLab
requests per invented token. The register recorded both as F-29 (ADM-005)
and F-30 (ADM-002, POL-006).

What I decided in issue 950, and what this change does:

The identity cache holds at most 10000 identities (tenancy.OAuthCacheCapacity,
the largest pool --max-http-clients allows) and, when full, drops the
identity used least recently to hold the one GitLab has just verified.
Refusing the newcomer would refuse a credential GitLab accepted. Every read
counts as a use, so a credential in steady use is the last to go; the one
dropped costs its credential a re-verification and, while its address is
blocked, the exemption a cached identity gives it. The expiry is now judged
under the same lock that removes the entry, so the separate stale re-check
is gone. It is a take across keys, so ADM-005 records the decision
(EvictAcrossKeys, Decided issue 950) and INV-005 now names it beside the
pool entry.

The verifier's round trips run under slots of its own, keyed on the
process and not configurable: sixteen verifications at once
(tenancy.OAuthVerifications), separate from the pool's sixteen probes, so
neither kind of work can starve the other. The cache is read before a slot
is asked for, so a cached credential never waits, and the order cache, then
GET /user, then introspection is kept, with the slot held through
introspection. A new token waits up to five seconds
(tenancy.OAuthVerificationWait) and is then refused with
oauth.ErrVerificationBusy, which the bearer guard answers 503 -50300 with
Retry-After 30: not cached, charged to no budget, and worded "This token
could not be verified right now" without saying other callers are the
cause (INV-019). The operator reads the cause in one throttled log line
naming neither the caller nor the token. The new register row is ADM-014,
a process ceiling that waits then refuses; its refusal joins the failure
table as classify's seventh return, uncharged.

F-29 and F-30 stay in AllFindings as issue 950's and no row carries them;
TestDecisions_AFindingNoRowCarries_IsAnsweredByItsIssue names them in the
answered set.

Two refactors ride along, both behaviour-neutral. The identity request
moved out of the verifier closure into askIdentity, which brought the
closure back under the cognitive complexity bound once it took a slot. And
describeScopeShortfall's tagless switch became two conditions, because a
case expression carries no statement counter and gremlins reported its
mutants as uncovered while the tests drove all three shapes.

Measured through the verifier against a stand-in GitLab: a hundred
thousand distinct valid tokens held 100000 entries and 60.5 MB before and
hold 10000 and 7.0 MB now (about 700 bytes an entry). Two thousand tokens
at once put 2000 verification requests in flight and 6000 in all before,
and 16 in flight now; at 50 ms a round trip, 528 were verified inside the
five second wait and 1472 refused busy. test/e2e/http pins the ceiling on
the wire: twenty tokens against an instance that holds each identity
request, sixteen reach it and no more, four are refused 503 -50300 with
Retry-After 30 and no challenge, a credential already cached is served
while every slot is held, and a deployment that blocks an address after
one charged failure still serves a new token afterwards.

Closes #950.
The review of the first commit found its INV-019 argument wrong. A caller
that presents one new token to an instance it knows to be healthy, and is
refused after the five-second slot wait, learns that other callers are
verifying, whatever the refusal says: ADR-0023 NEG-007 already says no
wording closes that bit. The distinct sentence made it certain rather than
inferred. So ADM-014 now answers from the return, and in the words, that
ADM-002 gives a verification with no verdict, as RTC-007 answers in
RTC-003's; the failure table is back to 21 returns, six in classify; and
INV-019 and NEG-007 list ADM-014 beside the rows issue 951 decided. The
comments, the tests and the docs that said no caller learns anything now
say what the caller can infer and what the wording adds, which is nothing.
The operator tells the causes apart in the log: saturation at WARN, a
client that left while it waited at INFO, an unreadable answer at ERROR.

The slot wait takes a free slot before looking at anything else. With the
wait in one select, Go picked at random between a free slot and a context
that had already ended, so half of those requests were refused, and logged
as saturation, with a slot free. A wait the request's own end cut short is
now an error of its own and never ErrVerificationBusy, whose text no longer
mentions saturation either, since the SDK middleware writes a verifier
error into its own 500 on the one path the guard does not word.

The cache is read again when a wait ends, however it ended, and once a
slot is held, so a request that waited behind another carrying the same
new token finds the identity that one verified instead of repeating its
round trips or being refused a credential the cache holds.

A full identity cache drops an expired identity before the least recently
used live one: a TTL shortened to the token's own expiry makes a recently
used entry expire, and dropping a live identity to keep it cost a
credential its entry and its exemption from an address block for nothing.
It walks for one only once the earliest expiry it holds has passed, so a
flood arriving at a cache of live identities still costs one comparison
each. OAuthCacheCapacity stays its own literal and a values test holds it
equal to PoolSizeMax, which every sentence justifying it names.

The eviction guarantee was misstated. Every read of another cached
credential moves ahead of the victim too, so what pushes a live identity
out is the cache's whole capacity of other distinct credentials used since
its last request, not more than that many verified; near a full pool, every
new verification does. The cache, the guard's header, the guide and the
security page say so, and the guard's header now states the two windows in
which the SDK middleware's second verification can miss the identity the
guard stored, and what it answers then.

The docs say the ceiling bounds concurrency, not rate (about 320 requests a
second at 50 ms, above GitLab.com's allowance for unauthenticated traffic
from one address), state its cost to legitimate credentials presented for
the first time during a flood, drop the before-and-after comparisons from
the operator pages, and add the saturation and eviction causes to the
troubleshooting tables (docs and site, EN and ES) and the capacity to the
cache TTL reference rows.

The unit test now holds all three authentication budgets uncharged across
forwarded addresses behind a trusted proxy, and the httpe2e flood arrives
the same way, one forwarded address per token, with the per-address and
distinct-credential budgets both blocking on their first charge, then
serves a new token from every one of those addresses. The flood helper
reads the test context on the test goroutine. The tool-specific comment on
describeScopeShortfall's two conditions is gone.
@jmrplens
jmrplens force-pushed the issue-950-oauth-bounds branch from 68729df to 7e64430 Compare September 30, 2026 12:05
@jmrplens jmrplens closed this Sep 30, 2026
@jmrplens jmrplens reopened this Sep 30, 2026
The arm with the rate limit off lists until the tools served exceed what
the process's bucket could have granted, then asserted that again with
the time measured after the drive returned. That later instant also
counts the time the workers took to stop, and on windows-latest, which
outlists the refill by a narrow margin, it failed a run 77 tools short
of a crossing the drive had already made. The verdict is now kept from
the one instant both figures were read at.
@jmrplens jmrplens closed this Sep 30, 2026
@jmrplens jmrplens reopened this Sep 30, 2026
@sonarqubecloud

Copy link
Copy Markdown

@jmrplens
jmrplens merged commit 5e9388f into main Sep 30, 2026
6 checks passed
@jmrplens
jmrplens deleted the issue-950-oauth-bounds branch September 30, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Security-related issue tooling The audit and generator commands under cmd/, and the Makefile targets that run them transport stdio and HTTP transports, the server process, and the transport e2e modules v3.1.0 Targeted at the 3.1.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth verification is unbounded: the identity cache has no size limit and the verifier's round trips to GitLab have no concurrency ceiling

1 participant