Do not follow redirects when renewing an OAuth access token - #425
Merged
davidmckayv merged 1 commit intoSep 8, 2026
Merged
Conversation
exchangeRefreshTokenOverHttp carries the deployment client secret and a user refresh token to a catalogue-pinned tokenUrl. fetch follows redirects by default, so a compromised or misbehaving vendor 302 would hand both secrets to whatever address the answer named. Send the renewal with redirect manual, like the authorization-code redemption and the dynamic-client registration already do, so a 3xx lands in the refusal branch instead of being followed.
Ayush7614
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 7, 2026 15:41
davidmckayv
approved these changes
Sep 8, 2026
davidmckayv
left a comment
Contributor
There was a problem hiding this comment.
Deep-reviewed against live code (correctness, governance, no vendor/secret/scale issues). Composed build+tests green. CHANGELOG/format rebase on CI-validated substance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
exchangeRefreshTokenOverHttpinserver/src/plugins/store.tscarries the deployment client secret and a user's refresh token to a catalogue-pinnedtokenUrl.fetchfollows redirects by default, so a compromised or misbehaving vendor answering 302 would hand both secrets to whatever address the answer named.This sends the renewal with
redirect: manual, exactly like the authorization-code redemption and the dynamic-client registration inserver/src/plugins/oauth.tsalready do, so a 3xx lands in the existing refusal branch instead of being followed.Why it matters
Security boundary, not style: the third and last secret-carrying token path that followed redirects. A redirecting token endpoint is now a refusal (
The vendor would not renew this access (302)) and only ever contacts the pinned endpoint.Verification
server/tests/oauth-refresh-redirect.test.ts: a 302 becomes a refusal with exactly one fetch to the pinned URL carryingredirect: manual; a 200 renewal still succeeds withredirect: manual.bun test server/tests/oauth-refresh-redirect.test.ts— 2 pass.bun test server/tests/plugin-oauth.test.ts— 42 pass (sibling redirect guards unchanged).bun run --filter server typecheck— clean. Biome format + lint — clean.