Repository navigation
fix(net): node-branded bind defaults -- env.mesh-bind.local loaded last, port-audit via $(DC) [compose flips pending grant] - #3538
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016aNs4rDG3Hx25i9J38nSX6
…lves through $(DC) The node's gitignored env.mesh-bind.local is now appended as the LAST compose env file, so a node's bind opt-ins override every tier file. port_audit.py already reads that file as its allowlist (only exact 0.0.0.0 values count), so the two stay in step. port-audit ran a bare `docker compose config` with no env files and aborted on every node. It now pipes `$(DC) config --format json` into port_audit.py --config-json -, never writing resolved config to disk; empty or invalid input fails closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016aNs4rDG3Hx25i9J38nSX6
…tests pin overlay order + literal-wildcard allowlist - env.mesh-bind.example: the file is now loaded into compose LAST; prefer the node's tailnet IP over 0.0.0.0; commented opt-in lines for every surface being moved to loopback (flips pending a compose Known Road grant, stated in the file). Values kept alone on their line: port_audit compares the whole text after '=', so a trailing comment would defeat a 0.0.0.0 opt-in. - test_makefile_mesh_bind_overlay.py: overlay appended once, guarded, LAST; port-audit pipes $(DC) config. All 4 fail against the pre-change files. - test_port_audit.py: non-literal-wildcard values (specific IP, blank, 0.0.0.0 with trailing comment, ::, 0.0.0.0/0) never allowlist, with a positive control; --config-json stdin/path, empty/invalid input fails closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016aNs4rDG3Hx25i9J38nSX6
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 8 files / VERIFIED 124 / DRIFTED 10 / UNDECIDED 29 / digest 123515a05cb9 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
The rule: node-branded bind defaults
The source default is loopback. A
*_BINDin compose defaults to127.0.0.1unless a reviewed decision made it mesh-default. Today those are NATS_BIND, BOTZ_BIND, PUBLISHER_DISCORD_BIND and PMOVES_UI_BIND, and they stay wide. A node that must be reached from another host opts in through its own gitignoredpmoves/env.mesh-bind.local. It should prefer its tailnet IP over0.0.0.0. Nobody widens a compose default for one node.What this PR does (landed)
pmoves/Makefile: whenenv.mesh-bind.localexists, it is appended as the LAST--env-file, after env.shared, every env.tier-* file, the optional.env.local/env.supa.runtimeoverlays, andenv.tier-supabase.urlencoded. A node's bind decision therefore overrides the tiers for every$(DC)target.tools/port_audit.pyalready reads this file as its allowlist, and only exact0.0.0.0values count there, so the two stay in step.make port-audit(pmoves/mk/infra.mk): the target ran a baredocker compose configwith no env files, so it aborted on every node. It now runs$(DC) config --format json | port_audit.py --config-json -. The resolved config is piped and never written to disk, because it carries secret values. Empty or invalid input fails closed.pmoves/tools/port_audit.py: adds--config-json PATH|-. The bare mode is unchanged.pmoves/env.mesh-bind.example: documents the rule and the load order, plus the advice to prefer the tailnet IP. It adds commented opt-in lines for every surface below, using the placeholder<this-node-tailnet-ip>; there are no real IPs. Each value sits alone on its line. port_audit compares the whole text after=, so a trailing# commentwould stop a0.0.0.0opt-in from being allowlisted.tests/unit/test_makefile_mesh_bind_overlay.pypins four things: the overlay is appended once, the append is guarded by existence, it comes LAST, and port-audit uses$(DC). All 4 fail against the pre-change files (checked viagit show, not by reverting the worktree).tests/unit/test_port_audit.pygains three groups of tests:0.0.0.0never allowlist: a specific IP, a quoted IP, blank,0.0.0.0 # comment,::and0.0.0.0/0. There is a positive control.--config-jsonreads stdin and a path, and fails closed on empty or invalid input.NOT landed: the compose default flips (blocked, pending a compose Known Road grant)
Every compose file is
readOnlyPaths, and the open file grant (compose:pr:3433) is 673h old, so it is refused as stale. The edit was refused with:No grant was minted. The flips below are the remaining scope of this PR. Each is
0.0.0.0→127.0.0.1unless noted.pmoves/docker-compose.yml:5244,pmoves/docker-compose.core.yml:1459pmoves/docker-compose.yml:4409,pmoves/docker-compose.ui.yml:448pmoves/docker-compose.yml:1981,pmoves/docker-compose.workers.yml:660pmoves/docker-compose.yml:2015,pmoves/docker-compose.workers.yml:694pmoves/docker-compose.yml:2251,pmoves/docker-compose.workers.yml:51pmoves/docker-compose.mcp-gateway.yml:133pmoves/docker-compose.yml:2056,pmoves/docker-compose.workers.yml:619pmoves/monitoring/docker-compose.monitoring.yml:30(no host-ip today = 0.0.0.0)pmoves/monitoring/docker-compose.monitoring.yml:45pmoves/monitoring/docker-compose.monitoring.yml:57pmoves/monitoring/docker-compose.monitoring.yml:80pmoves/docker-compose.open-notebook.yml:86(no host-ip today)pmoves/docker-compose.open-notebook.yml:87Once the flips land, the new bind vars should also be recorded in
pmoves/configs/ports.yaml. That was deferred deliberately, because recording abind_varthe compose files do not carry yet would itself be drift. The monitoring services exist there only as__registry_only_*slots withcompose_files: [].Rollout: no node changes until it is recreated
Nothing on a running node changes until its containers are recreated, so merging this has no live effect. However, once the flips land, any node that relies on reaching one of the surfaces above from another host must add the opt-in to its own
pmoves/env.mesh-bind.localBEFORE its next recreate. Otherwise the surface comes back on loopback only. Use the node's tailnet IP where possible.Verification (read-only; no up/recreate/start/stop/publish)
python3 -m pytestover 13 bind / port-registry / port-audit suites: 392 passed, 3 skipped, rc=0python3 pmoves/tools/silent_bind_ratchet.py --check --bind-shape: rc=0python3 pmoves/tools/port_registry_ratchet.py: rc=0 (63 compose files, 266 slots)make -C pmoves port-auditin this worktree: COULD-NOT-MEASURE. A worktree has no gitignored env.shared, and some compose stanzas reference it directly.$(DC) config | port_audit.py --config-json -recipe, evaluated in the main checkout (make --eval, read-only): the config step passes. It audited 48 ports and found 8 violations (exit 1 = findings). The control is a baredocker compose configin the same checkout, which exits 1 (the old recipe's failure).Known follow-ups (not in scope)
0.0.0.0and expects127.0.0.1for everything else, so a node following the advice and binding to its tailnet IP gets a VIOLATION, even for NATS.env.mesh-bind.examplenow says so, and a test pins the current behaviour. Teaching the audit to accept a specific interface for a bind-file-listed var is a separate change.${*_BIND:-0.0.0.0}defaults remain without a review record: HF_AGENT, WGER, NODE_REGISTRY, CLIP/CLAP_EMBED, NATS_LEAF, GITHUB_* (cleanup/triage/automation/runner-ctl), TRANSCRIBE(_FRONTEND), JELLYFIN_BRIDGE, CAST_TTS and OLLAMA. cAdvisormonitoring/docker-compose.monitoring.yml:109(9180) also has no host-ip.safe-opening-audit(pmoves/mk/infra.mk) has the same bare-docker compose configdefect that port-audit had.🤖 Generated with Claude Code
https://claude.ai/code/session_016aNs4rDG3Hx25i9J38nSX6