Repository navigation
fix(relay)!: refuse connect.url and connect.tokens, and keep template tokens off cluster dials - #8927
Conversation
Quest-Claim: 9d79bcca7baf2432
… tokens off cluster dials The relay flattened the whole client fragment as its cluster dial template, so connect.tokens rode SETUP and AUTH on every cluster dial, LAN peers included, and connect.url was read by nothing. Config::resolve now refuses both by every spelling, naming cluster.connect and cluster.token, and peer_client clears the template's tokens so an embedder's Cluster gets the same guarantee. --help stops listing the two flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed the whole PR: the cluster dial token fix, the new config refusal and the hidden help flags, the tests, and the doc and quest updates.
- Template tokens off cluster dials —
peer_clientclearsconnect.tokenson its cloned template. A static, API, or LAN peer now receives onlycluster.tokenor that peer's owntoken, and the newcluster_dials_present_no_template_tokenstest checks this against a real lite-07 listener. - Refuse
connect.url/connect.tokens—Config::resolvecallscheck_connect(), which stops startup with one message that names the flag, the env var, and the TOML key, along with each replacement. The other[connect]keys still resolve. - Hidden help flags —
moq_relay::spec()returns a cached copy of the spec with--connectand--connect-tokenmarked hidden. Both flags still parse, soreleased_cli.rsstill finds them and the refusal can name them. - Docs —
doc/bin/relay/config.mdexplains where peers and credentials come from.doc/bin/cli.mdsays--connect-tokennever reaches a cluster peer.
I checked the relay's other reads of config.connect. The auth API reads only .tls, so clearing the tokens changes nothing there. No deployment config, nix module, or script in the repo sets either refused key; the --connect in bench/relay.sh belongs to moq-bench.
claude-opus-5-5 | 𝕏
|
quest land watch: the merge queue removed this pull request at 941e841 because it conflicts with The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs. (written by quest land watch) |
|
quest land watch: armed auto-merge on this pull request at 98d498a, so it joins the back of the merge queue once its required checks pass, with the land fixer's fix ( (written by quest land watch) |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Head: 98d498abf03daf5fddde3409701124bf28f55388
No blocker found. Clearing the template before building the peer client protects embedded callers as well as the relay binary, and the startup error names the replacement without printing the credential. I'd add a positive assertion that an authenticated static peer still receives its own configured token, while LAN receives neither it nor the template tokens.
At rollout, check for these two keys before replacing the binary: an old config with either populated now fails to start. If a deployment used template tokens while dialing peers that weren't meant to receive them, removing the setting doesn't revoke the old token; rotate it separately. Static review; I did not run the dial tests.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The only change since the last Pullfrog review is a merge from main. It touches no code.
- Resolved the quest index conflict.
quest/m2/README.mdkeepsmain's new CPU quest link and drops the link to the finishedrelay-connect-keys.mdquest. The relay code, tests, and docs are the same as in the commit approved earlier.
claude-opus-5-5 | 𝕏

