Skip to content

fix: reject qpack dynamic reference at or above required insert count - #3807

Merged
martinthomson merged 3 commits into
mozilla:mainfrom
uwezkhan:qpack-reference-above-insert-count
Jul 30, 2026
Merged

martinthomson merged 3 commits into
mozilla:mainfrom
uwezkhan:qpack-reference-above-insert-count

Conversation

@uwezkhan

Copy link
Copy Markdown
Contributor
2 inserts (absolute index 0, 1); block declares RIC=1, Base=2, then 0x80
-> reference resolves to absolute index 1 (>= RIC)
-> decode_header_block returns Ok(Headers), not QPACK_DECOMPRESSION_FAILED

decode_header_block validates each dynamic reference only through get_dynamic, which confirms the entry is still in the live table but never checks it against the block's own Required Insert Count. RFC 9204 Section 2.2.3 requires a reference whose absolute index is at or above the Required Insert Count to be a decoding error, because the encoder committed to exactly that many entries; the entry can still be present when later insertions arrive on the encoder stream.

Before: a client decoding a response or push header block accepts such a reference and returns headers whose value depends on insertions the block never declared.

After: the reference is rejected with Decompression (QPACK_DECOMPRESSION_FAILED), the same as every other malformed reference in the block. References within the count decode unchanged.

The check sits at the reference resolution in the decoder, wrapping the four dynamic reads, since that is the only layer holding both the resolved absolute index and req_insert_cnt. It also covers Section 2.2.1, since a Required Insert Count smaller than the block needs surfaces as a reference at or above it. The tradeoff is one more decode that fails closed against trusting an over-optimistic Required Insert Count.

@codecov

codecov Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.78%. Comparing base (be2c8d9) to head (cba8789).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3807   +/-   ##
=======================================
  Coverage   96.77%   96.78%           
=======================================
  Files         120      120           
  Lines       40854    40910   +56     
  Branches    40854    40910   +56     
=======================================
+ Hits        39538    39595   +57     
+ Misses       1291     1290    -1     
  Partials       25       25           
Flag Coverage Δ
freebsd 94.15% <84.37%> (+15.31%) ⬆️
linux 96.96% <96.87%> (-0.01%) ⬇️
macos 95.09% <84.37%> (+0.01%) ⬆️
windows 95.14% <84.37%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
neqo-common 99.23% <ø> (+0.13%) ⬆️
neqo-http3 95.40% <ø> (+<0.01%) ⬆️
neqo-qpack 97.25% <96.87%> (-0.01%) ⬇️
neqo-transport 97.72% <ø> (-0.01%) ⬇️
neqo-udp 95.37% <ø> (ø)
mtu 89.13% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed

codspeed Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 81 untouched benchmarks


Comparing uwezkhan:qpack-reference-above-insert-count (cba8789) with main (76673b1)

Open in CodSpeed

Comment thread neqo-qpack/src/header_block.rs Resolved
@martinthomson
martinthomson enabled auto-merge July 29, 2026 23:18
Signed-off-by: Martin Thomson <mt@lowentropy.net>
@martinthomson

Copy link
Copy Markdown
Member

Let's hold this one. We might just rip server push out entirely.

@uwezkhan

Copy link
Copy Markdown
Contributor Author

Sure. One note for when you come back to it: the check isn't push-specific. It sits in decode_header_block, which the client runs on every header block it decodes, so plain response headers on request streams hit the same path. Push promises were just the second caller, so this stays relevant if push goes away with #3816.

@martinthomson

Copy link
Copy Markdown
Member

Oops, I meant to add that comment to a different PR. Ignore that. I'll merge this when CI finishes.

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark results

No significant performance differences relative to 76673b1.

All results
streams/walltime/1-streams/each-1000-bytes: No change in performance detected.
       time:   [548.48 µs 550.63 µs 553.09 µs]
       thrpt:  [1.7243 MiB/s 1.7320 MiB/s 1.7388 MiB/s]
change:
       time:   [-0.6935% -0.0954% +0.5395] (p = 0.76 > 0.05)
       thrpt:  [-0.5366% +0.0955% +0.6984]
       No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
4 (4.00%) high mild
10 (10.00%) high severe
streams/walltime/1000-streams/each-1-bytes: Change within noise threshold.
       time:   [10.974 ms 10.989 ms 11.005 ms]
       thrpt:  [88.738 KiB/s 88.863 KiB/s 88.988 KiB/s]
change:
       time:   [-1.9123% -1.7307% -1.5390] (p = 0.00 < 0.05)
       thrpt:  [+1.5631% +1.7611% +1.9496]
       Change within noise threshold.
