Skip to content

RFC 9113 §6.4: treat RST_STREAM with wrong payload length as connection error - #1141

Closed
arturobernalg wants to merge 1 commit into
apache:mainfrom
arturobernalg:rfc9113-rst-frame-size-error
Closed

arturobernalg wants to merge 1 commit into
apache:mainfrom
arturobernalg:rfc9113-rst-frame-size-error

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

RFC 9113, section 6.4 states:

A RST_STREAM frame with a length other than 4 octets MUST be treated as a connection error (Section 5.4.1) of type FRAME_SIZE_ERROR.

FrameType had RST declared with payloadErrorFatal=false. When a RST_STREAM frame arrived with a payload size other than 4 bytes on a non-zero stream, FrameType.check() fell into the stream-error branch and sent a RST_STREAM back to the client. RFC 9113 §6.4 requires a connection error (GOAWAY) instead.

The fix sets payloadErrorFatal=true for RST, so FrameType.check() always throws a ConnectionException for a malformed RST_STREAM payload, regardless of stream id.

For comparison, PRIORITY (§6.3) correctly uses false because §6.3 says "stream error", and WINDOW_UPDATE (§6.9) correctly uses true because §6.9 says "connection error". RST was the only frame type with the wrong setting.

TestHttp2Section_6_4.testResetFrameWrongLength is updated to expect GOAWAY(FRAME_SIZE_ERROR) instead of the previously incorrect RST_STREAM(FRAME_SIZE_ERROR).

RFC 9113, section 6.4 states: "A RST_STREAM frame with a length other
than 4 octets MUST be treated as a connection error (Section 5.4.1) of
type FRAME_SIZE_ERROR."

FrameType had RST declared with payloadErrorFatal=false, which caused a
StreamException (RST_STREAM) to be sent to the client instead of a
ConnectionException (GOAWAY) when the payload length was not exactly
4 bytes.

Set payloadErrorFatal=true for RST so that FrameType.check() escalates
the payload-size violation to a connection error, matching the RFC
mandate.

Update TestHttp2Section_6_4.testResetFrameWrongLength to assert the
correct GOAWAY response instead of the previously incorrect RST_STREAM.
@arturobernalg

Copy link
Copy Markdown
Member Author

Closing as a duplicate: the same change, treating a RST_STREAM frame with a length other than 4 as a connection error of type FRAME_SIZE_ERROR (RFC 9113, section 6.4), was already merged as #1118. After rebasing onto main there is no difference left.

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