Skip to content

fix: accept OAuth token responses with long headers - #2381

Merged
netomi merged 1 commit into
mainfrom
fix/oauth-token-response-long-headers
Oct 23, 2026
Merged

netomi merged 1 commit into
mainfrom
fix/oauth-token-response-long-headers

Conversation

@netomi

@netomi netomi commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Problem

GitHub login fails with:

[invalid_token_response] ... I/O error on POST request for "https://github.com/login/oauth/access_token": Maximum line length limit exceeded

httpcore5 5.4.3 and later reject header lines over 8192 bytes (older versions had no limit); 5.4.3 came in with the CVE-2026-54428 fix (#1977). GitHub's successful token response now carries a Content-Security-Policy header longer than that, so the code exchange fails. The wire log shows the status line and the first headers parse fine and the failure is on that header. The same code fails on commits before the Spring Boot 4.0.9 bump and before the TanStack migration, so it is not a regression from those.

Change

  • TokenResponseClients builds the authorization-code token client on an HttpClient 5 connection manager with maxLineLength raised to 64 KiB. It uses the same converters and error handler as the client Spring Security builds by default, and honours system properties (proxy settings).
  • SecurityConfig passes it to oauth2Login via tokenEndpoint(...).

There is no configuration route: the limit can only be set on Http1Config, and Spring Security's token client builds its own RestClient, so Spring Boot spring.http.client.* settings do not reach it. Pinning httpcore5 back below 5.4.3 would reintroduce the CVE.

Testing

TokenResponseClientsTest serves a token response with a 20 KB header from a local server. With the limit at 8192 it fails with the exact error above (MessageConstraintException: Maximum line length limit exceeded); with the fix it passes. spotlessCheck and the org.eclipse.openvsx.security.* tests pass. The full ./gradlew test suite and a login against real GitHub were not run.

Notes

  • Neither the new client nor Spring's default sets connect or read timeouts.
  • Other HttpClient 5 callers (RestTemplateConfig, scanning, trusted publishing) keep the 8192 default; none of them has been seen to fail.

🤖 Generated with Claude Code

httpcore5 5.4.3 and later reject header lines over 8192 bytes. GitHub's
token response now carries a longer Content-Security-Policy header, so the
code exchange failed with "Maximum line length limit exceeded" and login
broke. Build the token client on an HttpClient with a 64 KiB line limit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
netomi added a commit that referenced this pull request Oct 23, 2026
…2382)

* fix: stop reporting a namespace ownership conflict once the namespace has an owner

Backport of #2380 to 1.2.x, without the changelog entry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix: accept OAuth token responses with long headers

httpcore5 5.4.3 and later reject header lines over 8192 bytes. GitHub's
token response now carries a longer Content-Security-Policy header, so the
code exchange failed with "Maximum line length limit exceeded" and login
broke. Build the token client on an HttpClient with a 64 KiB line limit.

Backport of #2381 to 1.2.x, without the changelog entry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
@netomi
netomi merged commit 36e67f2 into main Oct 23, 2026
5 checks passed
@netomi
netomi deleted the fix/oauth-token-response-long-headers branch October 23, 2026 21:50
netomi added a commit that referenced this pull request Oct 24, 2026
…2383)

* chore: fix changelog after 1.3.0 has been released

(cherry picked from commit c96a639)

* fix: stop reporting a namespace ownership conflict once the namespace has an owner

Backport of #2380 to 1.3.x, without the changelog entry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix: accept OAuth token responses with long headers

httpcore5 5.4.3 and later reject header lines over 8192 bytes. GitHub's
token response now carries a longer Content-Security-Policy header, so the
code exchange failed with "Maximum line length limit exceeded" and login
broke. Build the token client on an HttpClient with a 64 KiB line limit.

Backport of #2381 to 1.3.x, without the changelog entry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* docs: add changelog entries for the 1.3.x login and namespace conflict fixes

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant