Skip to content

fix(net): node-branded bind defaults -- env.mesh-bind.local loaded last, port-audit via $(DC) [compose flips pending grant] - #3538

Draft
POWERFULMOVES wants to merge 3 commits into
mainfrom
fix/node-branded-bind-defaults-2026-11-27
Draft

POWERFULMOVES wants to merge 3 commits into
mainfrom
fix/node-branded-bind-defaults-2026-11-27

Conversation

@POWERFULMOVES

Copy link
Copy Markdown
Owner

The rule: node-branded bind defaults

The source default is loopback. A *_BIND in compose defaults to 127.0.0.1 unless 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 gitignored pmoves/env.mesh-bind.local. It should prefer its tailnet IP over 0.0.0.0. Nobody widens a compose default for one node.

What this PR does (landed)

  1. pmoves/Makefile: when env.mesh-bind.local exists, it is appended as the LAST --env-file, after env.shared, every env.tier-* file, the optional .env.local / env.supa.runtime overlays, and env.tier-supabase.urlencoded. A node's bind decision therefore overrides the tiers for every $(DC) target. tools/port_audit.py already reads this file as its allowlist, and only exact 0.0.0.0 values count there, so the two stay in step.
  2. make port-audit (pmoves/mk/infra.mk): the target ran a bare docker compose config with 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.
  3. pmoves/tools/port_audit.py: adds --config-json PATH|-. The bare mode is unchanged.
  4. 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 # comment would stop a 0.0.0.0 opt-in from being allowlisted.
  5. Tests:
    • tests/unit/test_makefile_mesh_bind_overlay.py pins 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 via git show, not by reverting the worktree).
    • tests/unit/test_port_audit.py gains three groups of tests:
      • Values that are not literally 0.0.0.0 never allowlist: a specific IP, a quoted IP, blank, 0.0.0.0 # comment, :: and 0.0.0.0/0. There is a positive control.
      • A specific-interface bind is reported, not waved through.
      • --config-json reads 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:

SECURITY: Blocked edit to Known Road grant compose:pr:3433 refused — grant file is 673.6h old (limit 24h)

No grant was minted. The flips below are the remaining scope of this PR. Each is 0.0.0.0 → 127.0.0.1 unless noted.

Var File:line (on this branch) Port
TENSORZERO_UI_BIND pmoves/docker-compose.yml:5244, pmoves/docker-compose.core.yml:1459 4000
OPENROOM_BIND pmoves/docker-compose.yml:4409, pmoves/docker-compose.ui.yml:448 5173
PRESIGN_BIND pmoves/docker-compose.yml:1981, pmoves/docker-compose.workers.yml:660 8088
RENDER_WEBHOOK_BIND pmoves/docker-compose.yml:2015, pmoves/docker-compose.workers.yml:694 8085
EXTRACT_WORKER_BIND pmoves/docker-compose.yml:2251, pmoves/docker-compose.workers.yml:51 8083
MCP_GATEWAY_BIND pmoves/docker-compose.mcp-gateway.yml:133 8189
MODEL_REGISTRY_BIND pmoves/docker-compose.yml:2056, pmoves/docker-compose.workers.yml:619 8110
PROMETHEUS_BIND (new) pmoves/monitoring/docker-compose.monitoring.yml:30 (no host-ip today = 0.0.0.0) 9090
GRAFANA_BIND (new) pmoves/monitoring/docker-compose.monitoring.yml:45 3002
LOKI_BIND (new) pmoves/monitoring/docker-compose.monitoring.yml:57 3100
BLACKBOX_BIND (new) pmoves/monitoring/docker-compose.monitoring.yml:80 9115
OPEN_NOTEBOOK_UI_BIND (new) pmoves/docker-compose.open-notebook.yml:86 (no host-ip today) 8503
OPEN_NOTEBOOK_API_BIND (new) pmoves/docker-compose.open-notebook.yml:87 5055

Once the flips land, the new bind vars should also be recorded in pmoves/configs/ports.yaml. That was deferred deliberately, because recording a bind_var the compose files do not carry yet would itself be drift. The monitoring services exist there only as __registry_only_* slots with compose_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.local BEFORE 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 pytest over 13 bind / port-registry / port-audit suites: 392 passed, 3 skipped, rc=0
  • python3 pmoves/tools/silent_bind_ratchet.py --check --bind-shape: rc=0
  • python3 pmoves/tools/port_registry_ratchet.py: rc=0 (63 compose files, 266 slots)
  • make -C pmoves port-audit in this worktree: COULD-NOT-MEASURE. A worktree has no gitignored env.shared, and some compose stanzas reference it directly.
  • The same $(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 bare docker compose config in the same checkout, which exits 1 (the old recipe's failure).
    • Violations: extract-worker 8083, presign 8088 and render-webhook 8085. These three are fixed by the pending flips.
    • nats 4222 is mesh-default by decision; the audit allowlists it only via a bind file.
    • github-runner-ctl 8104, pmoves-ollama 11435, transcribe-backend 8074 and transcribe-frontend 448 are wide defaults outside this PR's list.

Known follow-ups (not in scope)

  • The tailnet-IP advice conflicts with port_audit today. The audit allowlists only the literal 0.0.0.0 and expects 127.0.0.1 for everything else, so a node following the advice and binding to its tailnet IP gets a VIOLATION, even for NATS. env.mesh-bind.example now 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.
  • Further ${*_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. cAdvisor monitoring/docker-compose.monitoring.yml:109 (9180) also has no host-ip.
  • safe-opening-audit (pmoves/mk/infra.mk) has the same bare-docker compose config defect that port-audit had.

🤖 Generated with Claude Code

https://claude.ai/code/session_016aNs4rDG3Hx25i9J38nSX6

POWERFULMOVES and others added 3 commits November 27, 2026 18:38
…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
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1

  • coderabbit

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

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

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized keys: "branches", "excluded_branches" at "reviews"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added docs Documentation governance AGNOTE register / agent definitions / damage-control hooks labels Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation governance AGNOTE register / agent definitions / damage-control hooks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant