fix(launch): route systemd + demo bind through the SEC-F22 guard (SEC-F23/F24)#433
Merged
Merged
Conversation
…-F23/F24) The systemd unit and the demo launcher started canopy with `uvicorn main:app --host 0.0.0.0`. uvicorn binds the socket from the CLI flag without ever consulting settings.server.host, so the SEC-F22 bind guard (which reads the setting, default 127.0.0.1) saw loopback and passed while the socket was public -- an undefended guard bypass (canopy has no uvicorn-CLI parity shim). Drive both launchers through the settings-based entrypoint (python main.py, from the src WorkingDirectory), so the guard evaluates the real bind. Both now bind loopback by default (matching the container + plant_all paths); each documents how to expose off-loopback via JUNIPER_CANOPY_SERVER__HOST + an honest attestation flag (the guard hard-fails on an unattested non-loopback bind). Host/port defaults are unchanged (127.0.0.1:8050). See juniper-ml notes/JUNIPER_2026-07-06_JUNIPER-ECOSYSTEM_LAUNCH-PATH-BIND-AUDIT.md (SEC-F23, SEC-F24). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LX5ToumBaABH3QutQC86sM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Launch-path bind audit findings SEC-F23 (systemd unit) and SEC-F24 (demo launcher). Both started canopy with
uvicorn main:app --host 0.0.0.0 --port 8050. uvicorn binds the socket from the CLI--hostwithout ever consultingsettings.server.host, so the SEC-F22 bind guard — which reads the setting (default127.0.0.1) in the app lifespan — saw loopback, concluded "safe", and passed while the socket was bound to all interfaces. canopy has no uvicorn-CLI parity shim (unlike cascor), so this bypass was undefended.Fix
Drive both launchers through the settings-based entrypoint —
python main.pyfrom thesrcWorkingDirectory (the demo alreadycd src; the unit'sWorkingDirectoryis.../juniper-canopy/src) — so the guard evaluates the real bind host. Both now bind loopback by default (matching the deploy container andplant_all), and each documents how to expose off-loopback viaJUNIPER_CANOPY_SERVER__HOST+ one honest attestation flag. The guard hard-fails on an unattested non-loopback bind, so exposure is a conscious, attested act.Host/port defaults are unchanged (
127.0.0.1:8050;settings.server.portdefault is 8050).Behavior change (intended)
The systemd unit and demo previously bound
0.0.0.0; they now bind loopback by default. Same-machine use is unaffected (browsehttp://localhost:8050/dashboard/). Off-loopback reachability now requires settingJUNIPER_CANOPY_SERVER__HOST=0.0.0.0+ the matching attestation — the SEC-F22 posture, and consistent with the request to limit environment-config divergence. A bare on-host0.0.0.0bind cannot set an honest attestation (no loopback publish, no fronting proxy), so loopback-default is the correct shipped posture.Not in scope (follow-up)
canopy still lacks cascor's generic
_settings_with_uvicorn_cli_bindparity shim; porting it would defend any futureuvicorn --hostlauncher, not just these two. Tracked as the reclassified SEC-F27 (see PR #630 discussion).Testing
shellcheck -S warning util/juniper_canopy-demo.bash— clean; pre-commitLint shell scriptspassed.ExecStartonly;WorkingDirectory=.../srcalready present.See juniper-ml
notes/JUNIPER_2026-07-06_JUNIPER-ECOSYSTEM_LAUNCH-PATH-BIND-AUDIT.md(SEC-F23, SEC-F24), companion to juniper-ml PR #630.🤖 Generated with Claude Code
https://claude.ai/code/session_01LX5ToumBaABH3QutQC86sM