streams/walltime/1000-streams/each-1000-bytes: No change in performance detected.
       time:   [31.556 ms 31.593 ms 31.631 ms]
       thrpt:  [30.150 MiB/s 30.186 MiB/s 30.222 MiB/s]
change:
       time:   [-0.6463% -0.2775% +0.0055] (p = 0.09 > 0.05)
       thrpt:  [-0.0055% +0.2783% +0.6506]
       No change in performance detected.
streams-flow-controlled/walltime/1-streams/each-4194304-bytes: Change within noise threshold.
       time:   [27.063 ms 27.104 ms 27.147 ms]
       thrpt:  [147.34 MiB/s 147.58 MiB/s 147.80 MiB/s]
change:
       time:   [+1.0665% +1.3448% +1.6085] (p = 0.00 < 0.05)
       thrpt:  [-1.5830% -1.3270% -1.0552]
       Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
streams-flow-controlled/walltime/10-streams/each-1048576-bytes: Change within noise threshold.
       time:   [71.369 ms 71.797 ms 72.237 ms]
       thrpt:  [138.43 MiB/s 139.28 MiB/s 140.12 MiB/s]
change:
       time:   [+0.4544% +1.3095% +2.1605] (p = 0.00 < 0.05)
       thrpt:  [-2.1148% -1.2926% -0.4523]
       Change within noise threshold.
transfer/walltime/pacing-false/varying-seeds: No change in performance detected.
       time:   [18.496 ms 18.508 ms 18.519 ms]
       thrpt:  [215.99 MiB/s 216.13 MiB/s 216.26 MiB/s]
change:
       time:   [-0.0905% -0.0092% +0.0707] (p = 0.82 > 0.05)
       thrpt:  [-0.0706% +0.0092% +0.0906]
       No change in performance detected.
Found 4 outliers among 100 measurements (4.00%)
1 (1.00%) low mild
3 (3.00%) high mild
transfer/walltime/pacing-true/varying-seeds: Change within noise threshold.
       time:   [18.633 ms 18.644 ms 18.655 ms]
       thrpt:  [214.42 MiB/s 214.55 MiB/s 214.67 MiB/s]
change:
       time:   [-1.3242% -1.2451% -1.1648] (p = 0.00 < 0.05)
       thrpt:  [+1.1785% +1.2608% +1.3420]
       Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
5 (5.00%) low mild
2 (2.00%) high mild
transfer/walltime/pacing-false/same-seed: Change within noise threshold.
       time:   [18.508 ms 18.518 ms 18.530 ms]
       thrpt:  [215.87 MiB/s 216.00 MiB/s 216.13 MiB/s]
change:
       time:   [+1.0022% +1.1930% +1.3281] (p = 0.00 < 0.05)
       thrpt:  [-1.3107% -1.1789% -0.9922]
       Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
transfer/walltime/pacing-true/same-seed: Change within noise threshold.
       time:   [18.756 ms 18.779 ms 18.815 ms]
       thrpt:  [212.60 MiB/s 213.00 MiB/s 213.26 MiB/s]
change:
       time:   [+0.6928% +0.8371% +1.0293] (p = 0.00 < 0.05)
       thrpt:  [-1.0188% -0.8301% -0.6880]
       Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high severe

Download data for profiler.firefox.com or download performance comparison data.

@martinthomson
martinthomson added this pull request to the merge queue Jul 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Client/server transfer results

Performance differences relative to 76673b1.

No significant performance differences.

Table above only shows statistically significant changes. See all results below.

