From f09daabec3a8791b4d2ba44c4d5102ed40a3f570 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 13 Oct 2026 20:32:50 +0200 Subject: [PATCH] A withheld change line in the note keeps its key's name; SDK at 5933eb7 (the review of mesh-controller #304) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The router's fallback said a refused note line as "(a line carrying … is withheld here)", so the operator could not tell which setting held a value they were not shown. A change's line now keeps its key; any other line, or one whose key is refused too, is said withheld whole. The SDK pin moves to mesh-sdk 5933eb7, where no two asks digest the same. --- modules/claude-code/go.mod | 2 +- modules/claude-code/go.sum | 2 ++ modules/desk-channel/go.mod | 2 +- modules/desk-channel/go.sum | 2 ++ modules/mesh-knowledge/go.mod | 2 +- modules/mesh-knowledge/go.sum | 2 ++ modules/messenger/cmd/messenger/holder.go | 19 +++++++++++++++++- modules/messenger/cmd/messenger/whole_test.go | 20 +++++++++++++++++++ modules/messenger/go.mod | 2 +- modules/messenger/go.sum | 2 ++ modules/telegram/go.mod | 2 +- modules/telegram/go.sum | 2 ++ 12 files changed, 53 insertions(+), 6 deletions(-) diff --git a/modules/claude-code/go.mod b/modules/claude-code/go.mod index 3ae9efa8..cc52e29f 100644 --- a/modules/claude-code/go.mod +++ b/modules/claude-code/go.mod @@ -2,6 +2,6 @@ module claude-code go 1.25.0 -require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d +require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 require gopkg.in/yaml.v3 v3.0.1 diff --git a/modules/claude-code/go.sum b/modules/claude-code/go.sum index e31a5b11..c26c88fc 100644 --- a/modules/claude-code/go.sum +++ b/modules/claude-code/go.sum @@ -4,6 +4,8 @@ git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629 h1:7TYFV1Q6 git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d h1:HEJyqorKktrkJPeeJdwEo0kdrJjH3fm/YVS9MGftCqY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 h1:r5xIo5qWOXQdCSMxvqJy8kV4U+P/QWXFK6971Ha6wU8= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/modules/desk-channel/go.mod b/modules/desk-channel/go.mod index fc97ce5b..71de4c12 100644 --- a/modules/desk-channel/go.mod +++ b/modules/desk-channel/go.mod @@ -2,4 +2,4 @@ module deskchannel go 1.22 -require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d +require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 diff --git a/modules/desk-channel/go.sum b/modules/desk-channel/go.sum index 0df2f17b..0371ccdf 100644 --- a/modules/desk-channel/go.sum +++ b/modules/desk-channel/go.sum @@ -4,3 +4,5 @@ git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629 h1:7TYFV1Q6 git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d h1:HEJyqorKktrkJPeeJdwEo0kdrJjH3fm/YVS9MGftCqY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 h1:r5xIo5qWOXQdCSMxvqJy8kV4U+P/QWXFK6971Ha6wU8= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= diff --git a/modules/mesh-knowledge/go.mod b/modules/mesh-knowledge/go.mod index 0d489090..9666cf4c 100644 --- a/modules/mesh-knowledge/go.mod +++ b/modules/mesh-knowledge/go.mod @@ -3,7 +3,7 @@ module mesh-knowledge go 1.25.0 require ( - git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d + git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 github.com/jackc/pgx/v5 v5.11.0 github.com/nats-io/nats-server/v2 v2.11.17 github.com/nats-io/nats.go v1.51.0 diff --git a/modules/mesh-knowledge/go.sum b/modules/mesh-knowledge/go.sum index fdc7fe21..600f78a9 100644 --- a/modules/mesh-knowledge/go.sum +++ b/modules/mesh-knowledge/go.sum @@ -4,6 +4,8 @@ git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629 h1:7TYFV1Q6 git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d h1:HEJyqorKktrkJPeeJdwEo0kdrJjH3fm/YVS9MGftCqY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 h1:r5xIo5qWOXQdCSMxvqJy8kV4U+P/QWXFK6971Ha6wU8= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0= github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/modules/messenger/cmd/messenger/holder.go b/modules/messenger/cmd/messenger/holder.go index 29795a39..67310e9a 100644 --- a/modules/messenger/cmd/messenger/holder.go +++ b/modules/messenger/cmd/messenger/holder.go @@ -896,7 +896,7 @@ func (h *Holder) sayOn(r *Record, what, kind string) Message { continue } if refusal, ok := passes(line); !ok { - line = "(a line carrying " + refusal.What + " is withheld here)" + line = withheldLine(line, refusal, passes) } note = append(note, line) } @@ -1146,3 +1146,20 @@ func roughly(d time.Duration) string { } return fmt.Sprintf("%d days", int(d.Hours()/24)) } + +// withheldLine is a note line the rule refused, said withheld: a change's line ("+ key: value") keeps its key's name, +// so the operator knows which setting holds a value they are not shown (the review of mesh-controller #304); any +// other line, or one whose key the rule refuses too, is said withheld whole. +func withheldLine(line string, refusal Refusal, passes func(string) (Refusal, bool)) string { + if len(line) > 2 && strings.ContainsRune("+~-=", rune(line[0])) && line[1] == ' ' { + key := line[2:] + if i := strings.IndexAny(key, ": "); i > 0 { + key = key[:i] + } + named := line[:2] + key + " (a value carrying " + refusal.What + " is withheld here)" + if _, ok := passes(named); ok { + return named + } + } + return "(a line carrying " + refusal.What + " is withheld here)" +} diff --git a/modules/messenger/cmd/messenger/whole_test.go b/modules/messenger/cmd/messenger/whole_test.go index 092b7b9b..93b3e4d3 100644 --- a/modules/messenger/cmd/messenger/whole_test.go +++ b/modules/messenger/cmd/messenger/whole_test.go @@ -208,3 +208,23 @@ func TestEveryKeyAndItsWholeValueIsInTheNoteWhereTheSenderIsProven(t *testing.T) t.Errorf("an ask whose whole details carry a secret was taken") } } + +// A change's line the rule refuses keeps its key's name in the note (the review of mesh-controller #304): the +// operator knows which setting holds a value they are not shown. A line whose key the rule refuses too is said +// withheld whole. +func TestAWithheldChangeLineKeepsItsKey(t *testing.T) { + for line, want := range map[string]string{ + "+ password: hunter2": "+ password (a value carrying a value given to a secret's name is withheld here)", + "~ shares: /mnt/media (was: x)": "~ shares (a value carrying a file path is withheld here)", + "Read it at /etc/x": "(a line carrying a file path is withheld here)", + "+ ghp_abcdefghijklmnopqrstuvwxyz0123456789: 1": "(a line carrying ", + } { + refusal, ok := Check(line) + if ok { + t.Fatalf("%q passes the content rule", line) + } + if got := withheldLine(line, refusal, Check); !strings.HasPrefix(got, want) { + t.Errorf("%q: %q, want %q", line, got, want) + } + } +} diff --git a/modules/messenger/go.mod b/modules/messenger/go.mod index d03c1405..2f961edb 100644 --- a/modules/messenger/go.mod +++ b/modules/messenger/go.mod @@ -2,4 +2,4 @@ module messenger go 1.22 -require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d +require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 diff --git a/modules/messenger/go.sum b/modules/messenger/go.sum index f3f5b3ae..3d45e21c 100644 --- a/modules/messenger/go.sum +++ b/modules/messenger/go.sum @@ -4,3 +4,5 @@ git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629 h1:7TYFV1Q6 git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d h1:HEJyqorKktrkJPeeJdwEo0kdrJjH3fm/YVS9MGftCqY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 h1:r5xIo5qWOXQdCSMxvqJy8kV4U+P/QWXFK6971Ha6wU8= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= diff --git a/modules/telegram/go.mod b/modules/telegram/go.mod index f27b7fe6..6d9c8073 100644 --- a/modules/telegram/go.mod +++ b/modules/telegram/go.mod @@ -2,4 +2,4 @@ module telegram go 1.22 -require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d +require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 diff --git a/modules/telegram/go.sum b/modules/telegram/go.sum index 0df2f17b..0371ccdf 100644 --- a/modules/telegram/go.sum +++ b/modules/telegram/go.sum @@ -4,3 +4,5 @@ git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629 h1:7TYFV1Q6 git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013141520-9588871d6629/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d h1:HEJyqorKktrkJPeeJdwEo0kdrJjH3fm/YVS9MGftCqY= git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013145622-f4745447ba6d/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44 h1:r5xIo5qWOXQdCSMxvqJy8kV4U+P/QWXFK6971Ha6wU8= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261013182924-5933eb757d44/go.mod h1:GFuZUElBZ9A++mxgIKo97aXXo+kV0uJ/UkbhQPPIbrY=