CALLERS-2: the vault's secret-ask and retire callers lists go; its enrolment check stays
Every account may call every verb from H1, so secret-ask answers every caller the runtime proved and retire every caller whose warrant holds; the manifest's two lists, the config retire-callers and its file go. The enrolment verbs keep their one list, now a small type of the vault's own since mesh-sdk's Callers goes. Builds: design 47 H §752 (ADR 0682 §10's exception for the enrolment caller, H-A-11); H-A-41, H-A-66 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -247,9 +247,8 @@ restart; it is on until switched off, and `own_drift` shows it.
|
||||
## Retiring an own secret: `retire` (design 32)
|
||||
|
||||
`retire` removes one module's own secret on a node because no manifest reads it any more, and says `own-retired`
|
||||
(node, module, name, ask, caller). Two proofs: the caller is on the vault's trusted list `retire-callers` (the holder of
|
||||
the seat `mesh-config` alone, a file the mesh writes from the config value, read at start; a list that cannot be read
|
||||
allows nobody), and `warrant` is the id of a hand act that caller recorded through `mesh-hand-acts` for this verb,
|
||||
(node, module, name, ask, caller). Every caller may ask it (design 47 H §752); one proof: `warrant` is the id of a hand
|
||||
act that caller recorded through `mesh-hand-acts` for this verb,
|
||||
naming exactly the node, module, name and the ask of the operator's Approve, within a day. A bus account and the tool
|
||||
runner's `ledgers` are never retired this way. A waiter on `rotated` or `own-replaced` does not wake on it.
|
||||
|
||||
|
||||
@@ -19,10 +19,11 @@ package main
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
)
|
||||
|
||||
// HaveRead is the node-engines' have bucket as the vault reads it (its manifest's `reads`).
|
||||
|
||||
@@ -21,12 +21,13 @@ import (
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
enrollerclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshnodeenrollerclient"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
enrollerclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshnodeenrollerclient"
|
||||
|
||||
"git.novox.be/novox/mesh-contracts/identity-and-access/go/seats/meshvault"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
@@ -117,13 +118,38 @@ func (v *Vault) loginKeyRefusal(caller, publicKey string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// callers is the vault's one list of callers, of its enrolment verbs (ADR 0682 §10's exception, H-A-11, H-A-41): each
|
||||
// entry a module on any machine, <machine>.<module> or person.<name>, matched against the caller the runtime proved.
|
||||
type callers []string
|
||||
|
||||
// Allows says whether caller, as the runtime proved it, is one the list names.
|
||||
func (c callers) Allows(caller string) bool {
|
||||
if caller == "" || caller == stdio.Unproven {
|
||||
return false
|
||||
}
|
||||
for _, entry := range c {
|
||||
if entry == "" || strings.ContainsAny(entry, "*> ") {
|
||||
continue
|
||||
}
|
||||
if entry == caller {
|
||||
return true
|
||||
}
|
||||
if !strings.Contains(entry, ".") {
|
||||
if _, module, ok := strings.Cut(caller, "."); ok && module == entry && !strings.HasPrefix(caller, "person.") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// fromEnrolment refuses every caller but the seat mesh-node-enroller, as the runtime proved it.
|
||||
func (v *Vault) fromEnrolment(caller, verb string) error {
|
||||
callers := v.EnrolCallers
|
||||
if callers == nil {
|
||||
callers = stdio.Callers{EnrolmentModule}
|
||||
list := v.EnrolCallers
|
||||
if list == nil {
|
||||
list = callers{EnrolmentModule}
|
||||
}
|
||||
if !callers.Allows(caller) {
|
||||
if !list.Allows(caller) {
|
||||
if caller == "" {
|
||||
caller = stdio.Unproven
|
||||
}
|
||||
|
||||
@@ -9,10 +9,6 @@ import (
|
||||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
placing "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
enrollerclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshnodeenrollerclient"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -20,6 +16,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
placing "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
enrollerclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshnodeenrollerclient"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
|
||||
"git.novox.be/novox/mesh-contracts/identity-and-access/go/seats/meshvault"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"golang.org/x/crypto/nacl/box"
|
||||
|
||||
@@ -9,10 +9,11 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
enrollerclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshnodeenrollerclient"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
enrollerclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshnodeenrollerclient"
|
||||
)
|
||||
|
||||
// EnrolmentHeld is one enrolment token the vault holds, as secret_holders lists it: never the token or its hash.
|
||||
@@ -129,8 +130,8 @@ func enrolmentTools(env *Env) []toolDef {
|
||||
}},
|
||||
{Name: Seat + "." + RetireVerb,
|
||||
Description: "Retire one module's own secret on a node because no manifest reads it any more (design 32): removed " +
|
||||
"whole, and own-retired said (node, module, name, the ask, the caller; never a value). Answered to the holder of " +
|
||||
"the seat mesh-config alone, as the vault's list retire-callers names it, and only for a hand act it recorded " +
|
||||
"whole, and own-retired said (node, module, name, the ask, the caller; never a value). Answered to any caller, " +
|
||||
"and only for a hand act it recorded " +
|
||||
"through mesh-hand-acts for this verb naming exactly this node, module and name and the ask of the operator's Approve " +
|
||||
"(`warrant`, the act's id), read back here.",
|
||||
Input: map[string]any{"node": node, "module": str("the module whose secret it is"), "name": str("the secret's name"),
|
||||
|
||||
@@ -269,17 +269,15 @@ type AskOf struct {
|
||||
Node, Module, Name, Desk string
|
||||
}
|
||||
|
||||
// askedByFor is who asked a secret-ask as the bus says it (novox/hq ADR 0563 §8): a caller the manifest names, as the
|
||||
// runtime proved it. Any other caller is refused: no caller names itself, and none relays another's word.
|
||||
// askedByFor is who asked a secret-ask as the bus says it (novox/hq ADR 0563 §8): the caller the runtime proved, any
|
||||
// caller (design 47 H §752, H-A-41: no list of callers). A caller the runtime did not prove is refused: no caller names
|
||||
// itself, and none relays another's word.
|
||||
func (v *Vault) askedByFor(caller string, a AskOf) (string, error) {
|
||||
if v.AskCallers.Allows(caller) {
|
||||
if caller != "" && caller != stdio.Unproven {
|
||||
return askedByName(caller), nil
|
||||
}
|
||||
if caller == "" {
|
||||
caller = stdio.Unproven
|
||||
}
|
||||
return "", fmt.Errorf("secret-ask answers the callers the vault's manifest names, and %s is not one; nobody was "+
|
||||
"asked to type anything", caller)
|
||||
return "", fmt.Errorf("secret-ask answers a caller the runtime proved, and this one is %s; nobody was asked to type "+
|
||||
"anything", stdio.Unproven)
|
||||
}
|
||||
|
||||
// AskOpen records an ask for a module's own secret before any prompt opens, holding its bounds — one open ask
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -84,7 +83,6 @@ func telegramAsk(by string) AskOf {
|
||||
// it; the typed value opens only in the vault; the controller carries ciphertext only.
|
||||
func TestAnAskIsRecordedBeforeThePromptAndTheTypedValueOpensOnlyInTheVault(t *testing.T) {
|
||||
v := newVault(t, AllowList{"anchor.node-provisioner": {"own/anchor/telegram/telegram-token"}})
|
||||
v.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
opened, err := v.AskOpen("g14.claude-code", telegramAsk("g14/claude-code, via the console"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -126,7 +124,6 @@ func TestAnAskIsRecordedBeforeThePromptAndTheTypedValueOpensOnlyInTheVault(t *te
|
||||
// One open ask per secret, and three an hour (ADR 0277 §24), read from the vault's own record.
|
||||
func TestAnAskIsBoundedToOneOpenPerSecretAndThreeAnHour(t *testing.T) {
|
||||
v := newVault(t, nil)
|
||||
v.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
first, err := v.AskOpen("g14.claude-code", telegramAsk("g14.claude-code"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -167,7 +164,6 @@ func TestAnAskIsBoundedToOneOpenPerSecretAndThreeAnHour(t *testing.T) {
|
||||
}
|
||||
// An ask left open counts as open for SecretAskOpenFor only: a prompt that died does not hold the secret.
|
||||
w := newVault(t, nil)
|
||||
w.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
clock := time.Date(2026, 10, 14, 9, 0, 0, 0, time.UTC)
|
||||
w.Now = func() time.Time { return clock }
|
||||
if _, err := w.AskOpen("g14.claude-code", telegramAsk("g14.claude-code")); err != nil {
|
||||
@@ -177,13 +173,12 @@ func TestAnAskIsBoundedToOneOpenPerSecretAndThreeAnHour(t *testing.T) {
|
||||
if _, err := w.AskOpen("g14.claude-code", telegramAsk("g14.claude-code")); err != nil {
|
||||
t.Errorf("an ask left open past its time still held the secret: %v", err)
|
||||
}
|
||||
// 774 (ADR 0563 §8): a caller the manifest names asks directly, is named by its proven caller and never by the
|
||||
// asked_by it gives, and is held to the same bounds; one it does not name is refused.
|
||||
t.Run("a named caller asks itself, within the bounds", func(t *testing.T) {
|
||||
// 774 (ADR 0563 §8): a proved caller asks directly, is named by its proven caller and never by the asked_by it
|
||||
// gives, and is held to the same bounds; one the runtime did not prove is refused (design 47 H §752, H-A-41).
|
||||
t.Run("a proved caller asks itself, within the bounds", func(t *testing.T) {
|
||||
x := newVault(t, nil)
|
||||
x.AskCallers = stdio.Callers{"node-tools"}
|
||||
if _, err := x.AskOpen("ace.claude-code", telegramAsk("x")); err == nil || !strings.Contains(err.Error(), "ace.claude-code") {
|
||||
t.Errorf("a caller the manifest does not name opened an ask: %v", err)
|
||||
if _, err := x.AskOpen("unproven", telegramAsk("x")); err == nil {
|
||||
t.Errorf("an unproven caller opened an ask: %v", err)
|
||||
}
|
||||
opened, err := x.AskOpen("g14.node-tools", telegramAsk("person.operator"))
|
||||
if err != nil || opened.AskedBy != "g14.node-tools" {
|
||||
@@ -202,12 +197,11 @@ func TestAnAskIsBoundedToOneOpenPerSecretAndThreeAnHour(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// Only a caller the vault's manifest names opens an ask, and only it ends it; a value not sealed to the call's key, or
|
||||
// a call that waited too long, keeps nothing.
|
||||
func TestAnAskIsTakenFromANamedCallerAloneAndOnlySealedToItsCall(t *testing.T) {
|
||||
// Only a caller the runtime proved opens an ask, and only it ends it; a value not sealed to the call's key, or a call
|
||||
// that waited too long, keeps nothing.
|
||||
func TestAnAskIsTakenFromAProvedCallerAloneAndOnlySealedToItsCall(t *testing.T) {
|
||||
v := newVault(t, nil)
|
||||
v.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
for _, caller := range []string{"g14.node-tools", "unproven", "", "person.jochen"} {
|
||||
for _, caller := range []string{"unproven", ""} {
|
||||
if _, err := v.AskOpen(caller, telegramAsk("x")); err == nil {
|
||||
t.Errorf("%q opened an ask", caller)
|
||||
}
|
||||
@@ -448,7 +442,6 @@ func TestTheNamesOfWhatIsTakenIn(t *testing.T) {
|
||||
// Each verb takes its caller from the runtime, never from its arguments, and names its secret one way only.
|
||||
func TestTheVerbsTakeTheirCallerFromTheRuntime(t *testing.T) {
|
||||
v := newVault(t, nil)
|
||||
v.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
env := &Env{Vault: v.Vault}
|
||||
defs := definitions(env)
|
||||
var asked []map[string]any
|
||||
@@ -493,7 +486,6 @@ func TestTheVerbsTakeTheirCallerFromTheRuntime(t *testing.T) {
|
||||
// With the lock held elsewhere, AskEnd waits, and writes nothing until it is let go.
|
||||
func TestTheEndOfAnAskIsWrittenUnderTheRecordsLock(t *testing.T) {
|
||||
v := newVault(t, nil)
|
||||
v.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
opened, err := v.AskOpen("g14.claude-code", telegramAsk("g14.claude-code"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -65,8 +65,8 @@ func build() *Env {
|
||||
Assignments: Mirror{Keys: assignmentKeys, Read: readAssignment}, Emit: emit, Ask: stdio.Ask,
|
||||
Now: time.Now, Log: say, Accounts: busAccounts{}, Haves: readHave, WantRead: readWant,
|
||||
HaveKeys: func() ([]string, error) { return stdio.State(HaveRead).Keys() }, Assigner: seatAssignments, Signers: busSigners{},
|
||||
AskCallers: askCallers(os.Getenv("MESH_VAULT_SECRET_ASK_CALLERS")), EnrolCallers: askCallers(os.Getenv("MESH_VAULT_ENROLMENT_CALLERS")),
|
||||
RetireCallers: retireCallers(os.Getenv("MESH_VAULT_RETIRE_CALLERS")), Logins: busNodeLogins{}, ReadAct: readHandAct, TokenBase: TokenBaseFromFile(os.Getenv("MESH_VAULT_STATE")),
|
||||
EnrolCallers: callerList(os.Getenv("MESH_VAULT_ENROLMENT_CALLERS")),
|
||||
Logins: busNodeLogins{}, ReadAct: readHandAct, TokenBase: TokenBaseFromFile(os.Getenv("MESH_VAULT_STATE")),
|
||||
Bound: Bound{
|
||||
Get: func(key string) ([]byte, error) {
|
||||
e, err := stdio.State(BoundState).Get(key)
|
||||
@@ -414,30 +414,10 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// retireCallers reads the vault's list `retire-callers`, the file the mesh writes from its trusted config value
|
||||
// (stdio.ParseCallers): a list that cannot be read allows nobody, and says why.
|
||||
func retireCallers(path string) stdio.Callers {
|
||||
if path == "" {
|
||||
say("the vault was started without its retire-callers list (MESH_VAULT_RETIRE_CALLERS): retire answers nobody")
|
||||
return nil
|
||||
}
|
||||
raw, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
say("the retire-callers list cannot be read, so retire answers nobody: %v", err)
|
||||
return nil
|
||||
}
|
||||
callers, err := stdio.ParseCallers(raw)
|
||||
if err != nil {
|
||||
say("%v: retire answers nobody", err)
|
||||
return nil
|
||||
}
|
||||
return callers
|
||||
}
|
||||
|
||||
// askCallers are the callers the vault's manifest names for secret-ask besides the controller (novox/hq ADR 0563 §8):
|
||||
// MESH_VAULT_SECRET_ASK_CALLERS, comma-separated, each a module (on any machine), <machine>.<module> or person.<name>.
|
||||
func askCallers(list string) stdio.Callers {
|
||||
var out stdio.Callers
|
||||
// callerList is the vault's manifest's list of the enrolment verbs' callers (MESH_VAULT_ENROLMENT_CALLERS),
|
||||
// comma-separated, each a module (on any machine), <machine>.<module> or person.<name>.
|
||||
func callerList(list string) callers {
|
||||
var out callers
|
||||
for _, c := range strings.Split(list, ",") {
|
||||
if c = strings.TrimSpace(c); c != "" {
|
||||
out = append(out, c)
|
||||
|
||||
@@ -524,14 +524,10 @@ func TestTheVaultWholeMintsOnTheBusWhoeverHoldsTheLease(t *testing.T) {
|
||||
if _, err := seed.keep("own/g14/dunst/token", "a-token-value", "the test", "g14.dunst", OriginMade); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
callers := filepath.Join(dir, "retire-callers.json")
|
||||
if err := os.WriteFile(callers, []byte(`{"callers":["mesh-config"]}`), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cmd := exec.CommandContext(ctx, bin)
|
||||
cmd.Env = append(os.Environ(), "MESH_VAULT_STORE="+filepath.Join(dir, "store"), "MESH_VAULT_STATE="+filepath.Join(dir, "state"),
|
||||
"MESH_VAULT_ROOT="+root, "MESH_VAULT_LEDGER="+filepath.Join(dir, "ledger"), "MESH_RECEIVES="+filepath.Join(dir, "mesh.json"),
|
||||
"MESH_VAULT_RETIRE_CALLERS="+callers, "MESH_NODE=novox", "MESH_MODULE=mesh-vault")
|
||||
"MESH_NODE=novox", "MESH_MODULE=mesh-vault")
|
||||
stdin, _ := cmd.StdinPipe()
|
||||
stdout, _ := cmd.StdoutPipe()
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
@@ -10,13 +10,14 @@ package main
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
nodeseat "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
nodeseat "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/seal"
|
||||
"golang.org/x/crypto/nacl/box"
|
||||
)
|
||||
|
||||
@@ -22,14 +22,15 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
"git.novox.be/novox/mesh-contracts/identity-and-access/go/seats/meshvault"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
"git.novox.be/novox/mesh-contracts/identity-and-access/go/seats/meshvault"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -94,7 +93,6 @@ func aDesk(typed string, asked *[]map[string]any) func(string, map[string]any) (
|
||||
// is typed opened here alone; what crossed is a key and a sealed box.
|
||||
func TestTheVaultAsksTheDesksPromptItselfAndOnlyASealedValueCrosses(t *testing.T) {
|
||||
v := newVault(t, AllowList{"anchor.node-provisioner": {"own/anchor/telegram/telegram-token"}})
|
||||
v.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
var asked []map[string]any
|
||||
mesh := &aMesh{desk: aDesk(typedAtTheDesk, &asked)}
|
||||
v.Ask = mesh.ask
|
||||
@@ -133,7 +131,6 @@ func TestTheVaultAsksTheDesksPromptItselfAndOnlyASealedValueCrosses(t *testing.T
|
||||
// Dismissed and timed out end the ask so, and keep nothing.
|
||||
for typed, outcome := range map[string]string{"": "dismissed", "\x00timeout": "timed-out"} {
|
||||
w := newVault(t, nil)
|
||||
w.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
var a []map[string]any
|
||||
w.Ask = (&aMesh{desk: aDesk(typed, &a)}).ask
|
||||
got, err := w.AskAtDesk("g14.claude-code", telegramAsk("g14.claude-code"))
|
||||
@@ -149,7 +146,6 @@ func TestTheVaultAsksTheDesksPromptItselfAndOnlyASealedValueCrosses(t *testing.T
|
||||
}
|
||||
// Answered empty: the operator's answer, said so, nothing kept.
|
||||
e := newVault(t, nil)
|
||||
e.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
var ea []map[string]any
|
||||
e.Ask = (&aMesh{desk: aDesk(" ", &ea)}).ask
|
||||
if got, err := e.AskAtDesk("g14.claude-code", telegramAsk("g14.claude-code")); err != nil || got.Outcome != "empty" {
|
||||
@@ -157,7 +153,6 @@ func TestTheVaultAsksTheDesksPromptItselfAndOnlyASealedValueCrosses(t *testing.T
|
||||
}
|
||||
// The desk cannot be asked: refused, recorded so.
|
||||
r := newVault(t, nil)
|
||||
r.AskCallers = stdio.Callers{"g14.claude-code"}
|
||||
r.Ask = (&aMesh{}).ask
|
||||
if _, err := r.AskAtDesk("g14.claude-code", telegramAsk("g14.claude-code")); err == nil {
|
||||
t.Error("an ask nobody answered was said to be done")
|
||||
@@ -165,17 +160,18 @@ func TestTheVaultAsksTheDesksPromptItselfAndOnlyASealedValueCrosses(t *testing.T
|
||||
if asks, _ := r.Store.Asks(1); asks[0].Outcome != "refused" {
|
||||
t.Errorf("an unanswered desk recorded %+v", asks[0])
|
||||
}
|
||||
// Only the controller asks the vault to ask: anybody else is refused before any prompt.
|
||||
// Every caller the runtime proved may ask the vault to ask (design 47 H §752, H-A-41); one it did not prove is refused
|
||||
// before any prompt.
|
||||
n := newVault(t, nil)
|
||||
var na []map[string]any
|
||||
n.Ask = (&aMesh{desk: aDesk(typedAtTheDesk, &na)}).ask
|
||||
for _, caller := range []string{"g14.node-tools", "g14.claude-code", "unproven", ""} {
|
||||
for _, caller := range []string{"unproven", ""} {
|
||||
if _, err := n.AskAtDesk(caller, telegramAsk("x")); err == nil {
|
||||
t.Errorf("%q had the vault ask a desk", caller)
|
||||
}
|
||||
}
|
||||
if len(na) != 0 {
|
||||
t.Fatal("a desk was asked for a caller that is not the controller")
|
||||
t.Fatal("a desk was asked for a caller the runtime did not prove")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package main
|
||||
|
||||
// The seat's verb `retire` (design 32 *A value no longer read*, novox/hq ADR 0609): one module's own secret on one node
|
||||
// removed because no manifest reads it any more, asked by the holder of the seat mesh-config alone after the operator's
|
||||
// Approve. Two proofs, both required:
|
||||
// removed because no manifest reads it any more, asked after the operator's Approve; every caller may ask it (design 47
|
||||
// H §752, H-A-41). One proof is required:
|
||||
//
|
||||
// - the caller is on the vault's list `retire-callers`, a trusted config value of the vault (ADR 0363's form, as
|
||||
// mesh-mail-reader's `callers`), which names the holder of mesh-config alone, checked against the caller the tool
|
||||
// runner proved (stdio.Callers); and
|
||||
// - the warrant (the verb's argument, as the seat's definition names it): the id of a hand act the caller recorded
|
||||
// through mesh-hand-acts for this verb, read back here, recent, naming exactly this node, module and secret and the
|
||||
// ask whose Approve it answers (ADR 0259 §6). An act for another name warrants nothing.
|
||||
@@ -17,8 +14,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
)
|
||||
|
||||
// OwnRetiredEvent is what the vault says when it retired an own secret.
|
||||
@@ -47,18 +42,6 @@ type OwnRetired struct {
|
||||
Retired bool `json:"retired"`
|
||||
}
|
||||
|
||||
// fromRetireCallers refuses every caller the vault's list `retire-callers` does not name.
|
||||
func (v *Vault) fromRetireCallers(caller string) error {
|
||||
if !v.RetireCallers.Allows(caller) {
|
||||
if strings.TrimSpace(caller) == "" {
|
||||
caller = stdio.Unproven
|
||||
}
|
||||
return fmt.Errorf("retire is asked by the holder of the seat mesh-config alone, as the vault's list retire-callers "+
|
||||
"names it; %s is not on it (design 32)", caller)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// warrantsRetire reads the hand act back and refuses what it does not warrant for exactly this secret; it answers the
|
||||
// ask the act names.
|
||||
func (v *Vault) warrantsRetire(caller string, a RetireArgs) (ask string, err error) {
|
||||
@@ -99,9 +82,6 @@ func (v *Vault) warrantsRetire(caller string, a RetireArgs) (ask string, err err
|
||||
|
||||
// RetireOwn removes one module's own secret on a node on the warrant of a hand act, and says `own-retired`.
|
||||
func (v *Vault) RetireOwn(caller string, a RetireArgs) (OwnRetired, error) {
|
||||
if err := v.fromRetireCallers(caller); err != nil {
|
||||
return OwnRetired{}, err
|
||||
}
|
||||
secret, err := OwnSecret(a.Node, a.Module, a.Name)
|
||||
if err != nil {
|
||||
return OwnRetired{}, err
|
||||
|
||||
@@ -26,15 +26,16 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
nodeseat "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
nodeseat "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,11 +9,12 @@ package main
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
placing "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
placing "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
)
|
||||
|
||||
// AssignerReader reads the seat's assignments: every key, and one key's value (nil when there is none).
|
||||
|
||||
@@ -83,14 +83,13 @@ func TestAWantGoneRetiresItsAccountOnlyWithinTheBounds(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// 1966/CAT-V1 (design 32): `retire` removes one module's own secret on a node, and says own-retired, only for a caller on
|
||||
// the vault's list retire-callers who carries a hand act it recorded for this verb naming exactly this node, module and
|
||||
// secret. Without the act, with another name's, with another caller's or an older one, from a caller not on the list, or
|
||||
// for a bus account, nothing is removed and nothing is said; a waiter on rotated or own-replaced is not woken.
|
||||
func TestRetireRemovesAnOwnSecretOnlyOnTheWarrantOfTheListedCaller(t *testing.T) {
|
||||
// 1966/CAT-V1 (design 32): `retire` removes one module's own secret on a node, and says own-retired, only for a caller
|
||||
// who carries a hand act it recorded for this verb naming exactly this node, module and secret; every caller may ask it
|
||||
// (design 47 H §752, H-A-41: no list of callers). Without the act, with another name's, with another caller's or an older
|
||||
// one, or for a bus account, nothing is removed and nothing is said; a waiter on rotated or own-replaced is not woken.
|
||||
func TestRetireRemovesAnOwnSecretOnlyOnTheCallersWarrant(t *testing.T) {
|
||||
v := newVault(t, nil)
|
||||
const caller = "novox.mesh-config"
|
||||
v.RetireCallers = stdio.Callers{"mesh-config"}
|
||||
acts := map[string]*HandActSeen{}
|
||||
v.ReadAct = func(id string) (*HandActSeen, error) { return acts[id], nil }
|
||||
act := func(id, by, verb, what string, age time.Duration) {
|
||||
@@ -125,8 +124,7 @@ func TestRetireRemovesAnOwnSecretOnlyOnTheWarrantOfTheListedCaller(t *testing.T)
|
||||
{"no ask", caller, RetireArgs{Node: "g14", Module: "dunst", Name: "token", Warrant: "ok"}, "names the ask"},
|
||||
{"an act that names no ask", caller, RetireArgs{Node: "g14", Module: "dunst", Name: "token", Warrant: "no-ask", Ask: "ret-1"}, "a warrant retires nothing else"},
|
||||
{"an act older than a day", caller, RetireArgs{Node: "g14", Module: "dunst", Name: "token", Warrant: "old", Ask: "ret-1"}, "older than"},
|
||||
{"a caller not on the list", "g14.claude-code", RetireArgs{Node: "g14", Module: "dunst", Name: "token", Warrant: "other-caller", Ask: "ret-1"}, "retire-callers"},
|
||||
{"an unproven caller", stdio.Unproven, RetireArgs{Node: "g14", Module: "dunst", Name: "token", Warrant: "ok", Ask: "ret-1"}, "retire-callers"},
|
||||
{"an unproven caller", stdio.Unproven, RetireArgs{Node: "g14", Module: "dunst", Name: "token", Warrant: "ok", Ask: "ret-1"}, "was recorded by novox.mesh-config"},
|
||||
{"the tool runner's ledgers", caller, RetireArgs{Node: "g14", Module: "node-tools", Name: "ledgers", Warrant: "ledgers", Ask: "ret-1"}, "bus account or the tool runner's ledgers"},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
|
||||
@@ -15,11 +15,6 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
placing "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
nodeseat "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -28,6 +23,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
placing "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
nodeseat "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
|
||||
"github.com/nats-io/nats.go"
|
||||
"github.com/nats-io/nats.go/jetstream"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
||||
@@ -16,11 +16,12 @@ import (
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
enrollerclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshnodeenrollerclient"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-contracts/identity-and-access/go/seats/meshvault"
|
||||
"git.novox.be/novox/mesh-networking/modules/mesh-wireguard/go/overlay"
|
||||
|
||||
@@ -5,14 +5,15 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
placing "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
nodeseat "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
vaultclient "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient"
|
||||
"git.novox.be/novox/mesh-contracts/identity-and-access/go/seats/meshvault"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.novox.be/novox/mesh-networking/modules/mesh-wireguard/go/overlay"
|
||||
"git.novox.be/novox/mesh-sdk/go/seal"
|
||||
|
||||
@@ -12,13 +12,14 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.novox.be/novox/mesh-sdk/go/seal"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/seal"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,14 +6,15 @@ package main
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
nodeseat "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
nodeseat "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/seal"
|
||||
)
|
||||
|
||||
|
||||
@@ -46,12 +46,8 @@ type Vault struct {
|
||||
// account (ADR 0259 §8's runs-as, issue 723): the desks' secret prompt and each issuing provider's tool, which
|
||||
// the bus lets the vault's account alone call in its own name. Nil asks nobody.
|
||||
Ask func(key string, body any) (json.RawMessage, error)
|
||||
// AskCallers are the callers besides the controller that may ask secret-ask themselves, as the vault's manifest names
|
||||
// them (MESH_VAULT_SECRET_ASK_CALLERS; novox/hq ADR 0563 §8): each is named by the runtime's proof. Empty: the
|
||||
// controller alone.
|
||||
AskCallers stdio.Callers
|
||||
Now func() time.Time
|
||||
Log func(format string, args ...any)
|
||||
Now func() time.Time
|
||||
Log func(format string, args ...any)
|
||||
// Accounts is the vault's state of bus-account hashes (accounts.go, ADR 0547 clause 9): nil writes none.
|
||||
Accounts AccountStore
|
||||
// HashCost is the bcrypt cost of those hashes: zero is the controller's, bcrypt's default.
|
||||
@@ -82,10 +78,7 @@ type Vault struct {
|
||||
Signers SignersStore
|
||||
// EnrolCallers are the callers of the enrolment verbs `enrolment-token` and `node-account` and of `sign` for an
|
||||
// enrolment: the seat mesh-node-enroller (enrolment.go). Nil: that module alone.
|
||||
EnrolCallers stdio.Callers
|
||||
// RetireCallers are the callers of the seat's verb `retire`: the vault's trusted config value `retire-callers`, the
|
||||
// holder of the seat mesh-config alone (ownretire.go). Nil: nobody.
|
||||
RetireCallers stdio.Callers
|
||||
EnrolCallers callers
|
||||
// TokenBase says where the bus is and its certificate's fingerprint, for the token shown (enrolment.go): nil shows none.
|
||||
TokenBase func() (TokenBase, error)
|
||||
// Logins is the vault's state node-logins (noderotation.go): nil writes none.
|
||||
|
||||
@@ -149,25 +149,16 @@
|
||||
"mode": "0700",
|
||||
"owner": "mesh-vault",
|
||||
"unknown": "program"
|
||||
},
|
||||
{
|
||||
"id": "retire-callers",
|
||||
"trusted": true,
|
||||
"type": "file",
|
||||
"path": "${dir:state}/retire-callers.json",
|
||||
"mode": "0600",
|
||||
"owner": "mesh-vault",
|
||||
"merge": "json",
|
||||
"template": "files/retire-callers.json",
|
||||
"takes-config": [
|
||||
"retire-callers"
|
||||
]
|
||||
}
|
||||
],
|
||||
"streams": [
|
||||
{
|
||||
"name": "mesh-vault-findings",
|
||||
"events": ["finding-written.*", "finding-cleared.*", "findings-stated.*"],
|
||||
"events": [
|
||||
"finding-written.*",
|
||||
"finding-cleared.*",
|
||||
"findings-stated.*"
|
||||
],
|
||||
"max-age-days": 7,
|
||||
"max-mib": 16
|
||||
}
|
||||
@@ -190,15 +181,8 @@
|
||||
"MESH_VAULT_ROOT": "${dir:root}",
|
||||
"MESH_VAULT_STORE": "${dir:store}",
|
||||
"MESH_VAULT_STATE": "${dir:state}",
|
||||
"MESH_VAULT_SECRET_ASK_CALLERS": "node-tools",
|
||||
"MESH_VAULT_ENROLMENT_CALLERS": "mesh-enrolment",
|
||||
"MESH_VAULT_RETIRE_CALLERS": "${dir:state}/retire-callers.json"
|
||||
"MESH_VAULT_ENROLMENT_CALLERS": "mesh-enrolment"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "files",
|
||||
"kind": "archive",
|
||||
"from": "files"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -253,16 +237,6 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"retire-callers": {
|
||||
"type": "list",
|
||||
"description": "Who may call the seat's verb retire, which removes one module's own secret on a node because no manifest reads it any more: a module's name (on every machine), <machine>.<module>, or person.<name>. The holder of the seat mesh-config alone by default (design 32); the verb also needs a hand act the caller recorded for exactly that node, module and secret.",
|
||||
"trusted": true,
|
||||
"default": [
|
||||
"mesh-config"
|
||||
]
|
||||
}
|
||||
},
|
||||
"consumes": [
|
||||
"mesh-delivery-assigner.views.assignments",
|
||||
"mesh-conditions.findings-asked",
|
||||
|
||||
Reference in New Issue
Block a user