Repository navigation
Conversation
The embedded auth server's client for the upstream identity provider inherited the builder's 10s response-header timeout. A token endpoint that takes longer than 10s to send its first byte therefore fails code exchange and refresh, although the client timeout and the refresher's budget are both 30s. When a refresh is cut off after a provider that revokes the presented refresh token has processed it, the stored refresh token is no longer valid and the user has to sign in again. The shared grant client in pkg/oauthproto leaves this timeout unset for the same reason, so that slow IdP chains can answer within the client timeout. Add HttpClientBuilder.WithResponseHeaderTimeout, keeping the 10s default for every other caller, and have newHTTPClientForHost remove the limit. Discovery, JWKS and userinfo use the same client and the same IdP, so they get the same 30s budget. Signed-off-by: Aleksandr Filippov <71711753+alex-feel@users.noreply.github.com>
alex-feel
requested review from
ChrisJBurns,
JAORMX,
amirejaz,
blkt,
jhrozek,
rdimitrov and
tgrunnagle
as code owners
October 5, 2026 20:46
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6755 +/- ##
==========================================
+ Coverage 79.32% 79.36% +0.03%
==========================================
Files 802 802
Lines 81430 81433 +3
==========================================
+ Hits 64596 64629 +33
+ Misses 16829 16799 -30
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sanskarzz
self-requested a review
October 7, 2026 13:22
Sanskarzz
reviewed
Oct 7, 2026
Sanskarzz
left a comment
Collaborator
There was a problem hiding this comment.
The change addresses issue 6754 and preserves the existing timeout and network protections. The broader upstream-client scope is reasonable. No blocking code findings; local race-enabled package tests passed. The remaining Actions check concerns unchanged workflows.
This branch has not been deployed
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.
Summary
HttpClientBuilder's 10s response-header timeout. A token endpoint that takes longer than 10s to send its first byte failed the code exchange and the refresh, although the client timeout and the refresher's budget are both 30s. With a provider that revokes the presented refresh token when it processes the refresh, a refresh cut off this way leaves a revoked token stored, and the user has to sign in again. The shared grant client inpkg/oauthprotoleaves this timeout unset for the same reason (grants.go, pinned bygrants_test.go).HttpClientBuilder.WithResponseHeaderTimeout. Zero removes the limit; the 10s default stays for every other caller.newHTTPClientForHostsets it to zero, so the 30s client timeout bounds each call of the upstream provider client.Fixes #6754
Type of change
Test plan
task test)task test-e2e)task lint-fix)The new and existing tests of
pkg/networkingandpkg/authserver/upstreampass; the new assertion inTestNewHTTPClientForHostfails on main (Should be zero, but was 10s). The fulltask testrun is left to CI. The reproduction from #6754, run against this branch, printsrefresh ok after 12.0s: refresh_token=rt-2; on main it fails after 10.0s. With a token endpoint that answers after 35s, code exchange and refresh still stop at the 30s client timeout (Client.Timeout exceeded while awaiting headers).Does this introduce a user-facing change?
Yes. An upstream identity provider that takes more than 10s to answer a token, discovery, JWKS or userinfo request now gets the full 30s client timeout instead of failing with
timeout awaiting response headers.Special notes for reviewers
The change removes the limit for the whole upstream provider client, so discovery, JWKS and userinfo get the same 30s budget as the token calls. They go to the same IdP, and a slow first byte there blocks sign-in the same way; the JWKS fetch in #6194 was cut off by this limit.
pkg/oauthprotokeeps short header timeouts on its DCR, discovery and CIMD clients. If you would rather limit the change to token requests, I can give the token endpoint its own client.