grants: every module account may put an ask on any seat (principle 6)
The bus refused the indexer's validation ask and the pipeline runner's step asks: a named ask was granted only from the seat definition's callers and a composed manifest, and both accounts were kept from the list in force without them. The operator, 2026-11-15 about 18:10 CET: no fine-grained permissions inside the mesh; every account of a module, its processes, its node and the tool runner is granted mesh.seat.*.accept.>, composed or kept. A seat's events and verbs keep their own rules until the research after G decides the whole shape.
This commit is contained in:
@@ -203,7 +203,7 @@ func TestTheCopiedComposerComposesAsTheControllers(t *testing.T) {
|
||||
for subject, want := range map[string]bool{
|
||||
"mesh.seat.operator-channel.accept.ask.node-engine-one": true,
|
||||
"mesh.seat.operator-channel.accept.cancel.node-engine-one": true,
|
||||
"mesh.seat.operator-channel.accept.ask.node-engine-two": false,
|
||||
"mesh.seat.operator-channel.accept.ask.node-engine-two": true, // any ask (principle 6)
|
||||
"$JS.API.DIRECT.GET.KV_messenger_asks.$KV.messenger_asks.node-engine-one.hand-over-1": true,
|
||||
"$JS.API.DIRECT.GET.KV_messenger_asks.$KV.messenger_asks.node-engine-two.hand-over-1": false,
|
||||
"mesh.seat." + EngineSeat + ".event.done.one": true,
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Design 47 G §543, §544, §600: a build seat's ask names its asker, each queue has a named worker beside main's, an asker
|
||||
// is granted the queues of its kinds under its own seat's name alone, and main's subject is the checker's and the builder's.
|
||||
// Design 47 G §543, §544, §600: a build seat's ask names its asker and each queue has a named worker beside main's; any module may
|
||||
// put any ask (principle 6, the operator 2026-11-15).
|
||||
func TestNamedAsks(t *testing.T) {
|
||||
build := Seat{Name: "node-build-go", Scope: "node", Accepts: []string{"delivery", "check", "recheck"}, PulledByKind: true,
|
||||
AcceptCallers: map[string][]string{
|
||||
@@ -22,29 +22,18 @@ func TestNamedAsks(t *testing.T) {
|
||||
return p
|
||||
}
|
||||
const base = "mesh.seat.node-build-go.accept."
|
||||
for _, c := range []struct {
|
||||
who Principal
|
||||
want map[string]bool
|
||||
}{
|
||||
{asker("runner-module", "mesh-pipeline-runner"), map[string]bool{
|
||||
base + "check.mesh-pipeline-runner": true, base + "delivery.mesh-pipeline-runner": false,
|
||||
base + "check.mesh-catalog": false, base + "check": false, base + "delivery": false}},
|
||||
{asker("an-indexer", "mesh-catalog"), map[string]bool{
|
||||
base + "check.mesh-catalog": true, base + "check.mesh-pipeline-runner": false, base + "recheck.mesh-catalog": false}},
|
||||
{asker("the-builder", "mesh-builds"), map[string]bool{
|
||||
base + "delivery.mesh-builds": true, base + "delivery": true, base + "check": true, base + "check.mesh-builds": false}},
|
||||
{asker("the-checker", "mesh-delivery-checker"), map[string]bool{
|
||||
base + "check.mesh-delivery-checker": true, base + "recheck.mesh-delivery-checker": true, base + "recheck": true,
|
||||
base + "delivery.mesh-delivery-checker": false}},
|
||||
{asker("a-stranger"), map[string]bool{base + "check": false, base + "delivery": false, base + "check.a-stranger": false}},
|
||||
} {
|
||||
perms, err := PermissionsFor(c.who)
|
||||
// Principle 6 (the operator, 2026-11-15): every module's account may put an ask on any queue of any seat, under any asker's
|
||||
// name or none (AnySeatSubject); the callers lists withhold nothing.
|
||||
for _, who := range []Principal{asker("runner-module", "mesh-pipeline-runner"), asker("an-indexer", "mesh-catalog"),
|
||||
asker("the-builder", "mesh-builds"), asker("the-checker", "mesh-delivery-checker"), asker("a-stranger")} {
|
||||
perms, err := PermissionsFor(who)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for subject, want := range c.want {
|
||||
if got := MayPublish(perms, subject); got != want {
|
||||
t.Errorf("%s may publish %s: %v, want %v", c.who.Module, subject, got, want)
|
||||
for _, subject := range []string{base + "check", base + "delivery", base + "check.mesh-catalog", base + "recheck.mesh-delivery-checker",
|
||||
base + "check." + who.Module} {
|
||||
if !MayPublish(perms, subject) {
|
||||
t.Errorf("%s may not publish %s", who.Module, subject)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,6 +735,11 @@ func PermissionsFor(p Principal) (Permissions, error) {
|
||||
if slices.Contains([]Kind{KindModule, KindNodeTools, KindNode, KindProcess}, p.Kind) && !slices.Contains(perms.Publish, StreamNamesSubject) {
|
||||
perms.Publish = append(perms.Publish, StreamNamesSubject)
|
||||
}
|
||||
// The same accounts may put an ask on any seat (AnySeatSubject, principle 6), in the list's order.
|
||||
if slices.Contains([]Kind{KindModule, KindNodeTools, KindNode, KindProcess}, p.Kind) && !slices.Contains(perms.Publish, AnySeatSubject) {
|
||||
perms.Publish = append(perms.Publish, AnySeatSubject)
|
||||
sort.Strings(perms.Publish)
|
||||
}
|
||||
return perms, nil
|
||||
}
|
||||
|
||||
@@ -773,6 +778,12 @@ func RunnerNewEventGrants(r Records) map[string][]string {
|
||||
// StreamNamesSubject is the request for the names of the bus's streams, granted to every account.
|
||||
const StreamNamesSubject = "$JS.API.STREAM.NAMES"
|
||||
|
||||
// AnySeatSubject is every seat's asks: each queue of each seat, named by any asker or none. Inside the mesh every module is trusted
|
||||
// (principle 6), so every account of a module, its processes, its node and the tool runner may put an ask on any seat, and no seat
|
||||
// definition's callers list or manifest's invokes withholds one (the operator, 2026-11-15 about 18:10 CET, until the research after
|
||||
// G on dropping fine-grained permissions decides the whole shape). A seat's events and its verbs keep their own rules.
|
||||
const AnySeatSubject = "mesh.seat.*.accept.>"
|
||||
|
||||
func permissionsFor(p Principal) (Permissions, error) {
|
||||
for _, part := range []struct{ what, value string }{
|
||||
{"node", p.Node}, {"module", p.Module}, {"process", p.Process},
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user