Skip to content

Reset HTTP/2 pushes for other origins - #547

Open
ericmj wants to merge 1 commit into
mainfrom
push-promise-authority
Open

ericmj wants to merge 1 commit into
mainfrom
push-promise-authority

Conversation

@ericmj

@ericmj ericmj commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Mint.HTTP2 returned a PUSH_PROMISE to the caller whatever its :scheme and :authority were, so a server on https://a.example could promise a response for https://b.example. RFC 9113 8.4.1 requires the client to check that the server is authoritative for a pushed request and to treat a push that fails the check as a PROTOCOL_ERROR stream error. This affects callers that keep push enabled (the default) and store pushed responses under the promised URL. Finch and Req disable push, and the Tesla and grpc Mint adapters drop pushed responses, so none of them are affected.

Pushes are now accepted only when the promised :scheme and :authority match the connection, ignoring case and an explicit default port. Other pushes reset the promised stream with PROTOCOL_ERROR, the same as other invalid promised requests, and the server push docs say so. RFC 9113 10.1 also allows pushes for other origins covered by the server's certificate. Mint doesn't track that per connection, so it resets those too.

Reported by @Divsonar.

@coveralls

coveralls commented Nov 16, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 0

Coverage decreased (-0.05%) to 90.572%

Details

  • Coverage decreased (-0.05%) from the base build.
  • Patch coverage: 14 of 14 lines across 1 file are fully covered (100%).
  • 2 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

2 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
lib/mint/http1/response.ex 1 96.05%
lib/mint/http2.ex 1 95.49%

Coverage Stats

Coverage Status
Relevant Lines: 2047
Covered Lines: 1854
Line Coverage: 90.57%
Coverage Strength: 752.03 hits per line

💛 - Coveralls

Mint.HTTP2 checked that a PUSH_PROMISE carried non-empty :scheme and
:authority pseudo-headers but never compared them to the connection, so
a server on https://a.example could promise a response for
https://b.example and Mint returned it to the caller as a
:push_promise. RFC 9113 8.4.1 requires the client to check that the
server is authoritative for a pushed request and to treat a push that
fails the check as a stream error of type PROTOCOL_ERROR. A caller that
stores pushed responses under the promised URL would otherwise store
another origin's content.

Pushes are now accepted only for the connection's own origin: the
promised :scheme must equal the connection's scheme and the promised
:authority must equal the connection's authority, ignoring case and an
explicit default port. Other pushes reset the promised stream with
PROTOCOL_ERROR, like the other invalid promised requests. RFC 9113 10.1
also allows pushes for any origin covered by the server's certificate,
which Mint doesn't track per connection, so those are reset as well.
@ericmj
ericmj force-pushed the push-promise-authority branch from 5f5ef66 to ce370fe Compare November 16, 2026 21:09
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.

2 participants