edges files: say plainly the key binding narrows H3-M4, does not close it
Fix round 1, a scope cut (Astra P1-4). Checking that a body names the box its key names stops a body filed under one box's key from speaking for another, and nothing more. The key is not an authenticated identity: the fixed-host IAM policy (infra/modules/region-host/main.tf) lets every box put any object in the deployment bucket, so a bucket writer can write control/edges/<victim>.json itself with a matching box field and any EIP, host entries and stamps; those still reach the election (dialBeats) and KnownHost's ACME admission. H3-M4 is NOT closed. Closing it needs routing claims authenticated against authority a bucket writer lacks (per-box signing), a design follow-up the coordinator is filing. Comments only: homemap.go (package doc and parseEdgesFile, with the residual), edgesfile.BoxFromKey, ReadSnapshot, steering_loop.go and the H3-M4 hunt test no longer describe the key as the publisher's authorised identity. Fable's P3, one box freezing the steering pass: the only writer of these files (edgesFileWriteClaims) takes the key and the body's box from the same ident.Box, so an honest box cannot misfile; only a bucket writer can hold the pass, and it can already write any box's file. The pass keeps failing closed rather than withdrawing a box's records.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+47
−36
internal/edge/homemap.go+24 −20internal/edge/hunt_H3-M4_test.go+4 −0internal/edgesfile/edgesfile.go+7 −6internal/edgesfile/snapshot.go+3 −3internal/host/steering_loop.go+9 −7
diff --git a/internal/edge/homemap.go b/internal/edge/homemap.go| index 4b91c4131..093e3b7cf 100644 |
| --- a/internal/edge/homemap.go |
| +++ b/internal/edge/homemap.go |
| @@ -14,10 +14,10 @@ package edge |
| // last-good mirror certsync.go's certMirror is; that shape survived heavy |
| // review and is copied rather than reinvented. It NEVER writes: the |
| // writer map gives control/edges/<box>.json to that box's own loop, and |
| -// nothing in this package bumps control/serial. That writer map is also |
| -// why a body is believed only when its box field names the box its KEY |
| -// names (parseEdgesFile, hunt H3-M4): the key is the authorised |
| -// identity, the body a claim. |
| +// nothing in this package bumps control/serial. A body is believed only |
| +// when its box field names the box its KEY names (parseEdgesFile). That |
| +// narrows hunt H3-M4 and does not close it: see parseEdgesFile for the |
| +// residual. |
| // |
| // - the mesh keys ride the SAME refresh (loadMeshKeys, mesh.go), so a |
| // request path never reads the store: who homes a host and what key |
| @@ -627,8 +627,8 @@ func (m *homeMap) refreshHosts(ctx context.Context) error { |
| unread++ |
| } else if f, perr := parseEdgesFile(key, body); perr != nil { |
| err = perr |
| - // A body refused for naming a box its key does not (hunt H3-M4) |
| - // is acted on for nothing, but a group reference in it still |
| + // A body refused for naming a box its key does not is acted on |
| + // for nothing, but a group reference in it still |
| // latches the observation: the latch only ever restricts (the |
| // system leg's group reader floor), so a forged body can make |
| // this box more careful and never less. |
| @@ -972,20 +972,24 @@ func (m *homeMap) setServedWake(fn func()) { |
| // because a half-written body is no more usable than a body that never |
| // arrived, and the fix for both is the publisher's next pass. |
| // |
| -// The body is bound to its key (hunt H3-M4). The writer map lets a box put |
| -// control/edges/<box>.json and nothing else under the prefix, so the key |
| -// names the publisher and the body's box field is the publisher's claim |
| -// about itself; the two must agree before any field of the body is acted |
| -// on. Were the body trusted on its own word, anyone who could write the |
| -// prefix could put a file under a key of their choosing carrying an entry |
| -// for a host homed elsewhere at a stamp no real claim will reach, and |
| -// dialBeats would hand that host's dial to the address in the forged body, |
| -// while KnownHost admitted every name in it to the ACME gate |
| -// (deploymentHost). A disagreeing body is refused like a body that will not |
| -// parse: refreshHosts carries this key's last good parse forward, so a |
| -// forged body switches no live dial target and clears no pairing (vouch, |
| -// never revoke), and the fold reflects no generation, so the key is read |
| -// again next poll. |
| +// The body must name the box its key names (a narrowing of hunt H3-M4, |
| +// fix round 1). The one writer of these files, internal/host's |
| +// edgesFileWriteClaims, takes the key and the body's box field from the |
| +// same ident.Box, so an honest box never disagrees with its key; a body |
| +// that does is not that box's publication and is refused like a body that |
| +// will not parse: refreshHosts carries this key's last good parse forward, |
| +// so it switches no live dial target and clears no pairing (vouch, never |
| +// revoke), and the key is read again next poll. |
| +// |
| +// RESIDUAL, NOT CLOSED. The key is not an authenticated identity: the |
| +// fixed-host IAM policy (infra/modules/region-host/main.tf) lets every box |
| +// put any object in the deployment bucket, so a bucket writer can write |
| +// control/edges/<victim>.json itself, with a box field that matches its |
| +// key and any EIP, host entries and stamps it likes. Such a body passes |
| +// this check; its claims still reach the election (dialBeats) and KnownHost |
| +// still admits its names to the ACME gate (deploymentHost). Closing H3-M4 |
| +// needs routing claims authenticated against authority a bucket writer |
| +// lacks (per-box signing), a design follow-up, not this check. |
| func parseEdgesFile(key string, body []byte) (edgesFileView, error) { |
| var f edgesFileView |
| if err := json.Unmarshal(body, &f); err != nil { |
diff --git a/internal/edge/hunt_H3-M4_test.go b/internal/edge/hunt_H3-M4_test.go| index 8e65fd2c5..62fc70f36 100644 |
| --- a/internal/edge/hunt_H3-M4_test.go |
| +++ b/internal/edge/hunt_H3-M4_test.go |
| @@ -9,6 +9,10 @@ import "testing" |
| // (carol here) folds it through the real Refresh -> refreshHosts -> |
| // foldHomes, where dialBeats (homemap.go:834) lets the higher stamp take the |
| // dial. SECURE: the dial target stays annie's. |
| +// |
| +// This pins only the narrowing (a body must name its key's box). The same |
| +// writer can put control/edges/mallory.json naming mallory, which passes it: |
| +// H3-M4 stays open until routing claims are authenticated (parseEdgesFile). |
| func TestHunt_H3_M4_ForgedEdgesFileTakesTheDial(t *testing.T) { |
| s := meshTestStore(t) |
| putJSON(t, s, "control/edges/annie.json", `{"v":1,"box":"annie","eip":"198.51.100.10","hosts":{"shop.example.com":{"role":"home","platform":true,"account":"bab","app":"shop","stamp":7}}}`) |
diff --git a/internal/edgesfile/edgesfile.go b/internal/edgesfile/edgesfile.go| index 5907c6dcd..c574992a7 100644 |
| --- a/internal/edgesfile/edgesfile.go |
| +++ b/internal/edgesfile/edgesfile.go |
| @@ -48,12 +48,13 @@ func Key(box string) string { return Prefix + box + ".json" } |
| // suffix, an empty box), none of which this deployment's edges loop |
| // writes. |
| // |
| -// It is also the binding every reader checks a body against (hunt H3-M4). |
| -// The bucket's writer map lets a box write its own control/edges/<box>.json |
| -// and nothing else under the prefix, so the KEY is what names the publisher; |
| -// the body's box field is only the publisher's claim about itself. A body |
| -// whose box field disagrees with its key is not that box's publication, |
| -// whatever else it says, and nothing in it may be acted on. |
| +// It is also the check every reader makes of a body: its box field must be |
| +// the box its key names. The one writer (internal/host's |
| +// edgesFileWriteClaims) takes both from the same box, so a body that |
| +// disagrees is not that box's publication, and nothing in it is acted on. |
| +// This narrows hunt H3-M4 and does not close it: a bucket writer can write |
| +// any box's key with a matching box field, since the key is not an |
| +// authenticated identity (see internal/edge's parseEdgesFile). |
| func BoxFromKey(key string) (box string, ok bool) { |
| name, ok := strings.CutPrefix(key, Prefix) |
| if !ok || strings.Contains(name, "/") { |
diff --git a/internal/edgesfile/snapshot.go b/internal/edgesfile/snapshot.go| index 7668872b9..bffddc23a 100644 |
| --- a/internal/edgesfile/snapshot.go |
| +++ b/internal/edgesfile/snapshot.go |
| @@ -249,9 +249,9 @@ func (s Snapshot) EvidenceComplete() bool { return s.Complete && s.BoxesComplete |
| // the door must tell "could not read" (503, C28) from "no box publishes |
| // this code" (codex R2-2). A single unreadable or malformed file is |
| // skipped, as before, and marks the snapshot incomplete. So is a body whose |
| -// box field names a box other than the one its key names (BoxFromKey, hunt |
| -// H3-M4): the edge refuses that body, and a reader that took it would show |
| -// an answer no edge acts on. |
| +// box field names a box other than the one its key names (BoxFromKey, the |
| +// edge's narrowing of hunt H3-M4): the edge refuses that body, and a reader |
| +// that took it would show an answer no edge acts on. |
| func ReadSnapshot(ctx context.Context, s release.Store) (Snapshot, error) { |
| keys, err := s.List(ctx, Prefix) |
| if err != nil { |
diff --git a/internal/host/steering_loop.go b/internal/host/steering_loop.go| index 0271a0792..f0fb5ad52 100644 |
| --- a/internal/host/steering_loop.go |
| +++ b/internal/host/steering_loop.go |
| @@ -52,17 +52,19 @@ import ( |
| // forever. |
| // |
| // A body that parses but whose box field names a box other than the one its |
| -// KEY names is refused, and it fails the pass (hunt H3-M4; the binding |
| -// internal/edge's parseEdgesFile applies, for the reason given there: the |
| -// writer map makes the key the publisher's identity and the body only its |
| -// claim). It is handled as a VISIBILITY fault rather than the fold's content |
| +// KEY names is refused, and it fails the pass (the check internal/edge's |
| +// parseEdgesFile makes; it narrows hunt H3-M4 and does not close it, see |
| +// there). It is handled as a VISIBILITY fault rather than the fold's content |
| // fault because of what each would do downstream: skipping the file would |
| // leave the fold short of the box the key belongs to, and a short fold |
| // withdraws that box's records, which is the revoke the forged body must |
| // never be able to cause. Failing the pass leaves the zone, and every move |
| -// target moveTargets reads from the same bodies, exactly as they were. A |
| -// body that will not parse at all is still delivered verbatim (the fold's |
| -// business, as before). |
| +// target moveTargets reads from the same bodies, exactly as they were. An |
| +// honest box cannot trip this: its key and box field come from one value |
| +// (edgesFileWriteClaims), so only a bucket writer can hold the pass, and a |
| +// bucket writer can already write any box's file. A body that will not |
| +// parse at all is still delivered verbatim (the fold's business, as |
| +// before). |
| func loadEdgesFileBodies(ctx context.Context, s release.Store) ([][]byte, error) { |
| keys, err := s.List(ctx, edgesFilePrefix) |
| if err != nil { |