You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
h2: HPACK encoder emits only the last table-size update, not the minimum (RFC 7541 §4.2) #1622
Found by the security review of #1620. The behaviour predates that PR: #1620 only swaps the integer encoder it calls.
Problem
The HPACK encoder keeps a single pending table-size update (pending_table_size_update, lib/src/protocol/mux/h2.rs and converter.rs). If the peer sends two SETTINGS_HEADER_TABLE_SIZE changes before sozu writes its next header block, for example 0 then 4096, only the last value (4096) is encoded as a dynamic-table-size update.
RFC 7541 §4.2 requires the encoder to signal the smallest value reached and the final value. The smallest value is what decides which entries the encoder evicted. After the 0, sozu's encoder table is empty. The peer's decoder only sees 4096, so it evicts nothing. The two tables diverge silently: a low index then resolves to the wrong header on the peer, and no error is raised.
Reachability (to verify)
This requires two table-size SETTINGS inside the window between two header blocks written by sozu, on a frontend or a backend H2 connection. It has not been reproduced empirically.
Suggested fix
Track the minimum pending size alongside the latest one, and emit up to two size updates at the start of the next block: the minimum, then the final value when it differs. Add a test that exchanges SETTINGS 0 then 4096 between blocks and checks, with a decoder, that both tables stay identical.
Activity
fix(mux-h2): send every committed frame whole through one ordered out…
fix(hpack): signal the smallest table size before the last one (sozu-…