Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions quest/a0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ The Required list is ordered by priority. Independent children may proceed concu

- [Quiche lifecycle](/quest/a0/quiche/README.md) - deterministic harness and retirement handling
- [Node session and reader lifetime](/quest/a0/node-session-lifetime.md) - `closed` rejects on an abnormal end, and an abandoned reader releases its stream
- [QMux receive credit](/quest/a0/qmux-recv-credit.md) - stopped or dropped streams return their connection flow-control credit
25 changes: 25 additions & 0 deletions quest/a0/qmux-recv-credit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# [M] Return connection credit for stopped QMux receive streams

## Goal

Stopping or dropping a Rust QMux `RecvStream` with unread data no longer shrinks the connection's `MAX_DATA` window. Per RFC 9000 §4.5, every byte the peer sent on a stopped stream, up to its final size, is credited back to connection flow control exactly once, so abandoned streams can never wedge a healthy session.

Ships on `main` as the next `qmux` 0.6.x patch. No `qmux-v0.5.x` backport. The TypeScript QMux is out of scope. It credits the bytes buffered at cancel, but it then deletes the receive entry, so STREAM data and RESET_STREAM gaps that arrive after cancel still leak there.

## Plan

Three paths leak in `rs/qmux/src/session.rs` today; `report_consumed` only runs on application reads:

- Unread bytes at `stop()` or `Drop`: the unread remainder of the current chunk plus whatever is still queued in `inbound_data`.
- STREAM data that arrives after STOP_SENDING. The writer task removes the recv entry when STOP_SENDING is queued, so late data is then either ignored before connection credit is counted (peer-initiated) or counted and never returned (locally initiated).
- The RESET_STREAM gap for an entry that has already been removed; it is never charged or credited.

Decision: keep the stream's receive state after a local stop until its final size is known, as moq-dev/moq's `moq-quic` does. Do not only credit the bytes buffered at stop, because late data would still leak. On stop or drop, credit the unread and queued bytes. While the entry is stopped, count late STREAM data as received and credit it immediately, and credit the RESET_STREAM gap, then retire the entry on FIN or reset. A peer-initiated stream returns its MAX_STREAMS credit when its entry retires, not when the `RecvStream` drops, so a peer that withholds FIN and RESET_STREAM cannot grow the retained state past the stream limit. A duplicate or late frame after retirement must not double-count, which preserves the existing post-terminal ignore and duplicate-RESET rules. The writer task's STOP_SENDING removal and the session task's lookups race today (see the comments at the STREAM and RESET_STREAM handlers), so the stopped state must close that race rather than add a new one.

Regression tests, which fail without the fix: the reporter's scenario, where the peer writes more than half the stream window into each of N streams, each `RecvStream` is dropped unread, and a fresh stream still receives data; late data after STOP_SENDING; and a reset gap after a local stop. The draft-00/01 (non-QMux) paths have no connection flow control and must stay unchanged.

Reference: moq-dev/moq's equivalent tests, `rs/moq-quic/src/connection/mux/tests.rs` `credit_returns_for_unread_and_stopped_streams` and `rs/moq-quic/src/tests/characterize/reset.rs` `stop_returns_connection_credit`.

## Closes

- [#507](https://github.com/moq-dev/web-transport/issues/507) - stopped/dropped RecvStream leaks connection flow-control credit
2 changes: 2 additions & 0 deletions quest/a1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ The Required list is ordered by priority. Independent children may proceed concu
- [Binding runtime coverage](/quest/a1/bindings/README.md) - independent language jobs
- [Node idle configuration](/quest/a1/node-idle/README.md) - typed native input and Node options
- [Response headers](/quest/a1/response-headers.md) - preserve success and rejection metadata
- [Rust platform verifier](/quest/a1/platform-verifier.md) - `with_system_roots()` verifies with the OS trust store
- [FFI platform verifier](/quest/a1/ffi-platform-verifier.md) - bindings verify on iOS and Android
- [Package selection](/quest/a1/package-selection.md) - verified comparison and selection guide
25 changes: 25 additions & 0 deletions quest/a1/ffi-platform-verifier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# [M] Verify FFI clients with the OS platform verifier

## Goal

Python, Kotlin and Swift clients that use default verification (neither certificate hashes nor disabled verification) verify servers with the OS trust store on every platform, including iOS and Android. Today `rs/web-transport-ffi/src/client.rs` loads `rustls-native-certs`, which finds no roots on iOS and likely none on Android, so those clients cannot verify any server.

## Plan

Follow moq-dev/moq#1968. The FFI client verifies with rustls-platform-verifier on its existing provider, and `rustls-native-certs` is dropped. On Android, add a `JNI_OnLoad` that initializes the platform verifier from the application Context (moq uses `android.app.ActivityThread.currentApplication()`), clearing any pending JNI exception so loading the library never fails. Until initialization succeeds, Android falls back to bundled webpki-roots and logs a warning. The fallback is Android-only.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

`JNI_OnLoad` alone is not enough on Android:

- JNA can load the library without running `JNI_OnLoad`. The Kotlin Android code must guarantee initialization before the first client, for example by loading the library through `System.loadLibrary`.
- `currentApplication()` returns null if the library loads before the Application exists. Retry initialization when each client is built. A client built during the fallback keeps webpki-roots.
- rustls-platform-verifier needs its Android Kotlin component at runtime. Ship it in the Android artifact with its shrinker keep rules, and document the same setup for Rust users on Android.

Update the Kotlin and Swift READMEs where they describe verification. Python, Kotlin and Swift share the `web-transport-ffi-v*` release.

## Closes

- [#506](https://github.com/moq-dev/web-transport/issues/506) - support for the platform verifier
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

## Related

- [Rust platform verifier](/quest/a1/platform-verifier.md) - the same switch in the Rust builders
18 changes: 18 additions & 0 deletions quest/a1/platform-verifier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# [S] Verify system roots with the OS platform verifier

## Goal

`ClientBuilder::with_system_roots()` in web-transport-quinn and web-transport-noq verifies server certificates with rustls-platform-verifier, so the OS trust store decides, including custom enterprise roots and revocation where the OS supports them. The generic `web-transport` builder and the Node binding inherit this through web-transport-quinn. The method names stay the same; the PR reports the behavior change.

## Plan

Follow moq-dev/moq#1968, which made the same switch in moq-native. Replace the `rustls_native_certs` root loading in both builders with the platform verifier on the crate's existing provider (`crypto::default_provider()`), so rind stays the default provider. Drop the `rustls-native-certs` dependency from both crates. Also drop quinn's and noq's `platform-verifier` feature, which nothing uses: it only enables `ClientConfig::try_with_platform_verifier`, which bypasses this crate's provider-neutral crypto adapter.

The FFI client does not use these builders and is handled in [FFI platform verifier](/quest/a1/ffi-platform-verifier.md). Android needs JNI initialization that only that quest provides. Here, document in the builders that on Android the platform verifier requires app initialization.

Coordinate with [Noq on rind](/quest/a1/rind/noq.md), which rewrites the noq client builder; whichever lands second resolves the conflict. Update the crate READMEs and doc comments that describe `with_system_roots()`.

## Related

- [Issue #506](https://github.com/moq-dev/web-transport/issues/506) - platform verifier support; closed by the FFI quest
- [FFI platform verifier](/quest/a1/ffi-platform-verifier.md) - same switch for the language bindings
Loading