Repository navigation
quest: import #507 and #506; close #460 as moq-owned #508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0abedcd
quest: import #507 and #506; close #460 as moq-owned
kixelated 666ceb8
fix(nix): pin bindgen to the shell's libclang
kixelated 694ca67
quest: address review on QMux credit and FFI verifier plans
kixelated f72c6c5
Merge remote-tracking branch 'origin/main' into quest-import/recv-cre…
kixelated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
|
|
||
| `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 | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| ## Related | ||
|
|
||
| - [Rust platform verifier](/quest/a1/platform-verifier.md) - the same switch in the Rust builders | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.