From 50c4d6c4a213600729bf89c513c05ede97acf928 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 04:28:25 -0800 Subject: [PATCH 1/3] chore(quest): claim quest/m2/relay-014-leftovers.md Quest-Claim: ee6e4b85e4f5bb4d From 29f5871dcadc560844ba7482f124ab13ffb4bab3 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 05:25:16 -0800 Subject: [PATCH 2/3] refactor(moq-relay): drop the 0.14 upgrade leftovers Remove the ten hidden `--auth-*` flags with their MOQ_AUTH_* variables, the six hidden `[auth]` keys, and the guard that refused a wildcard-free public or mTLS pattern, in the relay and in `moq auth serve`. `anon` now names the broadcast `anon`. Co-Authored-By: Claude Sonnet 5.5 --- doc/bin/relay/auth.md | 2 +- quest/m2/README.md | 5 +- quest/m2/relay-014-leftovers.md | 80 ------------ rs/moq-cli/src/args.rs | 1 - rs/moq-cli/src/auth.rs | 78 +++--------- rs/moq-relay/src/auth.rs | 219 ++++---------------------------- rs/moq-relay/src/config.rs | 70 +++------- 7 files changed, 61 insertions(+), 394 deletions(-) delete mode 100644 quest/m2/relay-014-leftovers.md diff --git a/doc/bin/relay/auth.md b/doc/bin/relay/auth.md index 5b349af46b9..d9ece4d043e 100644 --- a/doc/bin/relay/auth.md +++ b/doc/bin/relay/auth.md @@ -312,7 +312,7 @@ so a session presenting one is refused rather than admitted on the public grant. The patterns are rooted at `/`, like a token with an empty root (see [Path matching](#path-matching)): `anon/**` admits a session dialed at `/`, `/anon`, or `/anon/room`, and refuses one dialed anywhere else. A pattern with -no wildcard, such as `anon`, refuses to start; write `anon/**` for the subtree. +no wildcard names one broadcast: `anon` is the broadcast `anon`, and `anon/**` is the subtree. `public = "**"` opens everything and is for development only. With `--auth-url` the anonymous rules live on the server instead (`moq auth serve --public-*`). diff --git a/quest/m2/README.md b/quest/m2/README.md index 87c4e57f072..e9bf65143cb 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -44,9 +44,8 @@ removal, a rename, or a wire, catalog, or format change that is free until item re-checked for a downstream caller first. - **Relay and transports.** [Memory](/quest/m2/relay-memory.md), which the cut waits on by name; [congestion names](/quest/m2/congestion-names.md); - [config names](/quest/m2/relay-config-names.md), - [the two dial keys](/quest/m2/relay-connect-keys.md), and - [the 0.14 leftovers](/quest/m2/relay-014-leftovers.md); + [config names](/quest/m2/relay-config-names.md) and + [the two dial keys](/quest/m2/relay-connect-keys.md); [transport names](/quest/m2/transport-names.md); and [stats names](/quest/m2/stats-old-names.md). - **Auth and crypto.** [Grants](/quest/m2/auth-grants.md), diff --git a/quest/m2/relay-014-leftovers.md b/quest/m2/relay-014-leftovers.md deleted file mode 100644 index 94453109d35..00000000000 --- a/quest/m2/relay-014-leftovers.md +++ /dev/null @@ -1,80 +0,0 @@ -# [S] The relay drops its 0.14 upgrade leftovers - -## Goal - -moq-relay parses no setting that exists only to refuse a 0.14 config: the -ten hidden `--auth-*` flags with their environment variables and the six -hidden `[auth]` keys are gone, so each is an unknown flag or key like any -other. A public or mTLS rule may name exactly one broadcast: `anon` is the -broadcast `anon`, and the guard that refused a pattern without a wildcard is -gone from the relay and from `moq auth serve`. - -## Plan - -Decided 2026-11-16 (maintainer, /quest-plan of the pre-cut audit): - -- ✅ Remove the hidden flags, the hidden keys, and the upgrade guard - (rejected: keeping them another release). They guard an upgrade from 0.14 - that the `release` line (0.17) already forced, and the guard forbids a - grant that is otherwise legal, for good. - -Facts found by the audit: - -- `rs/moq-relay/src/auth.rs:133-186` declares `Legacy`: `--auth-key`, - `--auth-key-dir`, `--auth-api`, `--auth-public-api`, `--auth-domain`, - `--auth-mtls-tier`, `--auth-tls-root`, `--auth-tls-cert`, - `--auth-tls-key`, and `--auth-tls-disable-verify`, each hidden, each with - a `MOQ_AUTH_*` variable. `:93-110` keeps the TOML keys `key`, `key_dir`, - `auth_api`, `domains`, `mtls_tier`, and `tls` as `IgnoredAny`. - `Config::deprecated` (`:199-266`) pairs each with its replacement, and - `validate` refuses to start on any. -- All of it except the `tls` key is already on `release` - (`origin/release:rs/moq-relay/src/auth.rs:81-135`), so an operator coming - from 0.14 met the refusal one release ago. No quest owned the removal. -- `validate` also refuses a public pattern with no wildcard - (`rs/moq-relay/src/auth.rs:281-301`), because 0.14 read `anon` as the - prefix `anon/` and a pattern reads it as one broadcast. - `moq auth serve` repeats it (`rs/moq-cli/src/auth.rs:638-664`). A - deployment that wants to open exactly one broadcast to the public cannot - say so. -- Tests that pin the leftovers: `released_auth_keys_refuse_to_boot`, - the `RELEASED_AUTH_ENV` cases, and `released_auth_flag_refuses_to_boot` - (`rs/moq-relay/src/config.rs:700-800`), - `a_public_pattern_without_a_wildcard_refuses_to_start` - (`rs/moq-relay/src/auth.rs:1810`), and its twin at - `rs/moq-cli/src/auth.rs:1266`. The frozen list of released flags - (`rs/moq-relay/tests/integration/released_cli.rs`) does not name the ten: - they were hidden before the last release. - -For the PR: - -- Delete `Legacy`, the six keys, their entries in `Config::deprecated` - (and the method, if nothing else is left in it), and their tests. - `[auth]` is `deny_unknown_fields` like the rest of the config, so an old - key still stops startup, with serde's message instead of a tailored one. - Check that a `MOQ_AUTH_KEY` left in the environment is harmless: a relay - with `auth.url` set ignores it, and a relay with no other auth setting - already refuses to start as one that admits nobody, so neither boots - open. The danger the refusal was written for, `key` beside `public` - booting with every token ignored, is then a relay that serves its - public rules and says so in its startup log. -- Delete both guards and their tests. `anon` then grants the one broadcast - `anon`; an empty pattern names the root broadcast. Add the positive test: - a literal public pattern admits exactly that path and nothing beneath it. -- `doc/bin/relay/auth.md:315` ("no wildcard, such as `anon`, refuses to - start") becomes the plain rule: a pattern without a wildcard names one - broadcast, and `anon/**` names the subtree. -- Migration note for moq-relay: the tailored refusals for 0.14 settings are - gone, and a wildcard-free pattern is now accepted with its literal - meaning. -- Leave the refusals for names removed since `release` (`[client]`, - `[server.quic]`, `--server-quic-lb-*`): those protect the upgrade this cut - asks for. - -Public API: none (`Legacy` is crate-private). Config and CLI: ten hidden -flags, their variables, and six hidden keys stop parsing; a wildcard-free -public or mTLS pattern is accepted. Wire: none. - -## Related - -- [The relay's config names](/quest/m2/relay-config-names.md) - the old spellings this cut does refuse by name diff --git a/rs/moq-cli/src/args.rs b/rs/moq-cli/src/args.rs index 41aab58a0c5..2e2b47149a3 100644 --- a/rs/moq-cli/src/args.rs +++ b/rs/moq-cli/src/args.rs @@ -534,7 +534,6 @@ impl MoqSide { found.extend(self.quic.deprecated()); found.extend(self.server.deprecated()); found.extend(self.cluster.deprecated()); - found.extend(self.auth.deprecated()); if self.name.is_some() { found.flag("--name", None, "--broadcast"); } diff --git a/rs/moq-cli/src/auth.rs b/rs/moq-cli/src/auth.rs index 23666e8da16..0a35b89827e 100644 --- a/rs/moq-cli/src/auth.rs +++ b/rs/moq-cli/src/auth.rs @@ -635,34 +635,6 @@ impl Serve { anyhow::bail!("--key, --key-dir, and --key-set conflict; pick one"); } - // 0.14 read `anon` as the prefix `anon/`, and a pattern reads it as exactly the - // broadcast `anon`, so either silent reading would mislead someone upgrading. - let mut flags = vec![ - ( - "--public-publish".to_string(), - self.public.publish.iter().collect::>(), - ), - ("--public-subscribe".to_string(), self.public.subscribe.iter().collect()), - ("--mtls-publish".to_string(), mtls.publish.iter().collect()), - ("--mtls-subscribe".to_string(), mtls.subscribe.iter().collect()), - ]; - for (hash, rule) in &mtls.certificates { - for (direction, patterns) in [("publish", &rule.publish), ("subscribe", &rule.subscribe)] { - let patterns = patterns.iter().flat_map(|patterns| patterns.iter()).collect(); - flags.push((format!("mtls.certificates.{hash}.{direction}"), patterns)); - } - } - for (flag, patterns) in flags { - for pattern in patterns.into_iter().filter(|pattern| pattern.is_literal()) { - // A literal at the maximum depth is already its own subtree. - let subtree = Pattern::subtree(pattern.as_str())?; - if subtree != *pattern { - anyhow::bail!( - "{flag} `{pattern}` has no wildcard, so it names exactly one broadcast; write `{subtree}` for the subtree" - ); - } - } - } let rules = |publish: &[Pattern], subscribe: &[Pattern]| { Permissions::new( publish.iter().cloned().collect::(), @@ -1207,11 +1179,8 @@ publish_rate = 1000000 let err = serve.policy().unwrap_err().to_string(); assert!(err.contains("conflict"), "{err}"); let (serve, _) = merged(&["moq", "auth", "serve", path]).unwrap(); - let err = serve.policy().unwrap_err().to_string(); - assert!( - err.contains(&format!("mtls.certificates.{leaf}.publish `alice`")), - "{err}" - ); + // The literal `alice` names one broadcast, so the rule is valid. + serve.policy().unwrap(); } /// A file edit narrows or revokes at the next re-check, and an edit that does not @@ -1263,40 +1232,23 @@ publish_rate = 1000000 assert!(server.answer(&session).await.is_err(), "deleting the rule revokes it"); } - /// 0.14 read `anon` as a prefix and a pattern reads it as one broadcast, so a - /// wildcard-free rule refuses to start rather than pick silently. + /// A rule without a wildcard names exactly one broadcast. #[test] - fn serve_refuses_a_rule_without_a_wildcard() { - for (flag, rule, hint) in [ - ("--public-publish", "anon", "anon/**"), - ("--public-subscribe", "event/cam1.hang", "event/cam1.hang/**"), - ("--mtls-publish", "", "**"), - ("--mtls-subscribe", "origin", "origin/**"), + fn serve_accepts_a_rule_without_a_wildcard() { + for (flag, rule) in [ + ("--public-publish", "anon"), + ("--public-subscribe", "event/cam1.hang"), + ("--mtls-publish", ""), + ("--mtls-subscribe", "origin"), ] { - let err = serve(&["moq", "auth", "serve", flag, rule]).policy().unwrap_err(); - let err = err.to_string(); - assert!(err.contains(flag) && err.contains(&format!("`{hint}`")), "{err}"); + serve(&["moq", "auth", "serve", flag, rule]).policy().unwrap(); } - assert!( - serve(&[ - "moq", - "auth", - "serve", - "--public-subscribe", - "*/chat", - "--mtls-publish", - "origin/*" - ]) + let policy = serve(&["moq", "auth", "serve", "--public-publish", "anon"]) .policy() - .is_ok() - ); - - // Nothing sits beneath a literal at the maximum depth, so it is its own subtree. - let deepest = vec!["a"; Pattern::MAX_SEGMENTS].join("/"); - assert!( - serve(&["moq", "auth", "serve", "--public-subscribe", &deepest]) - .policy() - .is_ok() + .unwrap(); + assert_eq!( + policy.public.publish, + ["anon".parse::().unwrap()].into_iter().collect() ); } diff --git a/rs/moq-relay/src/auth.rs b/rs/moq-relay/src/auth.rs index 3af10326673..4112159421b 100644 --- a/rs/moq-relay/src/auth.rs +++ b/rs/moq-relay/src/auth.rs @@ -83,33 +83,6 @@ pub struct Config { #[serde(skip_serializing_if = "Vec::is_empty")] #[serde_as(as = "OneOrMany<_>")] pub public_publish: Vec, - - /// The 0.14 flags and env vars #3688 removed, kept parsing but hidden. Never - /// read as settings: [`deprecated`](Self::deprecated) names what replaced each. - #[usage(flatten)] - #[serde(skip)] - pub(crate) legacy: Legacy, - - // The 0.14 `[auth]` keys #3688 removed, kept only so they refuse with their - // replacement named rather than being ignored. - #[usage(skip)] - #[serde(skip_serializing)] - pub(crate) key: Option, - #[usage(skip)] - #[serde(skip_serializing)] - pub(crate) key_dir: Option, - #[usage(skip)] - #[serde(skip_serializing)] - pub(crate) auth_api: Option, - #[usage(skip)] - #[serde(skip_serializing)] - pub(crate) domains: Option, - #[usage(skip)] - #[serde(skip_serializing)] - pub(crate) mtls_tier: Option, - #[usage(skip)] - #[serde(skip_serializing)] - pub(crate) tls: Option, } impl std::fmt::Debug for Config { @@ -130,61 +103,6 @@ impl std::fmt::Debug for Config { /// connection, may hold at its decider. const VERIFICATIONS: usize = 128; -/// The `--auth-*` flags 0.14 had and #3688 removed, with their env vars: a relay -/// deployed through the environment would otherwise ignore them without a word. -#[derive(Clone, Debug, Default, usage_rs::Args)] -#[usage(unknown_flags = "error", args_override_self = false)] -pub(crate) struct Legacy { - #[usage(name = "auth-key", long = "auth-key", env = "MOQ_AUTH_KEY", hide = true)] - key: Option, - #[usage(name = "auth-key-dir", long = "auth-key-dir", env = "MOQ_AUTH_KEY_DIR", hide = true)] - key_dir: Option, - #[usage(name = "auth-api", long = "auth-api", env = "MOQ_AUTH_API", hide = true)] - api: Option, - #[usage( - name = "auth-public-api", - long = "auth-public-api", - env = "MOQ_AUTH_PUBLIC_API", - hide = true - )] - public_api: Option, - #[usage(name = "auth-domain", long = "auth-domain", env = "MOQ_AUTH_DOMAIN", hide = true)] - domain: Vec, - #[usage( - name = "auth-mtls-tier", - long = "auth-mtls-tier", - env = "MOQ_AUTH_MTLS_TIER", - hide = true - )] - mtls_tier: Option, - #[usage( - name = "auth-tls-root", - long = "auth-tls-root", - env = "MOQ_AUTH_TLS_ROOT", - hide = true - )] - tls_root: Vec, - #[usage( - name = "auth-tls-cert", - long = "auth-tls-cert", - env = "MOQ_AUTH_TLS_CERT", - hide = true - )] - tls_cert: Option, - #[usage(name = "auth-tls-key", long = "auth-tls-key", env = "MOQ_AUTH_TLS_KEY", hide = true)] - tls_key: Option, - #[usage( - name = "auth-tls-disable-verify", - long = "auth-tls-disable-verify", - env = "MOQ_AUTH_TLS_DISABLE_VERIFY", - hide = true, - default_missing = "true", - num_args = 0..=1, - require_equals = true - )] - tls_disable_verify: Option, -} - impl Config { /// The static grant the public patterns name, or `None` when none is set. /// @@ -196,76 +114,6 @@ impl Config { (!publish.is_empty() || !subscribe.is_empty()).then(|| Grant::new(publish, subscribe)) } - /// The 0.14 settings in use, each paired with what replaced it. A relay refuses - /// to start on any: `key` with `public` would otherwise boot with every JWT - /// ignored. - pub fn deprecated(&self) -> moq_tokio::cli::Deprecated { - let mut found = moq_tokio::cli::Deprecated::default(); - let legacy = &self.legacy; - for (set, flag, env, toml, new) in [ - ( - legacy.key.is_some(), - "--auth-key", - "MOQ_AUTH_KEY", - self.key.is_some().then_some("[auth] key"), - "--auth-url to `moq auth serve --key`", - ), - ( - legacy.key_dir.is_some(), - "--auth-key-dir", - "MOQ_AUTH_KEY_DIR", - self.key_dir.is_some().then_some("[auth] key_dir"), - "--auth-url to `moq auth serve --key-dir`", - ), - ( - legacy.api.is_some(), - "--auth-api", - "MOQ_AUTH_API", - self.auth_api.is_some().then_some("[auth] auth_api"), - "--auth-url to a server answering the contract", - ), - ( - legacy.public_api.is_some(), - "--auth-public-api", - "MOQ_AUTH_PUBLIC_API", - None, - "--auth-url to a server answering the contract", - ), - ( - !legacy.domain.is_empty(), - "--auth-domain", - "MOQ_AUTH_DOMAIN", - self.domains.is_some().then_some("[auth] domains"), - "an auth server that reads `server_name`", - ), - ( - legacy.mtls_tier.is_some(), - "--auth-mtls-tier", - "MOQ_AUTH_MTLS_TIER", - self.mtls_tier.is_some().then_some("[auth] mtls_tier"), - "--auth-url to `moq auth serve --tier`", - ), - ( - !legacy.tls_root.is_empty() - || legacy.tls_cert.is_some() - || legacy.tls_key.is_some() - || legacy.tls_disable_verify.is_some(), - "--auth-tls-*", - "MOQ_AUTH_TLS_*", - self.tls.is_some().then_some("[auth.tls]"), - "--connect-tls-cert/--connect-tls-key for identity; --auth-root for server trust", - ), - ] { - if set { - found.flag(flag, Some(env), new); - } - if let Some(toml) = toml { - found.toml(toml, new, None); - } - } - found - } - /// Whether no source is named at all. Such a relay admits nothing on its own: /// [`Relay::load`](crate::Relay::load) hands its sessions to the embedder as /// [`Admissions`], and [`validate`](Self::validate) refuses it for a binary. @@ -277,29 +125,7 @@ impl Config { /// static grant, or that pairs public rules with a client CA, so the question /// of who decides has one answer. `client_ca` is whether any listener verifies /// client certificates, which public rules would grant what they grant anyone. - /// - /// A public pattern without a wildcard is refused too. 0.14 read `anon` as the - /// prefix `anon/`, and a pattern reads it as exactly the broadcast `anon`, so - /// either silent reading would mislead someone upgrading. pub fn validate(&self, client_ca: bool) -> anyhow::Result<()> { - let deprecated = self.deprecated(); - anyhow::ensure!(deprecated.is_empty(), "{deprecated}"); - let flags = [ - ("--auth-public", &self.public), - ("--auth-public-publish", &self.public_publish), - ("--auth-public-subscribe", &self.public_subscribe), - ]; - for (flag, patterns) in flags { - for pattern in patterns.iter().filter(|pattern| pattern.is_literal()) { - // A literal at the maximum depth is already its own subtree. - let subtree = Pattern::subtree(pattern.as_str())?; - if subtree != *pattern { - anyhow::bail!( - "{flag} `{pattern}` has no wildcard, so it names exactly one broadcast; write `{subtree}` for the subtree" - ); - } - } - } match (&self.url, self.public_grant()) { (Some(_), Some(_)) => anyhow::bail!("--auth-url and --auth-public cannot both be set; the server decides"), (None, None) => anyhow::bail!( @@ -1807,25 +1633,36 @@ mod tests { assert_eq!(peer.chain, vec![peer.fingerprint.clone(), root]); } - /// 0.14 read `anon` as a prefix and a pattern reads it as one broadcast, so a - /// wildcard-free public pattern refuses to start rather than pick silently. - #[test] - fn a_public_pattern_without_a_wildcard_refuses_to_start() { - for (public, hint) in [("anon", "anon/**"), ("anon/room", "anon/room/**"), ("", "**")] { - let err = config(None, &[public]).validate(false).unwrap_err().to_string(); - assert!(err.contains(&format!("`{hint}`")), "{public}: {err}"); + /// A public pattern without a wildcard names exactly one broadcast, never its subtree. + #[tokio::test] + async fn a_literal_public_pattern_admits_exactly_that_broadcast() { + let auth = config(None, &["anon"]) + .init("relay-1", &moq_tokio::tls::Connect::default(), false) + .unwrap(); + + // Dialed at the broadcast, the grant is the broadcast itself. + let lease = auth + .admit(auth.request(moq_auth::Transport::Quic, "/anon")) + .await + .unwrap(); + assert_eq!(lease.token().root, Path::new("anon").unwrap()); + assert_eq!(lease.token().publish, patterns(&[""])); + assert_eq!(lease.token().subscribe, patterns(&[""])); + + // Dialed above it, the grant reaches only that name. + let lease = auth.admit(auth.request(moq_auth::Transport::Quic, "/")).await.unwrap(); + assert_eq!(lease.token().publish, patterns(&["anon"])); + + // Nothing beneath it, and no other name, is reached. + for path in ["/anon/room", "/anonymous", "/other"] { + let Err(err) = auth.admit(auth.request(moq_auth::Transport::Quic, path)).await else { + panic!("{path} was admitted"); + }; + assert!(matches!(err, Error::Refused(_)), "{path}: {err}"); } - let split = Config { - public_subscribe: patterns(&["anon/**", "live"]).into_iter().collect(), - ..Default::default() - }; - let err = split.validate(false).unwrap_err().to_string(); - assert!(err.starts_with("--auth-public-subscribe `live`"), "{err}"); - assert!(config(None, &["anon/*", "*/chat", "**"]).validate(false).is_ok()); - // Nothing sits beneath a literal at the maximum depth, so it is its own subtree. - let deepest = vec!["a"; Pattern::MAX_SEGMENTS].join("/"); - assert!(config(None, &[&deepest]).validate(false).is_ok()); + // The empty pattern names the root broadcast. + assert!(config(None, &[""]).validate(false).is_ok()); } /// The embedder's answer is the session's verdict; an answer that never comes, diff --git a/rs/moq-relay/src/config.rs b/rs/moq-relay/src/config.rs index 93c85a79222..cdac418a655 100644 --- a/rs/moq-relay/src/config.rs +++ b/rs/moq-relay/src/config.rs @@ -300,7 +300,6 @@ impl Config { deprecated.extend(self.listen.deprecated()); deprecated.extend(self.connect.deprecated()); deprecated.extend(self.cluster.deprecated()); - deprecated.extend(self.auth.deprecated()); if let Some(server) = &self.server { deprecated.toml("[server]", "[listen]", None); deprecated.extend(server.deprecated()); @@ -696,34 +695,13 @@ max_streams = 64 assert!(err.contains("both directions"), "{err}"); } - /// A 0.14 `[auth]` config with `key` and `public` would otherwise boot with - /// every JWT ignored; each removed key refuses with its replacement named. + /// A 0.14 `[auth]` key is an unknown key like any other, never a tailored refusal. #[test] - fn released_auth_keys_refuse_to_boot() { - let toml = r#" -[auth] -key = "root.jwk" -key_dir = "keys/" -auth_api = "https://api.example.com/auth" -domains = ["example.com"] -mtls_tier = "internal" -public = "anon/**" - -[auth.tls] -root = ["ca.pem"] -"#; - let config: Config = toml::from_str(toml).expect("released config must still parse"); - let err = config.resolve().expect_err("must refuse").to_string(); - for old in [ - "[auth] key -> --auth-url to `moq auth serve --key`", - "[auth] key_dir -> --auth-url to `moq auth serve --key-dir`", - "[auth] auth_api -> ", - "[auth] domains -> ", - "[auth] mtls_tier -> --auth-url to `moq auth serve --tier`", - "[auth.tls] -> --connect-tls-cert/--connect-tls-key for identity; --auth-root for server trust", - ] { - assert!(err.contains(old), "{old}: {err}"); + fn a_released_auth_key_is_an_unknown_key() { + for key in ["key", "key_dir", "auth_api", "domains", "mtls_tier"] { + toml::from_str::(&format!("[auth]\n{key} = \"x\"\n")).expect_err(key); } + toml::from_str::("[auth.tls]\nroot = [\"ca.pem\"]\n").expect_err("tls"); } #[test] @@ -760,46 +738,28 @@ root = ["ca.pem"] assert_eq!(config.connect.tls.root, vec![std::path::PathBuf::from("mesh.pem")]); } - /// The released auth variables, each with the spelling its refusal names. - const RELEASED_AUTH_ENV: [(&str, &str); 7] = [ - ("MOQ_AUTH_KEY", "--auth-key / MOQ_AUTH_KEY"), - ("MOQ_AUTH_KEY_DIR", "--auth-key-dir / MOQ_AUTH_KEY_DIR"), - ("MOQ_AUTH_API", "--auth-api / MOQ_AUTH_API"), - ("MOQ_AUTH_PUBLIC_API", "--auth-public-api / MOQ_AUTH_PUBLIC_API"), - ("MOQ_AUTH_DOMAIN", "--auth-domain / MOQ_AUTH_DOMAIN"), - ("MOQ_AUTH_MTLS_TIER", "--auth-mtls-tier / MOQ_AUTH_MTLS_TIER"), - ("MOQ_AUTH_TLS_ROOT", "--auth-tls-* / MOQ_AUTH_TLS_*"), - ]; - - /// The environment is the half a removed flag silently misses: a relay deployed - /// through it never typed the flag. + /// A 0.14 auth variable or flag is unknown like any other: startup stops naming it, + /// so a left-over `MOQ_AUTH_KEY` never boots a relay with its tokens ignored. #[test] - fn released_auth_env_refuses_to_boot() { - let env = RELEASED_AUTH_ENV - .iter() - .fold(test_env::Env::default(), |env, (var, _)| env.set(var, "x")); - if !env.isolate() { + fn a_released_auth_variable_and_flag_are_unknown() { + if !test_env::Env::default().set("MOQ_AUTH_KEY", "root.jwk").isolate() { return; } - // One refusal names every variable, so the operator fixes them all in one pass. - let err = Config::parse_and_merge(["moq-relay", "--auth-public", "**"]) + let err = Config::parse_and_merge(["moq-relay", "--auth-public", "anon/**"]) .expect_err("must refuse") .to_string(); - for (var, spelling) in RELEASED_AUTH_ENV { - assert!(err.contains(spelling), "{var}: {err}"); - } + assert!(err.contains("MOQ_AUTH_KEY"), "{err}"); } - /// 0.14 took the bare flag, so it has to parse to be refused by name. #[test] - fn released_auth_flag_refuses_to_boot() { - if !test_env::Env::without(&RELEASED_AUTH_ENV.map(|(var, _)| var)).isolate() { + fn a_released_auth_flag_is_unknown() { + if !test_env::Env::without(&["MOQ_AUTH_KEY"]).isolate() { return; } - let err = Config::parse_and_merge(["moq-relay", "--auth-public", "**", "--auth-tls-disable-verify"]) + let err = Config::parse_and_merge(["moq-relay", "--auth-public", "anon/**", "--auth-key", "root.jwk"]) .expect_err("must refuse") .to_string(); - assert!(err.contains("--auth-tls-* / MOQ_AUTH_TLS_*"), "{err}"); + assert!(err.contains("--auth-key"), "{err}"); } /// A released flag and a released table are refused together, in one message. From c26e3610bcd809e67134fcb4cad496e2564a25f9 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 17 Nov 2026 01:13:10 -0800 Subject: [PATCH 3/3] fix(moq-relay): the literal-pattern test compares Access after the merge --- rs/moq-relay/src/auth.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rs/moq-relay/src/auth.rs b/rs/moq-relay/src/auth.rs index b3f044c6931..f083af1c14c 100644 --- a/rs/moq-relay/src/auth.rs +++ b/rs/moq-relay/src/auth.rs @@ -1623,12 +1623,12 @@ mod tests { .await .unwrap(); assert_eq!(lease.token().root, Path::new("anon").unwrap()); - assert_eq!(lease.token().publish, patterns(&[""])); - assert_eq!(lease.token().subscribe, patterns(&[""])); + assert_eq!(lease.token().publish, patterns(&[""]).into()); + assert_eq!(lease.token().subscribe, patterns(&[""]).into()); // Dialed above it, the grant reaches only that name. let lease = auth.admit(auth.request(moq_auth::Transport::Quic, "/")).await.unwrap(); - assert_eq!(lease.token().publish, patterns(&["anon"])); + assert_eq!(lease.token().publish, patterns(&["anon"]).into()); // Nothing beneath it, and no other name, is reached. for path in ["/anon/room", "/anonymous", "/other"] {