Skip to content

fix: pin HTTP/1.1 defaults; enforce RFC 9530 body digest in resource role - #3

Merged
marcofanti merged 1 commit into
mainfrom
http11-and-content-digest
Aug 2, 2026
Merged

fix: pin HTTP/1.1 defaults; enforce RFC 9530 body digest in resource role#3
marcofanti merged 1 commit into
mainfrom
http11-and-content-digest

Conversation

@marcofanti

Copy link
Copy Markdown
Owner

Two fixes driven by downstream use against the AAuth Person Server (uvicorn/h11):

HTTP/1.1 pinned in library-constructed clients. The JDK HttpClient's default h2c upgrade makes h11-based servers reject requests (400 "Invalid HTTP request received") or silently drop POST bodies. Both library defaults — DefaultHttpClient (JWKS/metadata fetching via CachingJwksFetcher and Metadata.fetch*) and TokenExchange.Exchange — now set HttpClient.Version.HTTP_1_1. Caller-injected clients are untouched. Javadoc on each affected entry point states the default and why; Http11DefaultTest asserts the versions.

RFC 9530 body-digest enforcement in the resource role. The signature base covers the Content-Digest header, not the body, so a tampered body with an intact header passed verification (this library and the Python reference behave identically at the signing layer). RequestVerifier.verifyRequest now recomputes the digest whenever both header and body are present and fails with content-digest mismatch on divergence. The low-level SignatureVerifier is unchanged for wire-format parity with Python; the intentional divergence is documented in docs/PROGRESS.md and the README. Tests cover tampered-body rejection, matching-body pass, and the unchanged body-less / no-header paths.

196 tests green, coverage gates met.

🤖 Generated with Claude Code

@marcofanti
marcofanti merged commit 2d749e5 into main Aug 2, 2026
1 check passed
@marcofanti
marcofanti deleted the http11-and-content-digest branch August 2, 2026 16:44
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