All results

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server Mean±σ Min–Max Median±MAD MiB/s±σ ΔMedian
google-google 463.2 ± 2.3 460.0 – 473.2 462.7 ± 1.4 69.1 ± 0.3
google-neqo-cubic ⚠️ 268.2 ± 2.2 265.1 – 283.1 267.6 ± 1.2 119.3 ± 1.0 +0.0 (+0.0%)
neqo-google-cubic 776.1 ± 2.3 771.2 – 783.6 775.9 ± 2.1 41.2 ± 0.1 +0.7 (+0.1%)
neqo-neqo-cubic 78.6 ± 2.2 73.0 – 84.2 78.8 ± 2.0 407.0 ± 11.3 +0.3 (+0.3%)
neqo-neqo-cubic-nopacing 80.2 ± 3.5 74.9 – 96.0 79.4 ± 2.1 398.8 ± 17.5 +0.7 (+0.9%)
neqo-neqo-newreno 78.9 ± 2.4 73.3 – 85.7 78.6 ± 2.3 405.8 ± 12.3 +0.4 (+0.5%)
neqo-neqo-newreno-nopacing 79.3 ± 2.6 73.7 – 87.3 78.7 ± 2.3 403.6 ± 13.4 +0.7 (+0.9%)
neqo-quiche-cubic 191.1 ± 1.7 185.6 – 198.3 191.0 ± 1.2 167.4 ± 1.5 -0.2 (-0.1%)
neqo-s2n-cubic 214.0 ± 1.9 209.3 – 221.1 213.9 ± 1.6 149.5 ± 1.3 -0.4 (-0.2%)
quiche-neqo-cubic ⚠️ 138.2 ± 2.3 132.3 – 151.2 137.8 ± 1.0 231.5 ± 3.9 +0.0 (+0.0%)
quiche-quiche 136.7 ± 3.7 129.7 – 147.1 136.7 ± 4.1 234.1 ± 6.4
s2n-neqo-cubic 218.1 ± 2.0 214.2 – 224.4 217.9 ± 2.1 146.7 ± 1.4 -0.8 (-0.4%)
s2n-s2n ⚠️ 288.7 ± 18.8 278.6 – 385.5 284.8 ± 2.8 110.8 ± 7.2

Download data for profiler.firefox.com or download performance comparison data.

@github-actions

Copy link
Copy Markdown
Contributor

Failed Interop Tests

QUIC Interop Runner, client vs. server, differences relative to main at be2c8d9.

neqo-pr as clientneqo-pr as server
neqo-pr vs. go-x-net: BP BA
neqo-pr vs. haproxy: BP BA
neqo-pr vs. kwik: baseline result missing
neqo-pr vs. lsquic: baseline result missing
neqo-pr vs. msquic: A L1 C1
neqo-pr vs. mvfst: A
neqo-pr vs. neqo: A
neqo-pr vs. nginx: BP BA
neqo-pr vs. ngtcp2: CM
neqo-pr vs. picoquic: A
neqo-pr vs. quic-go: A
neqo-pr vs. quic-zig: B 🚀C1
neqo-pr vs. quiche: BP BA
neqo-pr vs. s2n-quic: ⚠️BA CM
neqo-pr vs. tquic: S BP BA
neqo-pr vs. xquic: A ⚠️C1
aioquic vs. neqo-pr: CM
go-x-net vs. neqo-pr: CM
kwik vs. neqo-pr: BP BA CM
msquic vs. neqo-pr: ⚠️C1 CM
mvfst vs. neqo-pr: baseline result missing
neqo vs. neqo-pr: A
openssl vs. neqo-pr: LR M A CM
quic-go vs. neqo-pr: run cancelled after 20 min
quiche vs. neqo-pr: CM
quinn vs. neqo-pr: ⚠️L1 V2 CM
s2n-quic vs. neqo-pr: CM
tquic vs. neqo-pr: CM
xquic vs. neqo-pr: M CM
All results

Succeeded Interop Tests

QUIC Interop Runner, client vs. server

neqo-pr as client

neqo-pr as server

Unsupported Interop Tests

QUIC Interop Runner, client vs. server

neqo-pr as client

neqo-pr as server

Merged via the queue into mozilla:main with commit 7f7750d Jul 30, 2026
194 of 197 checks passed
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 14, 2026
User-visible changes since v0.30.1:

- Update nss-rs to 0.14.4, now requiring NSS >= 3.126:
  mozilla#3874
- WebTransport getStats() support:
  mozilla#3835
- Reliable reset handling for HTTP/3:
  mozilla#3777
- Optionally close a connection after N consecutive PTOs:
  mozilla#3662
- Reject 0-RTT downgrade of h3 datagram and WebTransport settings:
  mozilla#3852
- Reject connection-specific header fields in HTTP/3 messages:
  mozilla#3806
- Reject qpack dynamic reference at or above required insert count:
  mozilla#3807
- Discard server Initial packets that carry a token:
  mozilla#3814
@mxinden mxinden mentioned this pull request Aug 14, 2026
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 24, 2026
User-visible changes since v0.30.1:

- Update nss-rs to 0.14.4, now requiring NSS >= 3.126:
  mozilla#3874
- WebTransport getStats() support:
  mozilla#3835
- Reliable reset handling for HTTP/3:
  mozilla#3777
- Optionally close a connection after N consecutive PTOs:
  mozilla#3662
- Reject 0-RTT downgrade of h3 datagram and WebTransport settings:
  mozilla#3852
- Reject connection-specific header fields in HTTP/3 messages:
  mozilla#3806
- Reject qpack dynamic reference at or above required insert count:
  mozilla#3807
- Discard server Initial packets that carry a token:
  mozilla#3814
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.

3 participants