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.
44 lines
2.2 KiB
Go
44 lines
2.2 KiB
Go
package grants
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
|
|
"mesh-grants/internal/buscompose"
|
|
)
|
|
|
|
// Design 47 G A-383, A-384: a runner's account kept from the list in force gains the rights of hearing new events and the streams'
|
|
// names, and loses nothing; every account may ask any seat (principle 6); a ledger's account gains none of them.
|
|
func TestAKeptRunnerGainsWhatEveryRunnerCarries(t *testing.T) {
|
|
own := map[string][]string{"novox.node-tools": buscompose.NewEventGrants([]string{"EVENTS"})}
|
|
kept := map[string]User{"novox.node-tools": {User: "novox.node-tools", Publish: []string{"a"}}, "ledger.novox.m": {User: "ledger.novox.m", Publish: []string{"b"}}}
|
|
users, kept := withEveryAccountsRights([]User{{User: "novox.node-tools", Publish: []string{"a"}}}, kept, own)
|
|
if !slices.Contains(kept["novox.node-tools"].Publish, buscompose.AnySeatSubject) {
|
|
t.Errorf("the kept runner may not ask a seat: %v", kept["novox.node-tools"].Publish)
|
|
}
|
|
for _, u := range []User{users[0], kept["novox.node-tools"]} {
|
|
for _, want := range []string{"a", buscompose.StreamNamesSubject, "$JS.API.CONSUMER.CREATE.EVENTS.*", "$JS.FC.EVENTS.>"} {
|
|
if !slices.Contains(u.Publish, want) {
|
|
t.Errorf("the runner lacks %s: %v", want, u.Publish)
|
|
}
|
|
}
|
|
}
|
|
if got := kept["ledger.novox.m"].Publish; !slices.Equal(got, []string{"b"}) {
|
|
t.Errorf("a ledger's account = %v", got)
|
|
}
|
|
}
|
|
|
|
// Principle 6 (the operator, 2026-11-15): a module's account kept from the list in force may put an ask on any seat, named by any
|
|
// asker (a composed one has it from buscompose.PermissionsFor); an enrolling node's account gains none.
|
|
func TestAKeptModuleAccountMayAskAnySeat(t *testing.T) {
|
|
kept := map[string]User{"novox.mesh-delivery-pipeline": {User: "novox.mesh-delivery-pipeline", Publish: []string{"x"}},
|
|
"enrol.ace": {User: "enrol.ace", Publish: []string{"y"}}}
|
|
_, kept = withEveryAccountsRights(nil, kept, nil)
|
|
if !slices.Contains(kept["novox.mesh-delivery-pipeline"].Publish, buscompose.AnySeatSubject) {
|
|
t.Errorf("a kept module account may not ask a seat: %v", kept["novox.mesh-delivery-pipeline"].Publish)
|
|
}
|
|
if got := kept["enrol.ace"].Publish; !slices.Equal(got, []string{"y"}) {
|
|
t.Errorf("an enrolling node's account = %v", got)
|
|
}
|
|
}
|