From 030115c96c5a81ea5e70f510a731d669033cc751 Mon Sep 17 00:00:00 2001 From: CI Test Date: Thu, 26 Nov 2026 05:35:00 +0000 Subject: [PATCH] Plan 329: bound the H3 local send ceilings at u32::MAX Http3Config::validate rejected only zero for send_window and max_send_buf_size. send_window is quinn's per-connection retained-write memory cap, so any value above zero disabled the only bound on retained unacknowledged write memory; max_send_buf_size had no upper bound even though the HTTP/2 twin is capped at u32::MAX. Bound both to 1..=u32::MAX with field-named diagnostics that state the range, matching http2.max_send_buf_size. The QUIC VarInt ceiling (2^62-1) stays on the wire-encoded receive windows and idle timeout, so the two classes of bound remain separate. Defaults (4 MiB and 256 KiB), field types, and the public surface are unchanged; H3 stays experimental. New tests cover one above the ceiling and the ceiling itself for both fields, plus default validity. The pre-fix validator accepted the above-ceiling values: both tests failed with unwrap_err() on Ok(()) when the earlier non-zero-only arms were temporarily restored. Docs and records: architecture/http3.md states the semantics and ceilings, CHANGELOG gains the 329 bullet, and the registry, TLS identity roadmap, 327 closure section 13, and the new 329 closure record mark the finding resolved. Verified before commit: cargo fmt --all -- --check, cargo test -p eggserve-h3 (19 passed), cargo clippy -p eggserve-h3 --all-targets -D warnings, cargo test -p eggserve-core --features http3,tls --lib (164 passed), core clippy with http3,tls, the http3_runtime suite (16 passed), workspace and MSRV 1.89 checks, git diff --check, and scripts/check-crate-topology.py. --- CHANGELOG.md | 10 +- architecture/http3.md | 12 +- crates/eggserve-h3/src/config.rs | 70 +++++- .../327-tls-substrate-corrective.md | 10 +- .../tls-identity/329-h3-send-window-bound.md | 169 +++++++++++++ .../tls-identity/329-h3-send-window-bound.md | 235 ++++++++++++++++++ plans/registry.md | 5 +- plans/subsystems/tls-identity-roadmap.md | 25 +- 8 files changed, 522 insertions(+), 14 deletions(-) create mode 100644 plans/closure/tls-identity/329-h3-send-window-bound.md create mode 100644 plans/implementation/tls-identity/329-h3-send-window-bound.md diff --git a/CHANGELOG.md b/CHANGELOG.md index f4548aa..9f2f74c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased — post-audit maintenance (Plans 320–328) +## Unreleased — post-audit maintenance (Plans 320–329) No version has been published from this work; the Rust line stays on `0.5.x` and the wheel on `0.2.5` until a maintainer chooses a release. @@ -83,6 +83,14 @@ and the wheel on `0.2.5` until a maintainer chooses a release. `h2`-advertising snapshot when the runtime cannot serve HTTP/2, before it becomes live, so the previous identity stays in service instead of every h2 client completing a handshake and being dropped. +- **H3 local send ceilings are bounded (Plan 329).** `Http3Config::validate` + now bounds `send_window` — quinn's per-connection retained-write memory + cap — and `max_send_buf_size` to `1..=u32::MAX`, matching + `http2.max_send_buf_size`. The QUIC VarInt ceiling (`2^62-1`) still applies + to the wire-encoded receive windows and idle timeout, so the two classes of + bound stay separate. This closes the low finding recorded in the 327 + closure. Defaults (4 MiB and 256 KiB), field types, and the CLI/Python + surfaces are unchanged; H3 remains experimental. ## 0.5.1 — `eggserve-static` patch (published 2026-10-23) diff --git a/architecture/http3.md b/architecture/http3.md index 5b7225d..e3dfa51 100644 --- a/architecture/http3.md +++ b/architecture/http3.md @@ -100,14 +100,22 @@ connection migration as an application identity mechanism. | `max_concurrent_uni_streams` | 16 | H3 control/QPACK headroom included | | `stream_receive_window` | 256 KiB | Per-stream QUIC receive budget | | `connection_receive_window` | 4 MiB | Per-connection receive budget | -| `send_window` | 4 MiB | QUIC outbound flow-control budget | +| `send_window` | 4 MiB | Per-connection retained-write memory cap, `1..=u32::MAX` | | `max_idle_timeout` | 60 s | QUIC idle timeout | | `max_pending_handshakes` | 64 | Pending handshake task budget | | `max_field_section_size` | 32 KiB | Decoded H3 field-section budget | -| `max_send_buf_size` | 256 KiB | H3 response send-chunk ceiling | +| `max_send_buf_size` | 256 KiB | H3 response send-chunk ceiling, `1..=u32::MAX` | | `stateless_retry` | false | Optional retry-token policy | | `advertise_alt_svc` | false | Runtime-owned TCP/H2 `Alt-Svc` advertisement | +The two receive windows and `max_idle_timeout` are QUIC VarInt wire values, so +`Http3Config::validate` bounds them by `2^62-1`. `send_window` and +`max_send_buf_size` are local memory ceilings instead and are bounded by +`u32::MAX`, matching `http2.max_send_buf_size`: quinn retains up to +`send_window` bytes of unacknowledged application writes per connection, and +`max_send_buf_size` caps one H3 response chunk before the shared +`stream_chunk_size` clamp applies. + The H3 adapter also applies shared aggregate header bytes, header count, request-target bytes, request-body, handler/body/response-write timeouts, service admission, and file-stream admission. A rough receive-memory ceiling diff --git a/crates/eggserve-h3/src/config.rs b/crates/eggserve-h3/src/config.rs index 0c261e9..fd39049 100644 --- a/crates/eggserve-h3/src/config.rs +++ b/crates/eggserve-h3/src/config.rs @@ -27,7 +27,13 @@ pub struct Http3Config { pub stream_receive_window: u64, /// Per-connection receive window in bytes. pub connection_receive_window: u64, - /// QUIC send window in bytes. + /// Maximum bytes retained from application writes across all streams of + /// one connection. + /// + /// Quinn keeps up to this many unacknowledged application bytes per + /// connection, so this is a local memory ceiling rather than a value + /// carried on the wire. It is bounded to `1..=u32::MAX`, not by the QUIC + /// VarInt range that applies to the receive windows. pub send_window: u64, /// Maximum idle time for a QUIC connection. pub max_idle_timeout: Duration, @@ -36,6 +42,11 @@ pub struct Http3Config { /// Maximum decoded HTTP/3 field section size. pub max_field_section_size: u64, /// Maximum number of bytes buffered by one outgoing H3 response stream. + /// + /// The effective chunk size is further clamped by the shared + /// `stream_chunk_size`, so this is a local memory ceiling rather than a + /// wire-encoded value. It is bounded to `1..=u32::MAX`, matching + /// `http2.max_send_buf_size`. pub max_send_buf_size: usize, /// Whether Quinn may issue stateless retry tokens. pub stateless_retry: bool, @@ -105,11 +116,17 @@ impl Http3Config { "must be at least stream_receive_window", )); } - if self.send_window == 0 { - return Err(invalid("send_window", "must be greater than zero")); + if self.send_window == 0 || self.send_window > u64::from(u32::MAX) { + return Err(invalid( + "send_window", + "must be between 1 and u32::MAX bytes", + )); } - if self.max_send_buf_size == 0 { - return Err(invalid("max_send_buf_size", "must be greater than zero")); + if self.max_send_buf_size == 0 || self.max_send_buf_size > u32::MAX as usize { + return Err(invalid( + "max_send_buf_size", + "must be between 1 and u32::MAX bytes", + )); } if self.max_idle_timeout.is_zero() || self.max_idle_timeout.as_millis() > u128::from(QUIC_VARINT_MAX) @@ -199,4 +216,47 @@ mod tests { }; assert!(at_limit.validate().is_ok()); } + + /// The local send-buffer ceiling stops at `u32::MAX`, above the VarInt + /// bound that applies to the wire-encoded receive windows. + #[test] + fn send_window_bound_is_validated() { + let too_large = Http3Config { + send_window: u64::from(u32::MAX) + 1, + ..Default::default() + }; + let error = too_large.validate().unwrap_err().to_string(); + assert!(error.contains("http3.send_window"), "{error}"); + assert!(error.contains("1 and u32::MAX"), "{error}"); + + let at_limit = Http3Config { + send_window: u64::from(u32::MAX), + ..Default::default() + }; + assert!(at_limit.validate().is_ok()); + } + + /// A `usize` above `u32::MAX` is representable only on 64-bit targets. + #[cfg(target_pointer_width = "64")] + #[test] + fn max_send_buf_size_bound_is_validated() { + let too_large = Http3Config { + max_send_buf_size: u32::MAX as usize + 1, + ..Default::default() + }; + let error = too_large.validate().unwrap_err().to_string(); + assert!(error.contains("http3.max_send_buf_size"), "{error}"); + assert!(error.contains("1 and u32::MAX"), "{error}"); + + let at_limit = Http3Config { + max_send_buf_size: u32::MAX as usize, + ..Default::default() + }; + assert!(at_limit.validate().is_ok()); + } + + #[test] + fn default_config_is_valid() { + assert!(Http3Config::default().validate().is_ok()); + } } diff --git a/plans/closure/tls-identity/327-tls-substrate-corrective.md b/plans/closure/tls-identity/327-tls-substrate-corrective.md index b66c1b2..0fd2159 100644 --- a/plans/closure/tls-identity/327-tls-substrate-corrective.md +++ b/plans/closure/tls-identity/327-tls-substrate-corrective.md @@ -147,7 +147,13 @@ Milestone 327 is closed; no hard dependency blocks the next TLS identity or H2/H `max_send_buf_size` produced a false field attribution. Split into two arms (matching `http2.rs`), with `zero_send_buf_size_names_its_own_field` covering both branches. -- Open low finding: `max_send_buf_size` is bounded only below (`> 0`), and - `send_window` has no upper bound even though quinn documents it as the +- Low finding: `max_send_buf_size` was bounded only below (`> 0`), and + `send_window` had no upper bound even though quinn documents it as the per-connection retained-write memory cap. The H3 knobs are Rust-API only (no CLI or Python surface), and the defaults stay at 4 MiB / 256 KiB. +- **Resolved by milestone 329** + (`plans/closure/tls-identity/329-h3-send-window-bound.md`): `send_window` and + `max_send_buf_size` are bounded to `1..=u32::MAX`, matching + `http2.max_send_buf_size`, with field-named diagnostics and unit tests at and + above the ceiling. The QUIC VarInt ceiling (`2^62-1`) remains on the + wire-encoded fields only. diff --git a/plans/closure/tls-identity/329-h3-send-window-bound.md b/plans/closure/tls-identity/329-h3-send-window-bound.md new file mode 100644 index 0000000..06d3a96 --- /dev/null +++ b/plans/closure/tls-identity/329-h3-send-window-bound.md @@ -0,0 +1,169 @@ +# TLS Identity Milestone 329 - Closure Status + +Status: closed + +Source implementation plan: + +- `plans/implementation/tls-identity/329-h3-send-window-bound.md` + +Source subsystem roadmap: + +- `plans/subsystems/tls-identity-roadmap.md#7` (Milestone 329) + +Repository baseline reviewed: `e9c98a0` (`main` after PR #6) + +Implementation commits or pull requests: + +- not yet committed (working tree; commit is a user-owned action) + +## 1. Executive finding + +`Http3Config::validate` now bounds both H3 local buffer ceilings at +`u32::MAX`. `send_window` — quinn's per-connection retained-write memory cap — +can no longer be raised arbitrarily, and `max_send_buf_size` now matches the +HTTP/2 twin's `1..=u32::MAX` bound. The QUIC VarInt ceiling (`2^62-1`) still +applies only to the wire-encoded receive windows and idle timeout, so the two +classes of bound are not merged. This closes the low finding recorded in the +327 closure (section 13). + +## 2. Requirement-to-evidence matrix + +| Acceptance criterion | Evidence | Result | Notes | +|---|---|---|---| +| `send_window > u32::MAX` is rejected naming `http3.send_window` and the range | `config::tests::send_window_bound_is_validated` | pass | Exercises `u32::MAX + 1`; the message contains `1 and u32::MAX`. | +| `send_window == u32::MAX` validates | same test | pass | | +| `max_send_buf_size` above `u32::MAX` is rejected naming the field | `config::tests::max_send_buf_size_bound_is_validated` | pass | Compiled only on 64-bit targets, where such a `usize` exists. | +| The ceiling `max_send_buf_size` validates | same test | pass | | +| Zero stays rejected for both fields, each named | existing `zero_send_buf_size_names_its_own_field` | pass | The two-arm split from 327 is preserved; the range check keeps them separate. | +| The default configuration validates and defaults are unchanged | `config::tests::default_config_is_valid`; `config.rs:68` 4 MiB, `:72` 256 KiB | pass | | +| No CLI or Python surface change; H3 stays experimental | only `crates/eggserve-h3` and documentation changed | pass | No manifest, frontend, or tier change. | +| 327 section 13 finding marked resolved | 327 closure section 13 | pass | Pointer replaced by the resolution. | + +## 3. Production implementation evidence + +- `crates/eggserve-h3/src/config.rs:119`: `send_window` rejects zero and any + value above `u64::from(u32::MAX)`, naming `http3.send_window`. +- `crates/eggserve-h3/src/config.rs:125`: `max_send_buf_size` rejects zero and + any value above `u32::MAX as usize`, matching + `crates/eggserve-core/src/server/config/http2.rs:104`. +- `crates/eggserve-h3/src/config.rs:30-37` and `:44-50`: field documentation + states that both are local memory ceilings rather than wire values, what + quinn does with `send_window`, and the `stream_chunk_size` clamp on + `max_send_buf_size`. +- Tests: `send_window_bound_is_validated` (`:223`), + `max_send_buf_size_bound_is_validated` (`:242`), `default_config_is_valid` + (`:259`). +- `architecture/http3.md:103`, `:107`, and the paragraph at `:110-117`. +- No field type, default, error type, or wire behavior changed; `quic.rs` and + `response.rs` are untouched. + +## 4. Verification executed + +### Commands run + +```bash +cargo fmt --all +cargo fmt --all -- --check +cargo test -p eggserve-h3 -- --test-threads=1 +cargo clippy -p eggserve-h3 --all-targets -- -D warnings +cargo test -p eggserve-core --features http3,tls --lib -- --test-threads=1 +cargo clippy -p eggserve-core --features http3,tls --lib --tests -- -D warnings +cargo test -p eggserve-core --features http3,tls --test http3_runtime -- --test-threads=1 +cargo check --workspace --all-targets --features http3,tls +cargo +1.89 check --workspace --all-targets --features http3,tls +git diff --check +python3 scripts/check-crate-topology.py +``` + +### Results + +- `eggserve-h3`: 19 lib tests passed; 0 doc-tests. +- `eggserve-core --features http3,tls --lib`: 164 passed. +- `http3_runtime`: 16 passed. +- Clippy for `eggserve-h3` (all targets) and for `eggserve-core` + (`http3,tls`, lib and tests): exit 0 with `-D warnings`. +- Workspace check on stable and on the 1.89.0 MSRV toolchain: exit 0. +- `git diff --check` and `scripts/check-crate-topology.py`: clean. + +### Pre-fix behavior + +The two new tests were run once against the pre-fix validator by temporarily +restoring the earlier non-zero-only arms in the working copy: both failed with +`called Result::unwrap_err() on an Ok value`, proving an above-ceiling value +previously validated. The fixed file was then restored byte-for-byte and the +config tests re-ran green (6 passed). + +`./scripts/verify.sh fast` was not used as the gate: it cannot complete on this +macOS host because of the pre-existing `eggserve-server` test recorded in the +327 closure, which this milestone does not touch. + +## 5. Invariant review + +- QUIC VarInt wire fields (`stream_receive_window`, `connection_receive_window`, + `max_idle_timeout`) keep their `2^62-1` bound and their existing tests. +- Defaults are unchanged: `send_window` 4 MiB, `max_send_buf_size` 256 KiB. +- Zero stays rejected for every bounded field, each naming itself. +- No 0-RTT, protocol-version, migration, retry, or identity change; H3 remains + experimental and no CLI/Python knob was added. +- No key or certificate material appears in either new diagnostic. + +## 6. Failure and recovery review + +Validation is pure and runs before any endpoint exists: `RuntimeConfig::validate` +calls `Http3Config::validate` when H3 is enabled, and `Server::start` re-runs it +at `crates/eggserve-core/src/server/mod.rs:601` before the H3 endpoint is +assembled at `:700`. A rejected value therefore fails startup with +`ServerError::Config` before the UDP socket is bound, with no partial endpoint +and no state to unwind. No lock, task, or reload path is involved. + +## 7. Migration and compatibility review + +- A value above `u32::MAX` is now rejected where it was previously accepted. + `Http3Config` is reachable only from Rust and H3 is experimental; the + defaults and the public field types are unchanged. +- An embedding that deliberately set an unbounded send window must clamp to + `u32::MAX` or keep the 4 MiB default. +- `max_send_buf_size` was already clamped by `stream_chunk_size` at + `crates/eggserve-h3/src/response.rs:299-302`, so that half is preventive and + has no observed runtime exposure. +- No variant, method, or dependency is added or removed. + +## 8. Security review + +- `send_window` is the one H3 knob that could silently remove quinn's + per-connection retained-write memory cap; it is now bounded, so a + misconfigured embedder cannot make one connection retain unbounded + unacknowledged write memory. +- The two local ceilings share the HTTP/2 twin's bound, so the same class of + buffer cannot be bounded differently in the two protocols. +- The diagnostics name the field and the range only; they carry no secret or + identity material. + +## 9. Documentation and operations + +- `architecture/http3.md` now calls `send_window` the retained-write memory cap + rather than a flow-control budget, states both ceilings, and distinguishes + them from the VarInt wire bounds. +- `CHANGELOG.md` Unreleased gains the Plan 329 bullet and the header now covers + Plans 320–329. +- `plans/registry.md`, `plans/subsystems/tls-identity-roadmap.md`, and the 327 + closure section 13 carry the closed status and the resolution. + +## 10. Unresolved findings + +| Severity | Finding | Impact | Required action | +|---|---|---|---| +| none | No new finding. The pre-existing macOS `app_bounded_body_accepts_and_over_limit_rejects` failure remains owned by `direct-h1-runtime`, unchanged and not exercised here. | `./scripts/verify.sh fast` still cannot complete on this host | Tracked in the 327 closure; separate milestone. | + +## 11. Roadmap disposition + +Milestone 329 is closed. It is the last open finding from the 327 post-merge +review. No hard dependency blocks the next TLS identity or H2/H3 milestone. + +## 12. Registry updates + +- `plans/registry.md`: milestone 329 marked closed with this record; next + milestone number stays `330`. +- `plans/subsystems/tls-identity-roadmap.md`: milestone 329 marked closed. +- `plans/implementation/tls-identity/329-h3-send-window-bound.md`: status + implemented. diff --git a/plans/implementation/tls-identity/329-h3-send-window-bound.md b/plans/implementation/tls-identity/329-h3-send-window-bound.md new file mode 100644 index 0000000..fa0db9e --- /dev/null +++ b/plans/implementation/tls-identity/329-h3-send-window-bound.md @@ -0,0 +1,235 @@ +# TLS Identity Milestone 329 - H3 send-window bound + +Status: implemented + +Repository baseline: `e9c98a0` (`main` after PR #6; clean tree) + +Source roadmap: + +- `plans/subsystems/tls-identity-roadmap.md#7` (Milestone 329) + +Long-term requirements: + +- `plans/000-long-term-specification.md#2` (neutral `eggnet-tls` ownership) +- `plans/000-long-term-specification.md#3` (invariants) +- `plans/000-long-term-specification.md#4` (TLS identity remains experimental) + +Applicable ADRs: + +- none + +Primary class: invariant + +## 1. Objective + +Close the remaining low finding from milestone 327 +(`plans/closure/tls-identity/327-tls-substrate-corrective.md` section 13): +`Http3Config::validate` rejects only zero for `send_window`, even though +quinn documents that field as the per-connection retained-write memory cap, and it +rejects only zero for `max_send_buf_size`, while the sibling receive windows and the +HTTP/2 send-buffer ceiling are bounded above. + +## 2. Why this milestone is ready + +No dependency blocks it: the fields, the validator, and the unit-test module already +exist in `eggserve-h3`, and the only open decision is the ceiling. The in-repo +precedent settles it: `http2.max_send_buf_size` is a local buffer ceiling bounded to +`1..=u32::MAX`, and the QUIC VarInt ceiling (`2^62-1`) applies to fields that are +encoded on the wire. `send_window` is not a wire field, so the VarInt ceiling would +document the wrong invariant. No public type, dependency, or wire change is needed, +and H3 remains experimental. + +## 3. Current implementation evidence + +- `crates/eggserve-h3/src/config.rs:108-113` rejects `0` for both fields and names + each one; there is no upper bound on either. +- `crates/eggserve-h3/src/config.rs:90` and `:96` bound the two receive windows to + `QUIC_VARINT_MAX`; `:114-120` bounds `max_idle_timeout` the same way. +- `crates/eggserve-h3/src/config.rs:31` declares `send_window: u64`; `:39` declares + `max_send_buf_size: usize`; defaults are 4 MiB and 256 KiB at `:57` and `:61`. +- `crates/eggserve-h3/src/quic.rs:59` passes `send_window` straight into + `quinn::TransportConfig::send_window` with no intermediate bound. +- `quinn-proto` 0.11.19 `src/config/transport.rs:130-140` documents `send_window` as + "Maximum number of bytes retained from application writes across all streams of + a connection" and tells endpoints to set it "low enough to avoid memory exhaustion + if every connection uses the entire window". +- `crates/eggserve-h3/src/response.rs:299-302` uses `max_send_buf_size` only as a + chunk size clamped by the shared `stream_chunk_size`, so it cannot allocate above + that shared ceiling today; its missing upper bound is preventive, not a live + exposure. +- `crates/eggserve-core/src/server/config/http2.rs:104` bounds the HTTP/2 + `max_send_buf_size` to `1..=u32::MAX` - the in-repo precedent for a local buffer + ceiling, as distinct from a VarInt wire value. +- `architecture/http3.md:103` describes `send_window` as "QUIC outbound flow-control + budget", which reads as a congestion-control knob rather than the retained-write + memory cap quinn implements. + +## 4. Invariants that must not regress + +- QUIC VarInt wire fields stay bounded by `QUIC_VARINT_MAX` (`2^62-1`): both receive + windows and `max_idle_timeout`. +- Defaults are unchanged: `send_window` 4 MiB, `max_send_buf_size` 256 KiB. +- Zero stays rejected for both fields, each naming itself. +- No application 0-RTT, TLS 1.3-only QUIC, no migration, no stateless-retry change. +- H3 stays experimental; no CLI or Python knob is added. +- No key or certificate material appears in any error, Debug, or event. + +## 5. Scope + +### In scope + +- An upper bound for `send_window` and `max_send_buf_size` at `u32::MAX`. +- Field-named diagnostics and field documentation stating the ceiling and semantics. +- Unit tests at, and above, the ceiling for both fields. +- `architecture/http3.md` semantics and ceiling, `CHANGELOG.md`, roadmap and + registry records, and the 327 section 13 resolution pointer. + +### Explicitly out of scope + +- Treating `send_window` as a wire-encoded VarInt bound. +- Any new CLI or Python configuration surface. +- Changing quinn transport policy, congestion control, or any default. +- Coupling `send_window` to `stream_receive_window` or adding cross-field ratios. + +## 6. Required production changes + +`eggserve-h3::config::Http3Config::validate`: + +- Reject `send_window == 0 || send_window > u64::from(u32::MAX)` with + `http3.send_window` and the accepted range in the message. +- Reject `max_send_buf_size == 0 || max_send_buf_size > u32::MAX as usize` with + `http3.max_send_buf_size` and the accepted range in the message (the cast matches + the existing HTTP/2 check and is lossless on the 32- and 64-bit targets the + workspace supports). +- Document on both fields that they are local memory ceilings, not wire values, and + what quinn does with each. + +No new error type: the existing `ServerError::Config` `invalid(field, detail)` closure +carries the diagnostic. + +## 7. Ordered work packages + +### Work package A - Bounds and diagnostics + +Intent: no configuration can disable quinn's per-connection retained-write cap or +exceed the local buffer ceiling the HTTP/2 twin already enforces. + +Required changes: the two range checks in `validate` and the field doc comments. + +Acceptance evidence: an out-of-range value is rejected with the field named and the +range stated; the ceiling value is accepted. + +### Work package B - Unit tests + +Intent: the pre-fix behavior fails deterministically for both fields. + +Required changes: `crates/eggserve-h3/src/config.rs` tests covering +`send_window` and `max_send_buf_size` above the ceiling and at the ceiling, plus a +default-config validity assertion. + +Acceptance evidence: before the fix, the above-ceiling cases validate successfully. + +### Work package C - Documentation and records + +Intent: the documented meaning and bound match the enforced behavior, and 327's +open finding is closed by this milestone's closure record. + +Required changes: `architecture/http3.md` rows for both fields, +`CHANGELOG.md`, the roadmap and registry entries, and the 327 section 13 pointer. + +## 8. Failure, cancellation, restart, and contention semantics + +Validation is pure and runs before any endpoint exists: `RuntimeConfig::validate` +calls `Http3Config::validate` when H3 is enabled, `ServerBuilder::build` invokes it, +and `Server::start` re-runs it at `crates/eggserve-core/src/server/mod.rs:601` before +the H3 endpoint is assembled at `:700`. A rejected configuration therefore fails +startup with `ServerError::Config` before the UDP socket is bound, with no partial +endpoint and no state to unwind. There is no lock, task, or reload interaction on +this path. + +## 9. Compatibility and migration + +- A value above `u32::MAX` (4 GiB - 1) is now rejected where it was previously accepted. `Http3Config` + is reachable only from Rust, H3 is experimental, and the defaults are unchanged. +- Field types, the error type, and the public surface are unchanged; no variant is + added. +- A caller that deliberately set an unbounded send window must clamp to + `u32::MAX` or keep the 4 MiB default; neither the CLI nor Python exposes H3 + transport knobs. + +## 10. Required tests + +### Unit tests (`eggserve-h3`) + +- `send_window` one byte above the ceiling is rejected and names + `http3.send_window`; the ceiling value is accepted. +- `max_send_buf_size` one above the ceiling is rejected and names + `http3.max_send_buf_size`; the ceiling value is accepted. +- The default configuration validates, and the existing + `zero_send_buf_size_names_its_own_field`, `quic_window_bounds_are_validated`, and + `quic_idle_timeout_bound_is_validated` stay green. + +### Integration and feature shape + +- `cargo test -p eggserve-core --features http3,tls --lib` stays green (the config + projection is unchanged). +- `cargo test -p eggserve-core --features http3,tls --test http3_runtime` stays green + (the endpoint path consumes the validated config). + +## 11. Required verification commands + +```bash +cargo fmt --all -- --check +cargo test -p eggserve-h3 +cargo test -p eggserve-core --features http3,tls --lib +cargo test -p eggserve-core --features http3,tls --test http3_runtime +cargo clippy -p eggserve-h3 --all-targets -- -D warnings +cargo clippy -p eggserve-core --features http3,tls --lib --tests -- -D warnings +cargo check --workspace --all-targets --features http3,tls +cargo +1.89 check --workspace --all-targets --features http3,tls +git diff --check +python3 scripts/check-crate-topology.py +``` + +## 12. Documentation updates + +- `architecture/http3.md`: `send_window` describes the retained-write memory cap + rather than a flow-control budget; both rows state the `u32::MAX` ceiling and + distinguish it from the VarInt receive-window bound. +- `CHANGELOG.md`: an Unreleased bullet recording the H3 buffer-ceiling validation + and that it closes the 327 follow-up finding. +- `plans/subsystems/tls-identity-roadmap.md` and `plans/registry.md`: milestone 329. +- `plans/closure/tls-identity/327-tls-substrate-corrective.md` section 13: a pointer + that milestone 329 owns the finding, replaced by "resolved by 329" when its closure + record lands. + +## 13. Acceptance criteria + +1. `send_window > u32::MAX` is rejected with `http3.send_window` named and the + accepted range stated; `send_window == u32::MAX` validates. +2. `max_send_buf_size` above `u32::MAX` is rejected with + `http3.max_send_buf_size` named; the ceiling value validates. +3. Zero remains rejected for both fields, each named correctly. +4. The default configuration validates, and the defaults are unchanged. +5. No CLI or Python surface changes, and H3 remains experimental. +6. The 327 closure's section 13 finding is marked resolved by 329's closure record. + +## 14. Stop conditions + +Stop and report if the bound requires changing a field type, adding a public error +type or configuration knob, changing a default, or if any in-tree or documented +configuration legitimately needs a value above `u32::MAX`. + +## 15. Closure evidence required + +The exact commands and outcomes, the test names, the chosen ceiling with its +rationale (local buffer ceiling versus VarInt wire value), the documentation +updates, and the 327 section 13 annotation replacing the ownership pointer with the +resolution. + +## 16. Handoff notes + +The `max_send_buf_size` clamp through `stream_chunk_size` means today's exposure is +limited; the bound is preventive and keeps the two local buffer ceilings consistent +with the HTTP/2 twin. The QUIC wire fields keep their VarInt ceiling, so the two +classes of bound must not be merged. diff --git a/plans/registry.md b/plans/registry.md index 1eec3ca..682d049 100644 --- a/plans/registry.md +++ b/plans/registry.md @@ -9,7 +9,7 @@ Canonical direction remains in: - `plans/002-long-term-roadmap.md` - `plans/003-planning-process.md` -New milestone numbers continue from `329`. Legacy flat plans (`000`–`292`) and `release/plan-*.md` are archived in place and immutable. +New milestone numbers continue from `330`. Legacy flat plans (`000`–`292`) and `release/plan-*.md` are archived in place and immutable. ## Status vocabulary @@ -34,7 +34,7 @@ Dependency vocabulary: **hard / interface / soft / operational** (`003-planning- | Planning governance | active | `plans/subsystems/planning-governance-roadmap.md` | 314 publication-state staleness sweep | Milestones 1 and 302 closed. Reopened: six surfaces still describe the published 0.4.0 line as pending, including the agent-facing skill. Interface dependency: 304's closure record supplies the facts. | | Python facade | active | `plans/subsystems/python-facade-roadmap.md` | 322 streamed-response producer bounds (closed) | Milestone 311 is closed: the bridge's second listing renderer is gone and the 1 MiB response-byte ceiling now applies to the Python path. A post-audit security pass added 322: streamed-response producers are detached per response and not bounded by the callback permit, and the empty-yield branch does not observe receiver closure. Plan 322 is closed, with the record under `plans/closure/python-facade/`. | | CLI, ops, and observability | active | `plans/subsystems/cli-ops-observability-roadmap.md` | 320 QUIC advisory remediation (closed); 323 post-audit hygiene sweep (closed); 325 compatible dependency refresh (closed); 326 public-bind acknowledgment tightening (closed) | 312 closed the routine Windows/macOS compile coverage. 313 closed the lint policy: `missing_docs` and `clippy::undocumented_unsafe_blocks` are enforced in the root lint table, with lanes for the Python-internal feature, the excluded Python crate, and the Windows confinement boundary. 315 closed the dependency specification consolidation: a root `[workspace.dependencies]` table owns the shared versions and the `rustls` floor, with all three lockfiles byte-identical. 318 closed the `rustls` floor guard. A post-audit security pass added 320 (Quinn/`rustix`/`tokio` advisories and an offline floor guard) and 323 (operator documentation and repository hygiene); both are closed, with records under `plans/closure/cli-ops-observability/`. Plan 325 is closed: all three latest-compatible lockfiles are refreshed and aligned, the audit tools are current, and audits, denies, floors, MSRV, and required test suites pass with the documented macOS skip. Upstream transitive feature-tree differences and the `verify.sh fast` wrapper's macOS skip limitation are recorded in the closure. No product-source or release change. Plan 326 (allocated on the feature branch, originally 320) widens the acknowledgment requirement to any non-loopback bind without changing the flag's acknowledgment-only semantics. | -| TLS identity | active | `plans/subsystems/tls-identity-roadmap.md` | 328 reload ALPN coherence (closed) | 327 corrected five seam defects at `26649bd` (provider panic, ALPN/runtime disagreement, CLI timeout mismatch, identity-cap order dependence, H3 transport-bound diagnostics) without a tier or default change. Its follow-up security review found that a running server's reload swap still accepted an h2 advertisement on an HTTP/2-disabled runtime; 328 enforces the check at the swap with the previous identity live. Originally allocated 321/322 on the feature branch and renumbered when the post-audit batch landed 320–325. Closures: `plans/closure/tls-identity/327-tls-substrate-corrective.md`, `plans/closure/tls-identity/328-reload-alpn-coherence.md`. | +| TLS identity | active | `plans/subsystems/tls-identity-roadmap.md` | 328 reload ALPN coherence (closed); 329 H3 send-window bound (closed) | 327 corrected five seam defects at `26649bd` (provider panic, ALPN/runtime disagreement, CLI timeout mismatch, identity-cap order dependence, H3 transport-bound diagnostics) without a tier or default change. Its follow-up security review found that a running server's reload swap still accepted an h2 advertisement on an HTTP/2-disabled runtime; 328 enforces the check at the swap with the previous identity live. Originally allocated 321/322 on the feature branch and renumbered when the post-audit batch landed 320–325. Closures: `plans/closure/tls-identity/327-tls-substrate-corrective.md`, `plans/closure/tls-identity/328-reload-alpn-coherence.md`. Milestone 329 (closed) bounds the H3 send-window retained-write cap and `max_send_buf_size` at `u32::MAX`, closing 327's remaining low finding; closure: `plans/closure/tls-identity/329-h3-send-window-bound.md`. | | Docs architecture (overview index + deep dives) | closed | `plans/subsystems/docs-architecture-roadmap.md` | 301 closed (overview + deep dives refreshed to 0.4.0 baseline) | Trace: `plans/closure/docs-architecture/293-architecture-overview-deep-dive-refresh.md`. Interface: closed 294–299 code state + Plan 300 publication as review input. | ## Dependency-ready implementation plans @@ -77,6 +77,7 @@ Dependency vocabulary: **hard / interface / soft / operational** (`003-planning- | CLI, ops, and observability | 326 | closed | `plans/implementation/cli-ops-observability/326-public-bind-acknowledgment-hardening.md` | Non-loopback binds require `--public`/`public=True`; acknowledgment-only semantics and the loopback default are unchanged. Originally allocated 320 on the feature branch before the post-audit batch claimed that number. Closure: `plans/closure/cli-ops-observability/326-public-bind-acknowledgment-hardening.md`. | | TLS identity | 327 | closed | `plans/implementation/tls-identity/327-tls-substrate-corrective.md` | The five reviewed defects are corrected with regression tests; Python/MSRV/clippy lanes pass. Closure: `plans/closure/tls-identity/327-tls-substrate-corrective.md`. The static canonicalization failure recorded there was fixed upstream by Plan 323; only the platform-specific `eggserve-server` test remains local-only. | | TLS identity | 328 | closed | `plans/implementation/tls-identity/328-reload-alpn-coherence.md` | `ServerHandle::replace_tls_config` rejects an h2-advertising snapshot when the runtime cannot serve HTTP/2, before the swap, leaving the previous identity live; `tls_identity::reload_rejects_h2_alpn_when_http2_disabled` fails on the earlier behavior. The raw `TlsReloadHandle` accessor remains a documented bypass. Closure: `plans/closure/tls-identity/328-reload-alpn-coherence.md`. | +| TLS identity | 329 | closed | `plans/implementation/tls-identity/329-h3-send-window-bound.md` | **Low.** `Http3Config.send_window` (quinn's per-connection retained-write memory cap) and `max_send_buf_size` are bounded to `1..=u32::MAX`, matching `http2.max_send_buf_size`, with field-named diagnostics and unit tests at and above the ceiling; the QUIC VarInt ceiling stays on the wire-encoded fields. Closes the remaining 327 low finding recorded in its closure section 13. No CLI/Python surface, default, tier, or wire change. Closure: `plans/closure/tls-identity/329-h3-send-window-bound.md`. | ## Blocked work diff --git a/plans/subsystems/tls-identity-roadmap.md b/plans/subsystems/tls-identity-roadmap.md index a20bd86..b3d3a9e 100644 --- a/plans/subsystems/tls-identity-roadmap.md +++ b/plans/subsystems/tls-identity-roadmap.md @@ -71,9 +71,11 @@ A capability review at baseline `26649bd` found five defects at the seams: The follow-up security review of 327 found one more seam: a running server's reload swap accepted an h2 advertisement while HTTP/2 was disabled, and the accept loop then completed every h2 client's handshake before dropping it. Milestone 328 enforces the coherence check at the swap. +The post-merge review of 327 found one remaining low finding: `Http3Config` bounded `send_window` only against zero even though quinn documents it as the per-connection retained-write memory cap, and it bounded `max_send_buf_size` only against zero. Milestone 329 closed it by bounding both local buffer ceilings at `u32::MAX`, keeping the QUIC VarInt ceiling for wire-encoded fields. + ## 5. Target architecture -Every rustls server configuration is built with an explicit `Arc` (ring), matching the provider already used for key/cert pairing. The compatibility runtime validates the effective TLS ALPN set (static or reload snapshot) against its HTTP/2 capability before serving, and the server handle rejects a contradictory snapshot at the reload swap. The CLI's documented header timeout governs both header reads and TLS handshakes. The identity builder enforces one order-independent ceiling for named SNI identities, with the optional default separate. H3 validates transport bounds in `Http3Config::validate` and reports transport-specific failures through a dedicated typed error. +Every rustls server configuration is built with an explicit `Arc` (ring), matching the provider already used for key/cert pairing. The compatibility runtime validates the effective TLS ALPN set (static or reload snapshot) against its HTTP/2 capability before serving, and the server handle rejects a contradictory snapshot at the reload swap. The CLI's documented header timeout governs both header reads and TLS handshakes. The identity builder enforces one order-independent ceiling for named SNI identities, with the optional default separate. H3 validates transport bounds in `Http3Config::validate` and reports transport-specific failures through a dedicated typed error. The two H3 local buffer ceilings (`send_window`, `max_send_buf_size`) are bounded at `u32::MAX`, distinct from the VarInt bound on wire-encoded receive windows and idle timeout. ## 6. Dependency graph @@ -81,10 +83,12 @@ Every rustls server configuration is built with an explicit `Arc | +--> Milestone 328 reload ALPN coherence (closed) | + +--> Milestone 329 H3 send-window bound (closed) + | +--> future SNI/mTLS capability milestones (soft) `--> H2/H3 transport milestones (soft; ALPN coherence shared) -Milestone 327 has no hard dependency; milestone 328 takes 327's shared ALPN predicate as an interface dependency and is closed. +Milestone 327 has no hard dependency; milestone 328 takes 327's shared ALPN predicate as an interface dependency and is closed. Milestone 329 has no hard dependency and is closed; it closed 327's remaining low finding. ## 7. Milestones @@ -120,6 +124,22 @@ Exit conditions: the acceptance criteria in `plans/implementation/tls-identity/3 Deferred work: making the neutral `TlsReloadHandle` runtime-aware; the raw accessor remains a documented bypass. +### Milestone 329 - H3 send-window bound + +Class: invariant + +Objective: bound the two H3 local buffer ceilings at `u32::MAX`, so `send_window` cannot disable quinn's per-connection retained-write memory cap and `max_send_buf_size` matches the HTTP/2 ceiling, closing 327's remaining low finding. + +Dependencies: none; the fields, validator, and unit-test module already exist in `eggserve-h3`, and 327's closure section 13 supplies the finding. + +Deliverable boundary: the two range checks and field docs in `Http3Config::validate`, unit tests at and above the ceiling, `architecture/http3.md` semantics, and the 327 finding pointer. + +User or operator value: an embedding that sets an extreme H3 buffer budget is rejected at startup with the field named, instead of silently disabling the memory cap quinn relies on. + +Exit conditions: the acceptance criteria in `plans/implementation/tls-identity/329-h3-send-window-bound.md` pass and this closure record is written. + +Deferred work: coupling `send_window` to the receive windows; treating either value as a wire-encoded VarInt bound. + ## 8. Cross-cutting requirements ### Protocol and compatibility @@ -163,3 +183,4 @@ The subsystem is complete when configuration construction is provider-determinis |---|---|---|---|---| | 327 | closed | `plans/implementation/tls-identity/327-tls-substrate-corrective.md` | `plans/closure/tls-identity/327-tls-substrate-corrective.md` | none | | 328 | closed | `plans/implementation/tls-identity/328-reload-alpn-coherence.md` | `plans/closure/tls-identity/328-reload-alpn-coherence.md` | none | +| 329 | closed | `plans/implementation/tls-identity/329-h3-send-window-bound.md` | `plans/closure/tls-identity/329-h3-send-window-bound.md` | none |