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
2 changes: 1 addition & 1 deletion doc/bin/relay/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,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-*`).
Expand Down
5 changes: 2 additions & 3 deletions quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ removal, a rename, or a wire, catalog, or format change that is free until
demos return to their earlier format.
- **Unused API.** [One sweep per area](/quest/m2/unused-api/README.md), each
item re-checked for a downstream caller first.
- **Relay and transports.** [Congestion names](/quest/m2/congestion-names.md);
[the 0.14 leftovers](/quest/m2/relay-014-leftovers.md); and
[transport names](/quest/m2/transport-names.md).
- **Relay and transports.** [Congestion names](/quest/m2/congestion-names.md)
and [transport names](/quest/m2/transport-names.md).
- **Auth and crypto.** [Claims](/quest/m2/auth-claims.md). End-to-end encryption
[is its own unpublished crate again](/quest/m2/e2ee-crate.md); its
[finished format](/quest/m3/e2ee-format.md) follows in m3.
Expand Down
76 changes: 0 additions & 76 deletions quest/m2/relay-014-leftovers.md

This file was deleted.

1 change: 0 additions & 1 deletion rs/moq-cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
78 changes: 15 additions & 63 deletions rs/moq-cli/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>(),
),
("--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(|access| access.path.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::<moq_auth::Patterns>(),
Expand Down Expand Up @@ -1207,11 +1179,8 @@ link = "none"
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
Expand Down Expand Up @@ -1263,40 +1232,23 @@ link = "none"
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::<Pattern>().unwrap()].into_iter().collect()
);
}

Expand Down
Loading