Finishes quest/m2/relay-connect-keys.md: the relay refuses the two
[connect]keys it has no use for, and a cluster dial never carries the dial template's tokens.Summary
connect.tokens(--connect-token,MOQ_CONNECT_TOKEN) rode every cluster dial: the first token in SETUP (or the URL query before lite-07), the rest on AUTH streams, to static peers and LAN peers alike. That contradicteddoc/bin/relay/cluster.md's "a LAN peer is never handedcluster.token" in spirit: an undocumented second cluster credential went to every peer. Reproduced first by the newcluster::tests::cluster_dials_present_no_template_tokens, which failed onmainfor the static peer (SETUP tokentemplate-setup) and, with that assertion skipped, for the LAN peer too.peer_clientclears the template's tokens, so every cluster dial (and an embedder'sCluster::with_connect, includingmoq --cluster-*) presents onlycluster.tokenor a peer's owntoken.Cluster::with_connect's doc says so.Config::resolverefusesconnect.urlandconnect.tokensby every spelling, naming the replacement:moq-relay --helpno longer lists--connector--connect-token:moq_relay::spec()now returns the derived spec with those two flags marked hidden (they still parse, so the refusal can name them). Every other[connect]key keeps working as the cluster dial template.doc/bin/relay/config.md's[connect]section says where peers and credentials come from instead;doc/bin/cli.mdsays--connect-tokengoes only to--connect, never to a cluster peer.Decisions
Taken unattended; each is reversible in review.
#[usage(flatten)]site, and the quest rejected splittingmoq_tokio::connect::Config. Sospec()builds a copy of the rootCommandMetawithhideset on the two flags, leaked once behind aOnceLock(about 20 lines). Its catch: it buildsusage_rsmetadata structs whose fields are public but#[doc(hidden)], so a usage-rs layout change could break it at compile time. Shell completion (Cli::completion_request) still uses the derived spec and may still offer the two flags. The alternative is to keep them in--helpwith the refusal as the only signal.resolvestyle rather thanDeprecated.Deprecatedrendersold -> newunder "renamed or removed", which reads wrong for a key that still exists for clients. The custom message names the flag, the variable, and the TOML key of each, plus the replacement.--client-connectis left alone. The released--client-connectis already refused with "->--connect", which the relay now refuses in turn. Fixing it would mean special-casing moq-tokio's sharedDeprecatedentry for the relay. That flag configured nothing on the relay in the first place.Validation
just check: passes (moq-relay and moq-cli tests, clippy, fmt, docs, quest).cluster_dials_present_no_template_tokensfailed withleft: ("/static", None, Some(b"template-setup")), and the LAN-only run failed withLAN peer at /.cluster/lan-proof ... Some(b"template-setup"). After the fix it passes against a real lite-07 QUIC listener for both, and the same dial keeps the template's version and TLS settings.connect_url_and_tokens_refuse_to_boot(flag, TOML, and the rest of[connect]still resolving),connect_env_refuses_to_boot(both env vars), andhelp_omits_the_refused_connect_flags.moq-relay --connect https://peer.example/exits 1 with the message above,MOQ_CONNECT_TOKEN=secret moq-relaydoes the same, a TOML with both prints both lines, andmoq-relay --helplists--connect-bindbut not--connect <or--connect-token. A relay with--connect-bind '[::]:0' --connect-timeout 5sstill boots and serves.Impact
Cluster::with_connectkeeps its type and now ignores the template'stokens.moq_relay::spec()keeps its signature and returns the spec with the two flags hidden.connect.url/--connect/MOQ_CONNECTandconnect.tokens/--connect-token/MOQ_CONNECT_TOKENstop startup. Migration: replace a peer URL withcluster.connect(--cluster-connect,MOQ_CLUSTER_CONNECT). Replace a credential withcluster.token(--cluster-token, a file read on every dial) or atokenon acluster.connectpeer object.moq --connect-tokenno longer reaches cluster peers (--cluster-connect,--cluster-api-url,--cluster-lan). Give those--cluster-token.Caused by
connect.tokensas "credentials to present on every dial" without keeping them off the relay's cluster dial template, so they reached every cluster peer (found by person; pre-cut config audit).Follow-ups
None.
Models
Size: S
Implementer: Claude Code, claude-opus-5-5, medium effort (arm A)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with medium effort)
Review
mechanical fix by codex, gpt-6.1-sol, medium effort:
Merged base and re·solved quest/m2/README.md conflict preserving base's CPU link and PR's completed dial-keys removal; ran nix develop --command just ci base and git diff --check base HEAD; all passed.(head 98d498a)Rewritten by
quest reviewafter each round.Head: 941e841
Base: origin/main at 6488ce6
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1e49b-efc8-7bf3-ac55-00be340f0f69, round 1Score: 9/10,
The changes are focused and include regression coverage, with no actionable regressions found, though tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none