From 7d81e8326fc15088024c9f154f0e22ff84b549c7 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 26 Oct 2026 19:22:58 +0100 Subject: [PATCH] =?UTF-8?q?frombus=20gives=20the=20composing=20node's=20co?= =?UTF-8?q?re=20credentials=20as=20the=20vault's=20boxes=20sealed=20to=20i?= =?UTF-8?q?t,=20from=20the=20same=20own=20secrets=20(issue=201126,=20ADR?= =?UTF-8?q?=200349=20=C2=A716,=20ADR=200550=20=C2=A75)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go/compose/frombus/frombus.go | 8 ++++++++ go/compose/frombus/frombus_test.go | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/go/compose/frombus/frombus.go b/go/compose/frombus/frombus.go index 1bc86f5..44cde19 100644 --- a/go/compose/frombus/frombus.go +++ b/go/compose/frombus/frombus.go @@ -210,6 +210,14 @@ func Input(ctx context.Context, r Reader, mesh Mesh, s Scope) (compose.Input, er if in.OwnSecrets, err = r.OwnSecrets(ctx, s.Node); err != nil { return compose.Input{}, fmt.Errorf("frombus: the own secrets of %s's modules: %w", s.Node, err) } + // The core's credentials travel as the vault's box sealed to the machine (ADR 0349 §16): the same values, which + // the composition reads for a core module as its kept boxes. + for _, o := range in.OwnSecrets { + if json.Valid([]byte(o.Sealed)) { + in.KeptCoreBoxes = append(in.KeptCoreBoxes, compose.CoreBox{Node: o.Node, Module: o.Module, Name: o.Name, + SealedTo: o.SealedTo, Box: json.RawMessage(o.Sealed)}) + } + } } return in, nil } diff --git a/go/compose/frombus/frombus_test.go b/go/compose/frombus/frombus_test.go index c6c5642..fedc381 100644 --- a/go/compose/frombus/frombus_test.go +++ b/go/compose/frombus/frombus_test.go @@ -122,8 +122,10 @@ func TestInput(t *testing.T) { }, Holdings: []catalogue.Held{{Claim: "mesh-private-network", Scope: "mesh", Node: "anchor", Module: overlay.Name}}, OwnSecrets: []compose.OwnSecretRow{{Node: "laptop", Module: "xterm", Name: "token", Origin: "made", SealedTo: "sk", Sealed: "{}"}}, - Tunnels: map[string]compose.FoundTunnel{"anchor": {Tunnel: tun}}, - Adopted: &compose.AdoptedTunnel{Tunnel: tun, Hub: "anchor", Adopted: true}, + // The same value as a core credential's box, for a core module (ADR 0349 §16). + KeptCoreBoxes: []compose.CoreBox{{Node: "laptop", Module: "xterm", Name: "token", SealedTo: "sk", Box: json.RawMessage("{}")}}, + Tunnels: map[string]compose.FoundTunnel{"anchor": {Tunnel: tun}}, + Adopted: &compose.AdoptedTunnel{Tunnel: tun, Hub: "anchor", Adopted: true}, // The controller's order is by address; laptop enrolled under its peer's key, and a person named the other. CarriedPeers: []compose.CarriedPeer{{PublicKey: keys["laptop"], Address: "10.77.0.2", EnrolledAs: "laptop"}, {PublicKey: "peer", Address: "10.77.0.9", Named: "phone"}},