diff --git a/Cargo.lock b/Cargo.lock index b91e96c5c3b..f334502c713 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11553,9 +11553,9 @@ dependencies = [ [[package]] name = "web-transport-proto" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2baf87f7a4701d964fd23529b440db3da535b1d7539289f7a463c3481dafcff" +checksum = "40d8e5dba9b14dbe25b116ac7e62ca82bf7c328d1c6072238bf0b9b47874c9d1" dependencies = [ "bytes", "http", diff --git a/Cargo.toml b/Cargo.toml index e84f0b10d73..9068e382a7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -239,7 +239,7 @@ url = "2" usage-rs = "7.1.0" uuid = { version = "1.26", features = ["v7"] } web-transport-iroh = "0.8.3" -web-transport-proto = "0.6" +web-transport-proto = "0.6.4" web-transport-trait = "0.5" x11rb = { version = "0.14.0", features = ["randr", "xfixes"] } x509-parser = "0.18" diff --git a/quest/m0/README.md b/quest/m0/README.md index ddcf80111f1..49ae345d17b 100644 --- a/quest/m0/README.md +++ b/quest/m0/README.md @@ -28,7 +28,6 @@ since cutting segments from first-frame pts waits on nothing in m1. ## Required - [Nightly passes on main](/quest/m0/nightly/README.md) - the scheduled Nightly passes end to end, so red means a new break -- [Release credential leaks](/quest/m0/security-audit/README.md) - tokens stay out of logs and outbound HTTP clients verify their peer, on `main` and `release` - [Interop and Video pass on main](/quest/m0/interop-green/README.md) - the scheduled Interop and Video workflows pass, so red means a new break - [Publish the release line's drain() wrappers](/quest/m0/ffi-shutdown-backport.md) - Python `moq-rs` 0.5.2 and Dart `moq` 0.1.1 reach PyPI and pub.dev from `release` - [Backport audio groupDuration](/quest/m0/backport-audio-group-duration.md) - `@moq/publish` 0.5.4 on `release` can pack several Opus frames per group, making Cloudflare's relay drop audio less often diff --git a/quest/m0/security-audit/README.md b/quest/m0/security-audit/README.md deleted file mode 100644 index 3bf3c7ec74e..00000000000 --- a/quest/m0/security-audit/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# 2026-10-27 security audit: release credential leaks - -## Goal - -Close the credential leaks from the 2026-10-27 external security audit that -also ship in `release`: tokens reaching logs, and outbound HTTP clients that a -network attacker can redirect or impersonate. Each child fixes `main` and -backports to `release`. - -## Plan - -An external AI audit at -[651c30fee9](https://github.com/moq-dev/moq/commit/651c30fee9) reported 8 -Medium and 28 Low findings. Every claim was re-checked against source before -planning. The completed pre-cut epic's -[triage record](https://github.com/moq-dev/moq/blob/e3bd4b288e01f0c2e7fbe1e6a362d6f3d58057c8/quest/m1/security-audit/README.md) -preserves the maintainer's dropped findings and external owners. - -Decided 2026-10-27 (maintainer): these two land in m0 because `release` -carries the same bugs. Each quest owns its own backport PR rather than a -separate `backport-*` quest. - -## Required - -- [Tokens stay out of logs on release](/quest/m0/security-audit/log-secrets.md) - backport the main-branch credential log redaction to `release` diff --git a/quest/m0/security-audit/log-secrets.md b/quest/m0/security-audit/log-secrets.md deleted file mode 100644 index 71d495bb6ce..00000000000 --- a/quest/m0/security-audit/log-secrets.md +++ /dev/null @@ -1,27 +0,0 @@ -# [M] Tokens stay out of logs on release - -## Goal - -No credential reaches a log line at any level on `release`: SETUP and AUTH -tokens, `?jwt=` queries in dialed, accepted, or GOAWAY redirect URLs, and -`Cookie`/`Authorization` headers. Refusal logs escape client-controlled -fields, so a path or root cannot forge a log record. - -## Plan - -[moq-dev/moq#7200](https://github.com/moq-dev/moq/pull/7200) fixed this on -`main` by giving each existing credential-bearing type a manual redacting -`Debug` (SETUP and AUTH tokens, opaque SETUP parameters, lite request targets, -CONNECT requests, auth requests, cluster peers, GOAWAY URIs) and escaping -refusal fields, with captured-trace tests for each. - -Port that behavior in a separate PR against `release`, preserving its -published API, per `CONTRIBUTING.md`. Its protocol and transport layouts -differ from main, so port behavior rather than applying the patch blindly. -Known leaks there: the SETUP token derives `Debug`, the auth refusal log is -unescaped, and all three GOAWAY types derive `Debug` while -`lite/publisher.rs` logs the redirect URI raw. - -Settled: ✅ keep the existing credential types with manual redacting `Debug`, -rather than one shared credential type, so moq-net and moq-auth keep their -independent public types and byte fields. diff --git a/rs/moq-uring/src/quic/web.rs b/rs/moq-uring/src/quic/web.rs index 6592874c34e..13948d5e5e6 100644 --- a/rs/moq-uring/src/quic/web.rs +++ b/rs/moq-uring/src/quic/web.rs @@ -389,9 +389,12 @@ impl Rejected { } } +/// Safe to log: [`proto::ConnectRequest`]'s `Debug` redacts the URL's +/// userinfo, query, and fragment and every header value but `origin` and +/// `user-agent`, so a `?jwt=` or `Authorization` credential stays out. impl std::fmt::Debug for Request { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Request").field("url", &self.request.url).finish() + f.debug_struct("Request").field("connect", &self.request).finish() } } @@ -1704,6 +1707,25 @@ mod tests { )); } + /// The CONNECT request is logged here and by the `web-transport-iroh` + /// transport, so its `Debug` must keep credentials out: + /// `web-transport-proto` redacts them from 0.6.4. + #[test] + fn connect_debug_redacts_credentials() { + let url = url::Url::parse("https://user:hunter2@relay.example/anon?jwt=SECRET#SECRET").unwrap(); + let request = proto::ConnectRequest::new(url) + .with_header( + http::header::AUTHORIZATION, + http::HeaderValue::from_static("Bearer SECRET"), + ) + .with_header(http::header::COOKIE, http::HeaderValue::from_static("session=SECRET")); + let debug = format!("{request:?}"); + assert!(debug.contains("relay.example/anon"), "{debug}"); + for secret in ["SECRET", "hunter2", "jwt="] { + assert!(!debug.contains(secret), "{secret} leaked: {debug}"); + } + } + /// Wrap `payload` in an HTTP/3 frame of type `typ`. fn frame(typ: u64, payload: &[u8]) -> Vec { let mut buf = Vec::new(); diff --git a/rs/moq-uring/tests/integration/web.rs b/rs/moq-uring/tests/integration/web.rs index 4d93b4ee0e3..57db4c7687f 100644 --- a/rs/moq-uring/tests/integration/web.rs +++ b/rs/moq-uring/tests/integration/web.rs @@ -159,6 +159,11 @@ fn webtransport_echo_end_to_end() { let request = quic::web::Request::accept(conn).await.expect("handshake"); assert_eq!(request.url().path(), "/echo"); assert_eq!(request.url().query(), Some("token=abc")); + let debug = format!("{request:?}"); + assert!( + debug.contains("/echo") && !debug.contains("token=abc"), + "query leaked: {debug}" + ); assert_eq!(request.protocols(), [PROTO.to_string()]); let mut session = request .respond(quic::web::Response::default().with_protocol(PROTO))