Skip to content

fix(cluster): bind embedded NATS client to loopback and require route auth/TLS - #91

Merged
olucasandrade merged 4 commits into
fix/review-findings-20260924from
fix/cluster-nats-auth-tls-bind
Sep 25, 2026
Merged

olucasandrade merged 4 commits into
fix/review-findings-20260924from
fix/cluster-nats-auth-tls-bind

Conversation

@olucasandrade

Copy link
Copy Markdown
Owner

Plan

.claude/fix-plans/cluster-nats-auth-tls-bind-20260924-212132.md

Problem

--cluster started the embedded NATS server with no Host (default 0.0.0.0), no route authorization, and no route TLS. JetStream holds the full CDC stream, so any reachable host could subscribe or join the route mesh, bypassing the SSE/gRPC bearer-token/TLS data plane.

Introduced by

4598d0e

Implementation

  • Always bind the embedded NATS client listener to 127.0.0.1 (in-process via ClientURL; external NATS clients out of scope).
  • When --cluster-peers is set, require --nats-cluster-user / --nats-cluster-password as STRICT ${VAR} refs and --nats-cluster-tls-cert / --nats-cluster-tls-key; fail startup otherwise (no silent open mesh).
  • Wire new config/flags through config.Merge and root.go; document in README cluster section.

Validation

  • CGO_ENABLED=0 go test ./internal/eventlog/ ./internal/cmd/ ./internal/config/ -count=1 — pass

Residual risk

Breaking change for existing --cluster users with peers: deployments must supply shared ${VAR} route credentials and TLS cert/key (peer hostnames must match cert SAN/CN) before rolling out. Incorrect TLS setup can partition the mesh. The cluster route port remains peer-reachable (not loopback) and should stay firewalled.

… auth/TLS

Prevent unauthenticated exposure of the CDC JetStream stream by always
binding the embedded NATS client listener to 127.0.0.1 and requiring
${VAR} route credentials plus TLS cert/key whenever --cluster-peers is set.

Introduced-by: 4598d0e
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 259c12c3-2209-4596-aab8-e7d626258681

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Deploying kaptanto with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8d26fa2
Status: ✅  Deploy successful!
Preview URL: https://b2b8b14a.kaptanto.pages.dev
Branch Preview URL: https://fix-cluster-nats-auth-tls-bi.kaptanto.pages.dev

View logs

@olucasandrade
olucasandrade merged commit d97364e into fix/review-findings-20260924 Sep 25, 2026
15 checks passed
@olucasandrade
olucasandrade deleted the fix/cluster-nats-auth-tls-bind branch September 25, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant