review brief: same-box-edge-fence round 1 (#990)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+117
−0
docs/superpowers/reviews/CODEX-REVIEW-BRIEF-same-box-edge-fence.md+117 −0
CI passed — run details
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-same-box-edge-fence.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-same-box-edge-fence.md| new file mode 100644 |
| index 000000000..1e6dfa245 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-same-box-edge-fence.md |
| @@ -0,0 +1,117 @@ |
| +# Review brief: branch same-box-edge-fence (the edge fence, #990), round 1 of 3 |
| + |
| +Repo carlos/platform, branch `same-box-edge-fence` on amadan.net (the |
| +local worktree branch is `app-call-grant-edge-proxy`, same commits). |
| +Under review: the diff `4f95eb302..<tip named in the prompt>`. |
| +Authorities: none merged beyond `main`. The plan this branch implements |
| +is on the branch itself: |
| +`docs/superpowers/plans/2026-11-13-same-box-calls-edge-fence.md` (read |
| +it first: the invariant, the evidence from two namespace experiments, |
| +the design, the build notes, the drill table). Background: amadan |
| +discussions #990 (the problem) and #367 (the deny it narrows). |
| + |
| +You are an independent reviewer. Read the plan, then the code it names, |
| +and check every claim against that code. This review is also the census |
| +review: `docs/superpowers/notes/census-proposal-same-box-edge-fence.md` |
| +is the card; give a verdict for every unit and every re-pinned envelope |
| +on it, as AGENTS.md "The census: the reviewer decides" describes. |
| + |
| +## Round history |
| + |
| +The plan had one review round (an agent reviewing for James, recorded |
| +in the plan's "Plan review history"): no P1; seven corrections applied. |
| +This is the first review of the code. Stopping rules 1 and 2 apply. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- James's rulings of 2026-11-13, recorded in the plan: refuse manual |
| + stop on both slices (defence in depth); reset, not silent drop, for |
| + refused TCP ports; accept the nftables-flush window (one refresh |
| + tick while control runs); the reporting goes in `carlos status |
| + --layout`, one line per box. |
| +- The choice of a cgroup-scoped output-only nft table over the |
| + grant-and-proxy alternative (#990), and over a BPF filter attached |
| + by systemd (`IPEgressFilterPath=`, recorded as a follow-up). |
| +- The fence is off in claims mode and on group boxes. |
| + |
| +## What to check |
| + |
| +1. **The invariant** (plan, "The invariant"): an instance reaches an |
| + address of its own box only on TCP 80 or 443, or the whole #367 deny |
| + is in place. Find any path where an address leaves the slice's |
| + `IPAddressDeny=` without a verified fence for it: in |
| + `internal/instancectl/edgefence.go` (`edgeFenceDeny`, |
| + `fenceBeforeStart`, `guardStarts`, `recordFence`), |
| + `hardening.go` (`denyLocalAddrsLocked`, the refresh skip, |
| + `denyLoopWith`), and `server.go` (`runWithClaim`: the wrap, the |
| + startup check before `Serve`). |
| +2. **Every start sees the check.** `guardStarts` wraps `s.Systemctl` |
| + once; `TestEveryStartIsSeenByTheFenceCheck` scans the package. Is |
| + there a start of a unit under `carlos-instances.slice` it misses (in |
| + this package or any other process on the box), and is the egress |
| + asserter's `RestartAllowed` hook (`bindEgressFence`) really in front |
| + of every restart it makes? |
| +3. **The readback.** `internal/edgefence`: `Rules` renders exactly what |
| + `nft -s -nn -y` prints back (fixture |
| + `internal/edgefence/testdata/readback-v4-v6.txt`, captured from a real |
| + kernel; the drill's Debian 13 nft also verified). Can a readback that |
| + compares equal still fail to enforce the rule set (a stale cgroup id |
| + printed as a path, another table at an earlier priority that accepts |
| + first, a chain policy elsewhere)? Can `Verify` pass while the |
| + instances' traffic bypasses the output hook? |
| +4. **The residual** (plan evidence 8): a process outside the slice with |
| + source port 80/443 can reach an instance's TCP listener through the |
| + box address. The plan rules it out because only root and the edge can |
| + bind those ports, pinned by `TestOnlyTheEdgeBindsAPrivilegedPort`. |
| + Is that argument sound and is the guard complete? |
| +5. **Fail-closed under failure and concurrency.** `denyMu`, `mu`, the |
| + fence fields, the retry flag (`fenceRetry`, added after the drill |
| + found a refresh racing `systemctl stop carlos.slice`). Deadlocks |
| + (`fenceBeforeStart` takes `denyMu`; is any start made while holding |
| + it?), lost updates, a refresh that skips an apply it needed. |
| +6. **Units.** `AF_NETLINK` on the control unit; `RefuseManualStop` on |
| + both slices; the claims-mode rewrite in `internal/host/claimunit.go`. |
| + Any boot, update or shutdown path that stops either slice and is now |
| + refused? |
| +7. **The firewall boundary.** `internal/host/adopt_advice.go` says the |
| + platform never writes the firewall on fixed boxes (spec §4b, §5a, |
| + about the IMDS role gate). The fence is a platform-owned table that |
| + only restricts the instances slice's own traffic. Does it conflict |
| + with that rule or with an operator's nftables configuration (for |
| + example `flush ruleset` at boot ordering, `After=nftables.service`)? |
| +8. **Reporting.** `/ready`'s `edge_fence`, the agent's read |
| + (`internal/host/execsandboxstatus.go`), `status.LayoutReport`, the |
| + console passthrough and `printEdgeFenceStatus`. Wrong or misleading |
| + states, especially `not_needed`. |
| +9. **The census card**: a verdict per unit and envelope. |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. (The |
| + census, and review of any newly changed security, root, termination |
| + or production-storage behaviour, still check the fix; see AGENTS.md, |
| + "Stopping rules".) |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the section or task, the problem, |
| +the evidence (file:line, verified), the failure scenario, a concrete |
| +fix and the invariant or trust boundary it breaks (that is its fault |
| +family). Then the census verdicts. End with exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files: you share this worktree with the author. Write your |
| +findings as your reply, not to a file. Do not spawn Anthropic-model |
| +reviewers or subagents of your own. Do not run the full test suites; |
| +targeted `go test -run` of the packages named here is fine. |