fix: warn when PILOT_REGISTRY/PILOT_BEACON env vars override compiled defaults (PILOT-236)#173
Conversation
…compiled defaults (PILOT-236) PILOT_REGISTRY and PILOT_BEACON env vars silently override compiled defaults at startup with no log entry or warning. An attacker who controls the daemon's environment can redirect registry/beacon to attacker-controlled endpoints, granting trust to an imposter network. This adds a slog.Warn log entry after logging setup when either env var overrides the compiled default, alerting the operator that the daemon is connecting to a non-default registry or beacon address. Closes PILOT-236
🦾 Matthew PR Check — #173 PILOT-236Status
VerdictCLEAN — narrow change (11 lines in cmd/daemon/main.go). Emits Jira🤖 @matthew-pilot — automated PR worker |
🦜 Matthew Explains — #173 PILOT-236What this doesAdds two Why it mattersThese env vars determine where the daemon connects for rendezvous and beacon services. An attacker who controls the daemon environment ( The fix
Threat model
The fix does not prevent the override — it makes it visible. The operator can then investigate unexpected addresses via Verification
🤖 @matthew-pilot — automated PR explainer |
|
🤖 Hank — CI status Classification: The build/test failure is a genuine code defect: @matthew-pilot — fix or comment. Auto-classified at 2026-05-29T18:45:00Z. Re-runs on next push or check completion. |
TeoSlayer
left a comment
There was a problem hiding this comment.
Architecture-gates race-flake is pre-existing (TestTunnelKeepaliveLoopFires / TestTrustRepublishLoopFires etc., not related to this PR). Approving to admin-merge.
🧹 Matthew Cleanup — #173 MergedPR merged by TeoSlayer at 2026-05-29T20:37:59Z. Cleaning up now.
Thanks for the merge! 🚀 |
🧹 Matthew Cleanup — #173 PILOT-236Merged: ✅ Cleanup complete. |
What failed
PILOT_REGISTRYandPILOT_BEACONenvironment variables silently override the compiled default registry (34.71.57.205:9000) and beacon (34.71.57.205:9001) addresses at daemon startup (cmd/daemon/main.go:41-46). No warning, no log entry. An attacker who controls the daemon's environment — via .bashrc, .zshenv, /etc/environment, systemd unit override, or container env block — can redirect the daemon to attacker-controlled rendezvous and beacon, granting trust to an impostor who can impersonate any peer.Why this fix
After
logging.Setup, emit aslog.Warnwhen either env var was used to override the compiled default. This alerts the operator that their daemon is connecting to a non-default registry or beacon address. The warning includes the redirected address and a prompt to check for tampering if unexpected.Tracked with two booleans (
registryFromEnv,beaconFromEnv) set during env-var reading, consumed after structured logging is online. No behavioral change — the daemon still respects the env var; the only difference is a visible warning.Verification
go build ./cmd/daemon/— cleango vet ./cmd/daemon/— clean./tests/) — runningDiff
Closes PILOT-236