Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7397f42804
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
7397f42 to
c62d6a9
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c62d6a95ee
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The handler forwards the client's Authorization header upstream when the transform doesn't set one. A 429 for such a request started a cooldown for the whole hostname, so other callers, anonymous requests and the same caller retrying with another token were rejected locally, even though the upstream limits each credential on its own. WithForwardedCredentialCooldown now records the forwarded value. While a request still sends that value, the transport scopes its cooldown to an HMAC of it, keyed with a per-process secret, so the scope name it logs never reveals the credential. A transport that replaces the header, as OCI's registry authentication does, falls back to the host's cooldown. The handler records the value only when it copied the client's header itself, so a credential the transform attaches keeps the scope the transform chose even if the client sent the same value. Artifactory and Hermit's GitHub redirect no longer copy Authorization in their transforms and rely on the handler's forwarding instead, so a credential sent on Hermit's redirect and direct routes shares one cooldown. The git strategy's pass-through proxy records the client's credential the same way. WithCooldownScope takes precedence. Signed-off-by: Ravi Agarwal <ravi@perplexity.ai> Co-authored-by: Perplexity <noreply@perplexity.ai>
c62d6a9 to
3388f80
Compare
Signed-off-by: Ravi Agarwal <ravi@perplexity.ai> Co-authored-by: Perplexity <noreply@perplexity.ai>
|
@codex review Created with Perplexity |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
The handler forwards the client's
Authorizationheader upstream when the transform doesn't set one, as withproxyandartifactory. When the upstream answers such a request with 429,BackoffTransportstarts a cooldown for the whole hostname. Other callers, anonymous requests, and the same caller retrying with a different token then get a local 429 until it ends, even though the upstream limits each credential on its own. #445 scoped the GitHub credentials cachew attaches itself; this PR covers the ones it forwards.Change
httputil.WithForwardedCredentialCooldown(ctx, authorization)records the caller's credential on the request. While the request still sends that exact value, the transport scopes the cooldown to an HMAC-SHA256 of it, keyed with a random per-process secret. The cooldown log names the scopeforwarded-credential:<16 hex>, so it never contains the credential and can't be used to test guesses of it.Authorizationunset. A credential the transform attaches, such as one fromhostheaders, keeps the scope the transform chose, which is the hostname unless it usesWithCooldownScope, even if the client sent the same value.WithCooldownScopetakes precedence over the recorded credential.artifactoryand Hermit's GitHub redirect (with an externalgithub-base-url) no longer copyAuthorizationin their transforms. They rely on the handler's forwarding, which already sends the header whenever the transform doesn't set it. Artifactory still copiesX-JFrog-Art-ApiandCookie, and Hermit still copies the other client headers. A credential sent on Hermit's redirect and direct routes now shares one cooldown, where before each route bypassed the other's.gitstrategy's pass-through proxy, used for pushes, LFS API calls and other requests it doesn't serve from a mirror, records the client'sAuthorizationthe same way. When it attaches a GitHub App token forgithub.com, that token replaces the header and the installation's scope applies.Authorizationshare the hostname's cooldown.#445 scopes attached credentials where they are attached, rather than by hashing
Authorization, because a hash splits one rate limit into many cooldowns when tokens rotate. For a forwarded credential cachew has no better identity than the header, and falling back to the hostname lets one caller's 429 block every other caller. The cost is that a caller rotating tokens against one limit isn't held back locally; it still gets the upstream's own 429s.Behaviour changes
Authorizationis considered. Other credential headers, such as Artifactory'sX-JFrog-Art-Api, still share the hostname's cooldown.Testing
TestBackoffForwardedCredentialCooldowncovers the transport. The limited credential cools down alone, and other credentials and anonymous requests pass. Unmarked requests share the host's cooldown, as does a replaced credential.WithCooldownScopewins, and the log names the scope without the credential.TestBackoffScopesForwardedCredentialsdrives the handler against a real upstream. A forwarded credential's 429 doesn't pause another credential or anonymous requests, and a credential the transform attaches cools down the whole host even when the client sent the same value.TestProxyScopesForwardedCredentialschecks that one credential's 429 through thegitproxy doesn't pause another credential or anonymous requests.TestOCIBackoffnow triggers the registry's 429 with client credentials and still expects the cooldown to cover requests without them.TestHermitBackoffnow also runs with a client credential and expects a 429 on the redirect route to cool down the direct route for that credential.TestArtifactoryAuthHeadersstill checks thatAuthorizationreaches Artifactory.Created with Perplexity