Repository navigation
Risk levels, auto-confirm of safe changes, apply --wait, machine-enforced guard (#12, #38) - #61
Merged
Merged
Conversation
… machine-enforced guard Part 2 of #12, with the guard and risk levels of #38. - Every plan gets low / medium / high with reasons (the administrator's own path via ip route + bridge fdb, LAN addresses, WANs, inbound rules, SSH / web UI / tailscale, the guard); `--explain` says what each action does. - Web UI: level, reasons and effects in the apply dialog; low / medium changes are kept by the page once applied, verified and reachable; high ones wait for 保留. - `mr apply --confirm N --wait`: y keeps; Ctrl-C / a dropped SSH session / the countdown roll back. - `guard:` (never_expose, always_bypass, offload, ssh_lan_only) enforced by `mr validate` for every path. Lab config carries one; tests for every rule. Closes #12
This was referenced Sep 25, 2026
Closed
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.
What
Risk levels (
mr/risk.go). Every plan is rated:The administrator's path comes from their address (web:
REMOTE_ADDR, CLI:SSH_CLIENT):ip route getgives the netdev; for a bridge, the neighbour's MAC and the bridge fdb give the member port. So "you are on WiFiphy1-ap0and hostapd restarts", "you are on tailscale and tailscale restarts", "you come in over this PPPoE link and it redials", "you are in SSH and dropbear restarts" are high.mr plan/mr applyend withrisk: …;--explain(or-v) says what each action does in plain words (WiFi drops for a few seconds, the WAN redials for ~5–10 s, DNS blips for ~1 s, …)."Kept automatically" means: the browser confirms the change itself once the job is applied and verified and the page can still reach the router — the confirm window keeps doing its job for changes that cut the administrator off.
mr apply --confirm N --wait: asks on the terminal;ykeeps the change; Ctrl-C, a dropped SSH session (SIGHUP / EOF on stdin) or the end of the countdown roll it back at once (the detached timer stays as a backstop if the process is killed).Guard (
mr/guard.go, from #38) — the owner's baselines, checked byConfig.Validateafter every module, so no path (web UI, CLI, restore, a future API token or agent) can apply a config that breaks them:Changing
guarditself is a high-risk change.mr schema(for #37's tool schemas) comes with #17;max_risk_without_touchwith #37.Why
#12: automatic confirmation for changes that cannot lock the administrator out, clear warnings for those that can, and a terminal flow that rolls back as soon as the SSH session drops. #38: baselines enforced by the machine rather than by discipline — including against a prompt-injected agent.
Verification
--waitkeeping the change ony; every guard rule (ranges, forwards to the router, a moved SSH port, offload order, unknown names) and the allowed cases (the same port forwarded to another host, a disabled entry, proxy off). The lab config carries a guard and CI validates / renders it.tools/ci.shpasses (private and public trees).Closes #12 · Part of #38
https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr