Skip to content

fix(roxwarp): make the cluster transport fail-closed (R-54, S-36) - #34

Merged
TurkerMertkan merged 1 commit into
developfrom
s36-cluster-fail-closed
Nov 23, 2026
Merged

TurkerMertkan merged 1 commit into
developfrom
s36-cluster-fail-closed

Conversation

@TurkerMertkan

Copy link
Copy Markdown
Collaborator

Summary

  • The cluster port (default 7443) served plain WS with no peer auth when no certificates were given or when the mTLS config failed to build; outbound peers fell back to ws://; /roxwarp on the REST port was always mounted without auth (mTLS bypass).
  • New roxwarp::transport decides per side: mTLS when cert/key/CA build; plain WS only with the new --cluster-insecure flag and no mTLS paths; otherwise off with a WARN/ERROR line. A broken or incomplete mTLS setup never falls back to plain WS.
  • /roxwarp on the REST port is mounted only in plain mode. When off, no peer connections, no mDNS, no peers registered; the local feed and /api/cluster/status keep running.
  • ClusterConfig.allow_plain is serde(skip): CLI only.

Routes / auth / wire

/api/cluster/status (public) and /api/cluster/query (bearer) unchanged. Wire format unchanged; peers relying on plain WS without the flag can no longer connect.

Behavior change

The packaged unit runs --cluster with no certificates and no peers, so after deploy 7443 is no longer listening.

Test plan

  • Transport decision unit tests (no certs, flag, broken/missing files, partial config, mount rule matches plain arm)
  • /roxwarp on REST port mounted only in plain mode (fails on old code); run() registers no peers when off; config file cannot set allow_plain
  • bash tools/gates.sh: 2908 passed / 0 failed; simulator-hal check OK
  • Local E2E, real binary, three modes (--cluster, --cluster-insecure, broken certs)
  • security-reviewer (no significant findings), silent-failure-hunter (log/diagnostic findings fixed)
  • mTLS success path with real certificates (needs rcgen or test certs; open)

🤖 Generated with Claude Code

https://claude.ai/code/session_01QKRNiek8qYRoRt7dcrDDVC

With --cluster, the cluster port (default 7443) served plain WebSocket
with no peer auth when no certificates were given, and also when the
mTLS config failed to build (only an error line). Outbound peers fell
back to ws:// the same way, and /roxwarp on the REST port was always
mounted without auth, so even with mTLS a peer could bypass it there.

New roxwarp::transport decides per side (listener, outbound):
- cert, key and CA set and the rustls config builds: mTLS;
- no mTLS path and --cluster-insecure: plain WS (warn: no peer auth);
- no mTLS path and no flag: off (warn naming the flags to pass);
- broken or incomplete mTLS config: off (error), never plain WS.
main.rs builds the listener from it; ClusterManager::run builds the
outbound side from it and, when off, starts no peer connections and no
mDNS and registers no peers (the local feed still runs). /roxwarp on
the REST port is mounted only in plain mode (plain_ws_allowed, same
rule). ClusterConfig.allow_plain is serde(skip): only the CLI flag sets
it, the cluster JSON file cannot.

Routes/auth: /roxwarp on the REST port stays outside the auth layer but
exists only with --cluster-insecure. /api/cluster/status (public) and
/api/cluster/query (bearer) are unchanged.

Wire protocol: unchanged. Affected clients: roxWarp peers. A peer that
used plain WS without --cluster-insecure can no longer connect.

Behavior change: the packaged unit runs --cluster with no certificates
and an empty peer list, so after deploy port 7443 is no longer
listening (log: "no mTLS configured, cluster listener disabled"). Also:
the plain-mode serve error is now logged; the startup field "mtls" is
renamed "mtls_paths" (it reports configured paths, not a working TLS).

Tests: transport decision (no certs, flag, broken and missing files,
partial config, plain_ws_allowed matches the plain arm); /roxwarp on
the REST port mounted only in plain mode (failed on the old code);
run() registers no peers when off; config file cannot set allow_plain;
CLI flag parse. gates: 2908 passed / 0 failed; simulator-hal check OK.
Local E2E with the real binary in the three modes: port, /roxwarp and
log lines as above. Not covered: the mTLS success path with real
certificates (needs rcgen or test certificates).

Docs: OVERVIEW, HARDCODED_LIMITS, DEPLOYMENT_CHECKLIST (verify step),
research/16 status, HowToUses/06, README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKRNiek8qYRoRt7dcrDDVC
@TurkerMertkan
TurkerMertkan merged commit 4d8245f into develop Nov 23, 2026
2 checks passed
@TurkerMertkan
TurkerMertkan deleted the s36-cluster-fail-closed branch November 23, 2026 13:15
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