From 485c2f10b1fb5640bb4588ae2204326b36535932 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 15 Nov 2026 18:51:42 +0100 Subject: [PATCH] grants: every account may receive a chunked verb's answer (principle 6) The validation of mesh-delivery #219 failed: the check program on shanks asked seat:mesh-catalog.input, whose answer comes in chunks, and the bus delivered none, since only an account naming the verb in invokes was granted its chunk subjects. Inside the mesh any module may call any seat verb (the operator, 2026-11-15). --- .../mesh-grants/internal/buscompose/buscompose_test.go | 8 ++++---- modules/mesh-grants/internal/buscompose/chunks.go | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/mesh-grants/internal/buscompose/buscompose_test.go b/modules/mesh-grants/internal/buscompose/buscompose_test.go index 191dbae7c..a9afefdc8 100644 --- a/modules/mesh-grants/internal/buscompose/buscompose_test.go +++ b/modules/mesh-grants/internal/buscompose/buscompose_test.go @@ -1462,10 +1462,10 @@ func chunkSubjectsFollowTheAnswerer(t *testing.T) { if rec := perms["a.recovery.recover"]; !has(rec.Subscribe, chunks) || !has(rec.Publish, acks) { t.Errorf("the process naming the verb may not hear chunks and send acks") } - for _, u := range []string{"a.admin-ish", "a.nats"} { - if p := perms[u]; has(p.Subscribe, chunks) || has(p.Publish, chunks) || has(p.Publish, acks) { - t.Errorf("%s, naming no chunked verb, is granted chunk subjects: %v / %v", u, p.Publish, p.Subscribe) - } + // Principle 6 (the operator, 2026-11-15): an account naming no chunked verb still hears its chunks and sends their acks; it + // never sends the chunks, which are the answering account's. + if p := perms["a.admin-ish"]; !has(p.Subscribe, chunks) || !has(p.Publish, acks) || has(p.Publish, chunks) { + t.Errorf("a.admin-ish may not hear chunks and send acks, or may send chunks: %v / %v", p.Publish, p.Subscribe) } keeper := perms["a.nats.keeper"] if !MayPublish(keeper, "$JS.API.STREAM.RESTORE.SECRETS") || !MayPublish(keeper, "$JS.SNAPSHOT.RESTORE.SECRETS.abc") { diff --git a/modules/mesh-grants/internal/buscompose/chunks.go b/modules/mesh-grants/internal/buscompose/chunks.go index b7bb2ae94..81401043f 100644 --- a/modules/mesh-grants/internal/buscompose/chunks.go +++ b/modules/mesh-grants/internal/buscompose/chunks.go @@ -53,7 +53,10 @@ func chunkGrants(p Principal) (pub, sub []string) { if (p.Kind == KindProcess || p.Kind == KindModule) && slices.Contains(p.AnswersSeat, "seat:"+c.Seat+"."+c.Verb) { pub, sub = append(pub, chunkSubject(c)), append(sub, ackServed(c)) } - if slices.Contains(p.Invokes, "seat:"+c.Seat+"."+c.Verb) { + // Any account of a module, its processes, its node or the tool runner may receive a verb's chunks, invoked or not + // (principle 6; the operator, 2026-11-15: no fine-grained permissions inside the mesh): a check program on a build seat + // asks seat:mesh-catalog.input and no manifest of the seat's holder names it. + if slices.Contains(p.Invokes, "seat:"+c.Seat+"."+c.Verb) || slices.Contains([]Kind{KindModule, KindProcess, KindNodeTools, KindNode}, p.Kind) { sub, pub = append(sub, chunkSubject(c)), append(pub, ackSubject(c)) } }