diff --git a/.oss-scanner/threat_model.md b/.oss-scanner/threat_model.md index bb7380a1d32..3e3c4f9413c 100644 --- a/.oss-scanner/threat_model.md +++ b/.oss-scanner/threat_model.md @@ -19,7 +19,7 @@ Treat everything a peer sends as hostile, before and after authentication: The relay is deployed on the public internet as shared infrastructure: one process serves many unrelated tenants, most of them anonymous or holding a token from a third party's auth server. Attack these properties: - **Untrusted network input, bounded cost.** Whatever a peer sends, the memory, CPU, and state it makes the other side hold must be bounded. A peer that can grow relay memory or CPU without bound, past the configured per-session limits (`rs/moq-relay/src/limits.rs`), is a bug even when it takes many messages to do. Fan-out is the multiplier to look for: one publisher's bytes, or one subscriber's request, reaching many sessions or pinning cache. -- **Encryption.** Every transport is TLS 1.3 via rustls with aws-lc: QUIC and WebTransport, and WebSocket over `[web.https]`. Certificates are loaded from disk or self-signed and pinned by the fingerprint at `/certificate.sha256`. Check whether the relay accepts 0-RTT, and if it does, whether early data can be replayed. Plain `[web.http]` is a documented development option, not a finding. +- **Encryption.** Every transport is TLS 1.3 via rustls with rind: QUIC and WebTransport, and WebSocket over `[web.https]`. Certificates are loaded from disk or self-signed and pinned by the fingerprint at `/certificate.sha256`. Check whether the relay accepts 0-RTT, and if it does, whether early data can be replayed. Plain `[web.http]` is a documented development option, not a finding. - **Authentication.** Sessions are admitted by a JWT (`moq-auth`, which accepts HMAC, RSA, ECDSA and EdDSA keys, so algorithm confusion and key selection are in scope), by an external auth server over HTTP (`doc/bin/relay/auth.md`), by a verified client certificate weighed by that server, or by a static anonymous grant. Expiry, revalidation, and in-band renewal must never extend a grant past what the server issued, and a failure to reach the auth server must refuse rather than admit. - **Multi-tenancy.** A grant's `root` scopes a session to one subtree; `mounts` add read-only views. A session must never publish, subscribe, receive announcements, fetch, or see stats outside its grant, whether through path normalization, pattern matching (`moq-pattern`), the HTTP endpoints, cluster forwarding, or a revalidation that changes the grant mid-session. One tenant must not be able to degrade another beyond its fair share, for example by exhausting a shared cache or a shared connection limit. - **Cache integrity.** The relay caches and forwards groups by broadcast, track, and group. A publisher must not be able to overwrite or inject into a broadcast it was not granted, and a subscriber must never receive one tenant's data under another tenant's name. diff --git a/Cargo.lock b/Cargo.lock index 30664a706b5..0f65c5f6d73 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4507,7 +4507,6 @@ dependencies = [ "pollster", "reqwest", "rind-object-store", - "rind-rustls", "rustls", "sd-notify", "serde", diff --git a/deny.toml b/deny.toml index c91717894c1..1dc8c216e4c 100644 --- a/deny.toml +++ b/deny.toml @@ -11,7 +11,7 @@ yanked = "deny" ignore = [ # rsa 0.9.x Marvin Attack: test-only compatibility fixtures use published # moq-auth 0.2.1 and moq-token 0.7, which still depend on rsa. Production - # key generation and signing use aws-lc-rs; no normal/build graph holds rsa. + # key generation and signing use rind; no normal/build graph holds rsa. "RUSTSEC-2023-0071", # paste is unmaintained (proc-macro, build-time only). Pulled by diff --git a/doc/lib/rs/index.md b/doc/lib/rs/index.md index 3a74e86a022..5ba77ae874b 100644 --- a/doc/lib/rs/index.md +++ b/doc/lib/rs/index.md @@ -18,8 +18,6 @@ Transport cryptography comes from [rind](https://github.com/moq-dev/rind). It supports every x86\_64 CPU, aarch64 with NEON (including Raspberry Pi 4, CM4, and Zero 2 W without crypto extensions), and armv7. Setup reports a missing required CPU feature before starting transport cryptography. -`aws-lc-rs` and `ring` are no longer `moq-tokio` or `moq-quic` features; -remove them from dependency declarations. ## Crates diff --git a/quest/m1/rind/README.md b/quest/m1/rind/README.md index 7d2167751d2..10f64ab8fe5 100644 --- a/quest/m1/rind/README.md +++ b/quest/m1/rind/README.md @@ -65,6 +65,5 @@ The epic's own work, once every child has merged: ## Required -- [Transport on rind](/quest/m1/rind/transport.md) - moq-quic, moq-tokio, moq-uring, moq-rtmp, and qmux take rind, and the `aws-lc-rs`/`ring` features go - [One typed unsupported-CPU error](/quest/m1/rind/cpu-error.md) - moq-auth, moq-hls and moq-crypto e2ee carry `moq_crypto::provider::UnsupportedCpu` and drop their own CPU-check helpers - [moq-rtc on rind](/quest/m1/rind/rtc.md) - str0m and dimpl run DTLS, SRTP, and STUN on rind diff --git a/quest/m1/rind/cpu-error.md b/quest/m1/rind/cpu-error.md index eb346d78695..ad97978fe4a 100644 --- a/quest/m1/rind/cpu-error.md +++ b/quest/m1/rind/cpu-error.md @@ -14,13 +14,13 @@ any other failure by its type, the same way in every crate. ## Plan Planned 2026-11-04 with the maintainer, from the suggested follow-up of -[moq-dev/moq#7873](https://github.com/moq-dev/moq/pull/7873) -([Transport on rind](/quest/m1/rind/transport.md)). That PR adds the -`provider` feature to moq-crypto, holding `provider::UnsupportedCpu` -(`Clone + Copy + Eq`, wrapping rind's `MissingFeature` privately), and moves -moq-quic, moq-tokio, qmux and moq-uring onto it as -`UnsupportedCpu(#[from] ...)` with `#[error(transparent)]`. This quest does -the same for the three crates it left, so it starts once that PR lands. +[moq-dev/moq#7873](https://github.com/moq-dev/moq/pull/7873), which moved +the transport crates to rind. That PR added the `provider` feature to +moq-crypto, holding `provider::UnsupportedCpu` (`Clone + Copy + Eq`, wrapping +rind's `MissingFeature` privately), and moved moq-quic, moq-tokio, qmux and +moq-uring onto it as `UnsupportedCpu(#[from] ...)` with +`#[error(transparent)]`. This quest does the same for the three crates it +left. - ✅ #7873 lands as is, with the type in `provider`; this quest moves it later (maintainer, 2026-11-04, on @@ -47,7 +47,3 @@ the same for the three crates it left, so it starts once that PR lands. Public API: breaking for moq-auth, moq-hls and moq-crypto (the variants' payload type, and e2ee's variant name). Each gets a `## Unreleased` note in its `MIGRATE.md`. Wire: none. - -## Required - -- [Transport on rind](/quest/m1/rind/transport.md) - adds `moq_crypto::provider::UnsupportedCpu`, which this wraps diff --git a/quest/m1/rind/transport.md b/quest/m1/rind/transport.md deleted file mode 100644 index 80eb2c2cb7b..00000000000 --- a/quest/m1/rind/transport.md +++ /dev/null @@ -1,47 +0,0 @@ -# [S] Finish transport on rind - -## Goal - -moq-quic, moq-tokio, moq-uring, moq-rtmp, qmux, and moq-relay's own HTTP and -TLS use rind, without selecting aws-lc or ring. Remove moq-tokio's and -moq-quic's provider features and report unsupported CPU features at setup. -No wire format changes. - -## Plan - -The settled migration is implemented in -[moq-dev/moq#7873](https://github.com/moq-dev/moq/pull/7873), with migration -notes and certificate/provider test sites updated together. rind 0.1.12 -supports older x86_64 CPUs without crypto extensions, aarch64 with NEON -(including Pi 4, CM4, and Zero 2 W without crypto extensions), and armv7. -The epic owns the final workspace crypto graph guard; WebRTC consolidation -and signing remain in their separate areas. - -Public error contract, decided by the maintainer on 2026-11-04: - -- ✅ Introduce a shared typed crypto error, and make `crypto::provider()` and - `crypto::install_default()` fallible, with MIGRATE notes for the broader - API migration. This replaces `moq_quic::ConfigError::Crypto(String)` and - `moq_tokio::tls::Error::Crypto(String)`. -- Not chosen: keeping `Crypto(String)` with the existing infallible - provider-helper signatures. - -Placement of the shared error, decided by the maintainer on 2026-11-04: - -- ✅ In `moq-crypto`, behind a new `provider` feature holding - `UnsupportedCpu`, `check()`, `provider()` and `install_default()`. It - depends only on rind and rustls, never on moq-net, so moq-quic, moq-tokio, - qmux and moq-uring use it without a cycle, and net-only builds gain only - that feature's dependencies. rind stays private: the error wraps rind's - `MissingFeature` instead of re-exporting it. -- Not chosen: re-exporting rind's `MissingFeature`; defining the error in - moq-quic and requiring moq-quic from moq-tokio; a brand-new crate. - -Complete the PR's local validation and cross-vendor review before marking -it ready. Keep every existing test in CI, at least nightly; do not disable a -flaky test to satisfy checks. This follows the user's explicit requirement -over the repository's immediate-disable instruction. - -## Related - -- [MoQ on rind](/quest/m1/rind/README.md) - the settled provider and CPU support decisions diff --git a/rs/moq-cli/Cargo.toml b/rs/moq-cli/Cargo.toml index 5855b6af1dd..47153eaeef2 100644 --- a/rs/moq-cli/Cargo.toml +++ b/rs/moq-cli/Cargo.toml @@ -131,8 +131,6 @@ percent-encoding = { workspace = true } pollster = { workspace = true, optional = true } reqwest = { workspace = true, features = ["rustls-no-provider", "json"] } rind-object-store = { workspace = true, optional = true } -# The process default rustls provider, which reqwest, axum-server, and object_store read. -rind-rustls = { workspace = true } rustls = { version = "0.23", default-features = false, features = ["std"] } serde = { workspace = true } serde_json = { workspace = true } diff --git a/rs/moq-cli/src/main.rs b/rs/moq-cli/src/main.rs index d748f1566eb..71430a59887 100644 --- a/rs/moq-cli/src/main.rs +++ b/rs/moq-cli/src/main.rs @@ -329,9 +329,7 @@ fn main() -> anyhow::Result<()> { async fn run() -> anyhow::Result<()> { // The transport, reqwest, axum-server, and object_store all read rustls's process default. // A CPU rind cannot run on fails here, naming the feature it lacks. - rind_rustls::default_provider()? - .install_default() - .map_err(|_| anyhow::anyhow!("a rustls crypto provider is already installed"))?; + moq_tokio::crypto::install_default()?; let mut cli = Invocation::parse().await; cli.log.init()?; diff --git a/rs/moq-gst/src/sink/session.rs b/rs/moq-gst/src/sink/session.rs index 2611f6a1ce9..baa79fb00a0 100644 --- a/rs/moq-gst/src/sink/session.rs +++ b/rs/moq-gst/src/sink/session.rs @@ -381,9 +381,9 @@ impl Session { /// Stop the session: a clean local close, never an error. Returns once the reconnect loop has ended. /// - /// Aborting only cancels the loop at its next await point, and a worker may be mid-dial, generating - /// TLS randomness. A process exiting in that window (`gst-launch` right after NULL) races aws-lc's - /// exit destructors, which free its seed DRBG and then `abort()` a thread asking for more. + /// Aborting only cancels the loop at its next await point, and a worker may be mid-dial. Without the + /// wait, that dial outlives the state change an application waits on before it exits (`gst-launch` + /// right after NULL). pub fn stop(self) { // The status task goes first, so it never reports the loop's end as a failure. self.join.abort(); @@ -589,8 +589,8 @@ mod tests { connection.poll_closed(&moq_net::kio::Waiter::noop()).is_ready() } - // A dial still running once the element reached NULL can outlive `main`, and aws-lc aborts the - // process when a thread asks it for randomness after its exit destructors ran. + // A dial still running once the element reached NULL would outlive the state change an application + // waits on before it exits. #[test] fn stop_returns_after_the_reconnect_loop_ends() { let (session, connection) = started(); diff --git a/rs/moq-gst/src/source/imp.rs b/rs/moq-gst/src/source/imp.rs index 5fbdba79c27..07d0af8370d 100644 --- a/rs/moq-gst/src/source/imp.rs +++ b/rs/moq-gst/src/source/imp.rs @@ -179,9 +179,8 @@ impl SessionController { /// Stop the session, returning once its readers have removed their pads and the connection closed. /// - /// A dial still running once the element reached NULL can outlive `main` (`gst-launch` exits right - /// after), and aws-lc aborts the process when a thread asks it for randomness after its exit - /// destructors ran. + /// A dial still running once the element reached NULL would outlive the state change an application + /// waits on before it exits (`gst-launch` exits right after). fn stop(self, element: &super::MoqSrc) { let _ = self.shutdown.send(true); @@ -3780,8 +3779,8 @@ mod session_tests { } } - // A dial still running once the element reached NULL can outlive `main`, and aws-lc aborts the - // process when a thread asks it for randomness after its exit destructors ran. + // A dial still running once the element reached NULL would outlive the state change an application + // waits on before it exits. #[test] fn stop_returns_after_the_connection_closes() { let element = element(); diff --git a/rs/moq-tokio/README.md b/rs/moq-tokio/README.md index f7383a4b495..bf8830d6abb 100644 --- a/rs/moq-tokio/README.md +++ b/rs/moq-tokio/README.md @@ -42,7 +42,6 @@ session determines its redirect policy; unused pinned fallbacks do not restrict To refresh DNS, resolve and apply your address policy again before creating a new connection. Address filtering belongs to the caller. -Transport cryptography always uses rind. Remove the `aws-lc-rs` and `ring` -features from dependencies. TLS setup checks support before using crypto: +Transport cryptography always uses rind. TLS setup checks support before using crypto: x86\_64 needs no optional CPU extensions, aarch64 needs NEON, and armv7 is supported. Raspberry Pi 4, CM4, and Zero 2 W use rind's paths without aarch64 crypto extensions.