arturobernalg opened a new pull request, #1137:
URL: https://github.com/apache/tomcat/pull/1137
## Problem
RFC 9113 §6.10 states:
> A receiver MUST treat the receipt of any other type of frame or a frame
> on a different stream as a connection error (Section 5.4.1) of type
> PROTOCOL_ERROR.
This applies to any frame received while a header block is in progress
(i.e., after a HEADERS/PUSH_PROMISE frame without END_HEADERS).
`Http2Parser.validateFrame()` had two defects:
1. **Wrong error code** — mid-header-block violations (CONTINUATION on a
different stream, or any non-CONTINUATION frame) were reported as
`COMPRESSION_ERROR` instead of `PROTOCOL_ERROR`.
2. **RST_STREAM carve-out** — a special `NO-OP` branch silently accepted
RST_STREAM on the same stream as the in-progress header block, resetting
the header state without sending a connection error. RST_STREAM is not
exempt from the PROTOCOL_ERROR rule.
## Fix
- Remove the RST_STREAM carve-out so it falls through to the same
`ConnectionException(PROTOCOL_ERROR)` path as every other disallowed frame
type.
- Change the error code from `COMPRESSION_ERROR` to `PROTOCOL_ERROR` in both
mid-header-block violation sites.
## Tests
- `TestHttp2Section_4_3.testHeaderContinuationInterruptedByRst` — new test:
opens a header block without END_HEADERS, then sends RST_STREAM on the same
stream, and asserts that the server closes the connection with
GOAWAY(PROTOCOL_ERROR).
- `TestHttp2Section_5_1.testClosedInvalidFrame01` — updated to establish a
validly closed stream via a POST request followed by RST_STREAM, rather
than
relying on RST_STREAM during an incomplete header block (which is itself
now a
connection error).
- `TestHttp2Section_5_5`, `TestHttp2Section_6_3` — expected error code
updated
from `COMPRESSION_ERROR` to `PROTOCOL_ERROR`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]