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).
This commit is contained in:
@@ -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") {
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user