Repository navigation
fix(auth): moq auth serve --mtls-peer / --mtls-upstream mark certificates as cluster links - #5039
Conversation
… peers `Policy::decide` never set `grant.peer`, so a relay dialing in with mTLS through `moq auth serve` was admitted as a client and what it forwarded counted as local ingest. `--mtls-peer` (`Policy::mtls_peer`) marks every certificate's grant as a peer; a plain mTLS client stays local without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated review of The fix is right and small. Certificate grants get Non-blocking
CI (Check, Test, macOS, Windows) was still queued at review time. Verdict: MERGE (once CI is green) This is an automated review, not the maintainer's decision |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (11)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. WalkthroughThe auth server adds Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The mTLS peer change has no identified issue that needs resolution before merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches✨ Simplify code
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. Comment |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 72a569e
No new actionable correctness findings. The direction is sound: Policy::decide sets the peer bit only for certificate grants, leaves JWT/anonymous grants unchanged, and preserves certificate permission/path scoping. The opt-in flag, default-off behavior, and no-mTLS-permissions CLI rejection fit the existing API. I traced the bit through Cluster::mounted and the lease's peer-change handling; the added policy/CLI tests and end-to-end Source::Peer assertion cover the intended fix. Existing discussion already covers rollout behavior, Nix policy flexibility, and the optional negative relay test, so I am not duplicating those comments.
Verification limits: static review of all 11 changed files and relevant auth/cluster context; tests and deployment behavior were not executed independently. This is a COMMENT review, not an approval.
…upstream Needs `--mtls-peer`, since only a cluster peer can be upstream; `Server::new` refuses the policy otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated follow-up review of The push adds one commit: Non-blocking (new)
Earlier findings (review on
CI (Check, Test, macOS, Windows) was still pending at review time. Verdict: MERGE (once CI is green) This is an automated review, not the maintainer's decision |
…n mTLS client stays local Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed the Grok reviews in
(Written by Claude Opus 5.5) |
|
Automated follow-up review of The push adds one commit with two doc edits and a test refactor, and it closes three earlier findings. The Non-blocking (new)
Earlier findings
CI (Check, Test, macOS, Windows) was still pending at review time. Verdict: MERGE (once CI is green) This is an automated review, not the maintainer's decision |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 0e9e382
Re-reviewed the two commits since 72a569e; the base remains fe0113f. No new actionable code defects found.
The direction remains sound: the new upstream flag reuses the existing grant/origin machinery, applies only to certificate grants, and is rejected without peer mode by both CLI policy construction and Server::new. This is a small extension without needing another relay-specific authorization path. I traced the flags through grant validation, Cluster::mounted, and lease re-checks, and inspected upstream_grant_hides_other_upstreams.
The earlier rollout/hub documentation concerns and missing plain-mTLS Source::Local test are addressed. The Nix opt-out remains an optional policy choice under its documented cluster-certificate assumption; no additional upstream integration test was added, but the existing cluster test checks the downstream filtering behavior.
One non-blocking documentation correction remains, already reported independently: doc/bin/relay/auth.md:257–259 should mention a pushed /sessions/revalidate (or moq auth revalidate) as well as periodic re-checks. Producer::due accepts that push even without a cadence, and a changed mark then ends the lease. Qualify “until it reconnects” accordingly; no duplicate inline comment added.
Verification: GitHub-only static review; no tests executed independently. Check, Test, macOS, and Windows were queued when inspected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
(Written by Claude Opus 5.5) |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 4e05bbc
No new actionable findings. The only change since my previous review is doc/bin/relay/auth.md:257–260; the base remains fe0113f. It fixes the remaining pushed-revalidation documentation issue: both periodic and pushed re-checks can end a session whose peer/upstream mark changes, and the old marks persist until then. I verified the wording against Producer::due and Lease::ended, including a push with no cadence.
The direction remains sound; this completes the rollout clarification without changing code. The prior Nix policy choice and optional upstream integration-test discussion are unchanged, so no duplicate comments.
Verification limits: GitHub-only static review of this delta and relevant lease/documentation context; no tests executed independently. Check was queued and Platform pending when inspected.
|
Merging: the OpenAI review of (Written by Claude Opus 5.5) |
moq_auth::serve::Policy::decidenever setgrant.peer, so a relay that dialed in with mTLS throughmoq auth serve --mtls-publish '**' --mtls-subscribe '**'(the documented mesh setup) was admitted as a client: its routes reportedSource::Localand showed up inorigin::Consumer::local(), as if they were ingested on the accepting relay. There was also no way to mark an mTLS linkupstreamwithout writing your own auth server.Change
moq auth serve --mtls-peersetspeer: trueon every grant decided by certificate. JWT and anonymous grants are never peers. A plain mTLS client (an encoder with a cert) stays local ingest without the flag.moq auth serve --mtls-upstreamalso setsupstream: trueon those grants, so the relay never offers that link a route learned from another upstream. It needs--mtls-peer;Server::newrefuses the policy withError::UpstreamWithoutPeerotherwise.--mtls-peerwith no--mtls-publish/--mtls-subscriberefuses to start, since it would mark nobody.--mtls-peer:doc/bin/relay/{cluster,auth}.md,doc/setup/upgrade.md,nix/modules/moq-relay.nix,demo/relay/*.toml.cluster.md#upstream-linksmentions--mtls-upstreamand that it applies to every certificate.Public API / wire
moq_auth::serve::Policygainspub mtls_peer: boolandpub mtls_upstream: bool(the struct is#[non_exhaustive]withDefault, so this is additive).Server::newnow also refusesmtls_upstreamwithoutmtls_peer.moq auth serve --mtls-peerand--mtls-upstream.Grant.peerandGrant.upstreamalready exist on the contract.--mtls-peer, since its client CA is for cluster peers.Tests
moq-relayauth_lifetime::an_mtls_peer_is_a_cluster_peer: an mTLS client dials a QUIC relay backed by an in-processmoq auth servepolicy and publishes; the relay's origin must reportSource::Peer. It failed before the fix (an mTLS peer's route counted as Local).an_mtls_client_ingests_herechecks the same session staysSource::Localwithout--mtls-peer.moq-authserve::tests::mtls_peer_marks_only_certificates(peer and upstream set only for certificates) anda_server_refuses_an_upstream_that_is_not_a_peer, plus CLI flag parsing and refusals.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code