GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing github.com — Don't count insertions twice in QPACK Insert Count Increments by allthingssecurity · Pull Request #17756 · netty/netty Conversation
Contributor
Motivation: When the QPACK decoder resumes a blocked stream, it decodes the header block and sends a Section Acknowledgment. As described in RFC 9204, section 4.4.1, the encoder then raises its Known Received Count to the Required Insert Count of that header block.
Example, with the dynamic table and blocked streams enabled:
The encoder's Known Received Count (3) is now larger than the number of insertions (2). RFC 9204, section 4.4.3, requires the encoder to treat this as a connection error of type QPACK_DECODER_STREAM_ERROR. Netty's own Modification:
Result: Insert Count Increments no longer acknowledge insertions twice, and the connection is no longer closed with QPACK_DECODER_STREAM_ERROR after a blocked stream was resumed.
Prepared with Claude Code on behalf of allthingssecurity. 🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation: When the QPACK decoder resumes a blocked stream it decodes the header block and sends a Section Acknowledgment. As described in RFC 9204, section 4.4.1, the encoder then raises its Known Received Count to the Required Insert Count of that header block. `QpackDecoder` did not take this into account: `lastAckInsertCount` was only updated when an Insert Count Increment was sent, so the next Insert Count Increment included the insertions that the Section Acknowledgment had acknowledged already. For example, a stream is blocked on the first insertion. The first insertion resumes it (Section Acknowledgment, Known Received Count = 1) and the second insertion sends an Insert Count Increment of 2 instead of 1. The encoder's Known Received Count (3) is now larger than the number of insertions (2), which RFC 9204, section 4.4.3, requires the encoder to treat as a connection error of type QPACK_DECODER_STREAM_ERROR. Netty's own `QpackEncoder` does so and the connection is closed. This happens whenever the dynamic table and blocked streams are enabled and the peer references an entry the decoder did not receive yet. Modification: - Update `lastAckInsertCount` when a Section Acknowledgment is sent for a header block with a larger Required Insert Count. - Don't send an Insert Count Increment when all insertions were acknowledged already, even if the `QpackDecoderStateSyncStrategy` asks for it, as an increment of 0 is an error as well. - Add `QpackDecoderTest.insertCountIncrementDoesNotRepeatInsertsAcknowledgedBySection`. - `QpackEncoderDecoderTest.duplicateWithBlockedStreams` encoded a header block that is never decoded on the same stream as the one that is decoded, so the encoder applied the Section Acknowledgment to the wrong header block. The extra Insert Count Increment hid this. Use another stream for the header block that is never decoded. Result: The decoder's Insert Count Increments no longer acknowledge insertions twice, and the connection is not closed with QPACK_DECODER_STREAM_ERROR after a blocked stream was resumed. Co-Authored-By: Claude Opus 5.5 <[email protected]> …n-ack Resolve the conflict in QpackDecoderTest: keep both the new test of this branch and blockedStreamsCountReleasedAfterStreamAbandoned from 4.2. Co-Authored-By: Claude Opus 5.5 <[email protected]> …ged insert count Motivation: QpackDecoder only raises lastAckInsertCount when a Section Acknowledgment is sent for a larger Required Insert Count. Nothing covered a Section Acknowledgment for a lower Required Insert Count, which must not move lastAckInsertCount back. Modification: - Add QpackDecoderTest.sectionAcknowledgmentOfLowerRequiredInsertCountDoesNotLowerAcknowledgedInsertCount. - Let knownReceivedCountOfEncoder(...) take the Required Insert Count per stream instead of a single value for all Section Acknowledgments. Result: Removing the `requiredInsertCount > lastAckInsertCount` check fails the new test. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
normanmaurer
added a commit
that referenced
this pull request
…rements (#17907) Auto-port of #17756 to 5.0 Cherry-picked commit: 098e103 --- Motivation: When the QPACK decoder resumes a blocked stream, it decodes the header block and sends a Section Acknowledgment. As described in RFC 9204, section 4.4.1, the encoder then raises its Known Received Count to the Required Insert Count of that header block. `QpackDecoder` did not take this into account. `lastAckInsertCount` was only updated when an Insert Count Increment was sent, so the next Insert Count Increment included the insertions that the Section Acknowledgment had already acknowledged. Example, with the dynamic table and blocked streams enabled: 1. A header block on stream 0 references the first dynamic table entry before the decoder received it, so stream 0 is blocked. 2. The first insertion arrives. Stream 0 is resumed and a Section Acknowledgment is sent (the encoder's Known Received Count is now 1). `ackEachInsert()` skips the Insert Count Increment, as the Section Acknowledgment covered it, but `lastAckInsertCount` stays 0. 3. The second insertion arrives and the decoder sends an Insert Count Increment of 2 instead of 1. The encoder's Known Received Count (3) is now larger than the number of insertions (2). RFC 9204, section 4.4.3, requires the encoder to treat this as a connection error of type QPACK_DECODER_STREAM_ERROR. Netty's own `QpackEncoder` does that (`INVALID_KNOW_RECEIVED_COUNT_INCREMENT`), and the connection is closed. This happens every time a blocked stream is resumed and another insertion follows, which is the normal case when a peer uses blocking references. Modification: - Update `lastAckInsertCount` when a Section Acknowledgment is sent for a header block with a larger Required Insert Count. - Don't send an Insert Count Increment when all insertions were acknowledged already, even if the `QpackDecoderStateSyncStrategy` asks for one. An increment of 0 is a connection error too, and a custom strategy can return `true` from `entryAdded(...)` at any time. - Add `QpackDecoderTest.insertCountIncrementDoesNotRepeatInsertsAcknowledgedBySection`. It blocks a stream on the first insertion, adds two insertions, replays the instructions written to the decoder stream the way an encoder does, and checks that the Known Received Count is 2 and that no increment is 0. It runs with `ackEachInsert()` and with a strategy that acknowledges every insertion. - `QpackEncoderDecoderTest.duplicateWithBlockedStreams` encoded a header block that is never decoded on the same stream as the header block that is decoded. The encoder applied the Section Acknowledgment to the first one (Section Acknowledgments of a stream are processed in order), and the extra Insert Count Increment made up for it. The test now uses another stream for the header block that is never decoded. Result: Insert Count Increments no longer acknowledge insertions twice, and the connection is no longer closed with QPACK_DECODER_STREAM_ERROR after a blocked stream was resumed. Co-authored-by: allthingssecurity <[email protected]> Co-authored-by: Norman Maurer <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | |||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |