Repository navigation
Authenticate and authorize mecfeed-serve feed clients (#4, auth slice) - #26
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gerprint helpers Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
authorize() takes the first client whose pin matches, so a shared cert_sha256 made a certificate's feeds depend on file order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The image's ENTRYPOINT always passes --clients-file, which clap refuses alongside --allow-anonymous-feeds, so anonymous mode needs an entrypoint override. Kept fail-closed rather than letting the opt-out win silently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the auth slice of #4. mecfeed-serve now requires every feed client to prove an identity, and limits each client to the feeds it is listed for.
Before this PR, any host inside
--allow-cidrcould read every feed, including a host spoofing an address in an allowed range. Feeds reveal what the operator blocks, so any of those hosts learned the block list. Serve now fails closed: it starts only with--clients-file, or with an explicit--allow-anonymous-feeds.Design:
docs/superpowers/specs/2026-10-26-serve-client-auth-design.md. Plan:docs/superpowers/plans/2026-10-26-serve-client-auth.md.Refs #4. The limits, access-log and assurance slices follow as separate PRs.
Squash-merge this PR. Intermediate commits are not deployable. After the first commit, for example, the units do not yet pass
--clients-file.Changes
clients.rs).--clients-fileis a strict JSON list, withdeny_unknown_fieldsandversion: 1.<format>/<kind>feeds.--client-casubtle, against a dummy hash for an unknown user.:counts as no credentials.WWW-Authenticate: Basic realm="mecfeed", charset="UTF-8"./healthzstays CIDR-only.no-credentials,unknown-user,bad-password,cert-not-listed,feed-not-allowed). The header and the password are never logged.tls.rs).--client-ca, the server usesWebPkiClientVerifierwithallow_unauthenticated(). A client may present no certificate, but a certificate that fails the chain fails the handshake.PeerCertto every request on that connection.--generate-basic-passwordprints the password on stdout andbasic_sha256: <hex>on stderr.--print-cert-fingerprint <pem>prints the certificate's fingerprint. Neither needs the serving flags.clients.jsonwithLoadCredential=and passes--clients-file.0640 root:root) withlink(2), so it never overwrites an existing file.--clients-fileor--allow-anonymous-feeds.verify-packagingpins the new unit lines, and the smoke tests cover the starter file and the warning.--clients-file /etc/mecfeed-serve/clients.json, and the CI argv check pins it.docs/operations.mdgains a "Client authentication" section covering:--entrypointoverridesubtle,tokio-rustls(default-features = false) andtowerwere already inCargo.lock, which gains only two dependency-edge lines. There is no new[[package]]and noaws-lc-rs.Breaking. After upgrading, serve starts with the empty list, and every feed answers 401 until clients are added. Re-run the installer with
MECFEEDMCP_FORCE_UNIT=1.Verification
oneshot):/healthzis open//,%2F, case, query,%61) never returns 200 without credentialsEach commit had a task review and a Codex gate (
codex exec review --commit). Codex found three real problems, all fixed:cert_sha256gave order-dependent authorizationAn Opus whole-branch review had one Important finding, also fixed: the loader had no tests and its errors left out the path.
Checklist
cargo fmt --all -- --checkpassescargo clippy --workspace --all-targets --all-features --locked -- -D warningspassescargo build --workspace --lockedandcargo test --workspace --lockedpasscargo audit --deny warningsandcargo deny check licenses bans sourcesare cleanmecfeed-servefeed serving. It adds an authentication and authorization gate in front of the unchanged snapshot handler, and it fails closed. Nothing on the publish side changes, and the prepare → approve → apply control is untouched.Anything you're unsure about
/feeds/%FF/addressgets 400 from path extraction instead of 401. It reveals nothing about which feeds exist.open_regular's own tests cover FIFOs.std::processis banned outside*_test.rs, and no fifo crate was added.IPAddressDeny, so it misses a drop-in that changes it.🤖 Generated with Claude Code