Grant a module's bus state asked in requires to the accounts that run its code
The grants part wrote a binding into a membership on the bus module's created, but granted its subjects to no account but the ledger's, so distribution's program and the tool runner carrying it were refused their own key-value, object store and stream entries (issue 1966, ADR 0595 §1, design 25 § 12.2). The kept bindings now reach Declared in the same pass that writes them into the membership, and one function, boundOf, grants each to the module's own account and the tool runner, as its old section is granted; a process's bus.state names a key-value entry as an old state. The composed membership carries the bindings, so grants_membership's two sides agree. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -2,6 +2,7 @@ package buscompose
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"slices"
|
||||
|
||||
"github.com/nats-io/nats.go/jetstream"
|
||||
|
||||
@@ -97,14 +98,15 @@ func objectNames(objects []ObjectBucket) []string {
|
||||
func writesOwnObjects(p Principal, pattern string) bool {
|
||||
switch p.Kind {
|
||||
case KindModule:
|
||||
for _, b := range p.Objects {
|
||||
// Its own, from the old section or bound in `requires` (boundOf, issue 1966).
|
||||
for _, b := range append(slices.Clone(p.Objects), boundOf(p.Module, p.Bound).Objects...) {
|
||||
if pattern == "$O."+b+".>" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
case KindNodeTools:
|
||||
for _, d := range p.Carries {
|
||||
for _, b := range objectNames(d.Objects) {
|
||||
for _, b := range append(objectNames(d.Objects), boundOf(d.Module, d.Bindings).Objects...) {
|
||||
if pattern == "$O."+b+".>" {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user