diff --git a/DESIGN.md b/DESIGN.md index 2515aae..e36c2c1 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -3532,6 +3532,22 @@ config-diff does not know". A test fails when a field is in neither list. Text from a config is quoted and each line cleaned with `claim.Line`. +Each line about a new, changed or moved store reference names it (issue +#196): a new `[secret.*]` names its item (and the field for 1password, +when it is not `password`; for infisical, the project, environment, +path and name), a new `[project.*]` its project, and a new `[logins.*]` +its collection. A changed ID is its own line, such as `secret "x": item +changed from …1111aaaa to …2222bbbb`, and a move to another store names +the reference too. IDs are shown by their last 8 characters (`idText`). +IDs are not secret; the short form keeps the line easy to read, and is +enough for the owner to match the item they made. When the short forms +of the old and the new ID are the same (also in another case), or two +item rules of one `[logins.*]` have the same short form, the IDs are +shown in full, so a change always shows. A change of the field, +environment, path or name of a secret names the item too. An ID with a +character that IDs do not have is quoted in full. All these lines are +marked, so `--short` puts them first. + `--short` fits one Telegram message: at most `--max-chars` characters, counted in UTF-16 code units as Telegram counts them (default 3500, from 200 to 100000). It puts the lines that widen first, then the others, and cuts with "and N more". When the lines that widen diff --git a/THREAT-MODEL.md b/THREAT-MODEL.md index 267d7c5..cb18fb4 100644 --- a/THREAT-MODEL.md +++ b/THREAT-MODEL.md @@ -1521,6 +1521,11 @@ not know as narrowing, and a field of the config that it does not compare by name is still compared and marked; a test fails when a field is in neither list. The short form never drops a line that widens: when they do not all fit, it says how many there are. It reads no credential. +A writer of the config could keep the name of a secret that the owner +trusts and point it at another item, project or collection. So each +line about a new or changed reference names its ID by the last 8 +characters, and a change of only the ID is a line with `⚠` (issue #196). +The owner checks the ID against the item they made. It is no control of the broker: it only helps a person to decide. **T43. A website login goes to a page that the client claims.** diff --git a/cmd/nodkey/configdiff_linux_test.go b/cmd/nodkey/configdiff_linux_test.go index 0aba649..48e389e 100644 --- a/cmd/nodkey/configdiff_linux_test.go +++ b/cmd/nodkey/configdiff_linux_test.go @@ -78,7 +78,7 @@ func TestConfigDiff(t *testing.T) { for _, want := range []string{ "⚠ SSH key \"deploy\": may now log in to every host in known_hosts\n", " secret \"db-password\": removed\n", - "⚠ secret \"gone\": new secret in store \"vault\", ask = \"always\"\n", + "⚠ secret \"gone\": new secret in store \"vault\", item …00000002, ask = \"always\"\n", } { if !strings.Contains(out, want) { t.Errorf("stdout %q has no %q", out, want) @@ -200,3 +200,32 @@ func TestConfigDiffShort(t *testing.T) { t.Errorf("size %d > %d: %q", size(got), minShortChars, got) } } + +// TestConfigDiffShortItem: a change of only the item of a secret is a ⚠ +// line, and --short puts it first, before the lines that narrow (issue +// #196). +func TestConfigDiffShortItem(t *testing.T) { + t.Setenv("CREDENTIALS_DIRECTORY", "") + if os.Getuid() == 0 { + t.Skip("runs as root; this test is for a user that is not root") + } + e := newBrokerEnv(t, brokerOptions{}) + oldDir, newDir := diffDirs(t, e) + cfg := filepath.Join(newDir, "broker.toml") + data, err := os.ReadFile(cfg) //nolint:gosec // G304: the test's own file. + if err != nil { + t.Fatal(err) + } + // The item of a secret changes (widens), and the "never" secret goes + // to "always" (narrows). The narrowing line is first by name. + data = bytes.Replace(data, []byte(idGitHub), []byte("00000000-0000-0000-0000-00003f9a1c2e"), 1) + data = bytes.Replace(data, []byte("ask = \"never\"\nnotify = false"), []byte("ask = \"always\""), 1) + writeTestFile(t, cfg, data, 0o600) + code, out, errOut := runDiff(t, "--short", "--max-chars", "200", oldDir, newDir) + lines := strings.Split(strings.TrimSuffix(out, "\n"), "\n") + want := "⚠ secret \"github-token\": item changed from …00000001 to …3f9a1c2e" + if code != exitFailure || errOut != "" || len(lines) != 2 || lines[0] != want || + !strings.HasPrefix(lines[1], " secret \"db-password\"") { + t.Fatalf("exit %d, stdout %q, stderr %q; want the first line %q", code, out, errOut, want) + } +} diff --git a/docs/setup.md b/docs/setup.md index c0d7acb..6cd7b8b 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -1500,10 +1500,21 @@ change. An example: ```text ⚠ client "build-1": new client +⚠ secret "mail-password": new secret in store "main", item …3f9a1c2e, ask = "always" +⚠ secret "github-token": item changed from …1111aaaa to …2222bbbb ⚠ secret "backup-token": new rule: never ask (ask changed from "always" to "never") SSH key "deploy": host "web-2" removed ``` +A line about a new or changed secret, `[project.*]` or `[logins.*]` +names what it reads in the store: the item ID (or the project ID or +collection ID), shortened to its last 8 characters, such as `…3f9a1c2e`. +Check that it is the item you made. A secret can keep a name that you +trust and read another item: that line is `⚠` too. For a secret in +Infisical, the line names the project ID, the environment, the path and +the name. When two IDs end with the same 8 characters, the line shows +both IDs in full. + `--short` gives a short form for one Telegram message, at most `--max-chars` characters (3500 by default). It puts the lines with `⚠` first. If they do not all fit, it says how many there are, and you must diff --git a/internal/config/diff.go b/internal/config/diff.go index e95f416..25450c2 100644 --- a/internal/config/diff.go +++ b/internal/config/diff.go @@ -6,6 +6,7 @@ import ( "reflect" "slices" "strconv" + "strings" "time" "golang.org/x/crypto/ssh" @@ -250,7 +251,7 @@ func (d *differ) secrets(old, next *Broker) { what := "secret " + q(name) switch { case !inOld: - d.add("secret", name, true, "%s: new secret in store %s, %s", what, q(n.Store), ruleText(n.Rule)) + d.add("secret", name, true, "%s: new secret in store %s, %s, %s", what, q(n.Store), secretRef(n), ruleText(n.Rule)) for _, c := range n.Clients { d.add("secret", name, true, "%s: client %s may now ask for it", what, q(c)) } @@ -259,17 +260,27 @@ func (d *differ) secrets(old, next *Broker) { d.add("secret", name, false, "%s: removed", what) continue } + if o.Store != n.Store { + d.add("secret", name, true, "%s: now another item: store changed from %s to %s, %s", + what, q(o.Store), q(n.Store), secretRef(n)) + } + if o.ID != n.ID { + a, b := idPair(o.ID, n.ID) + d.add("secret", name, true, "%s: item changed from %s to %s", what, a, b) + } + if o.Project != n.Project { + a, b := idPair(o.Project, n.Project) + d.add("secret", name, true, "%s: now another item: project changed from %s to %s", what, a, b) + } for _, p := range []struct{ key, old, new string }{ - {"store", o.Store, n.Store}, - {"id", o.ID, n.ID}, {"field", o.Field, n.Field}, - {"project", o.Project, n.Project}, {"environment", o.Environment, n.Environment}, {"path", o.Path, n.Path}, {"name", o.SecretName, n.SecretName}, } { if p.old != p.new { - d.add("secret", name, true, "%s: now another item: %s changed from %s to %s", what, p.key, q(p.old), q(p.new)) + d.add("secret", name, true, "%s: now another item: %s changed from %s to %s, %s", what, p.key, + q(p.old), q(p.new), secretRef(n)) } } d.clientList("secret", name, what, "ask for it", o.Clients, n.Clients) @@ -288,7 +299,7 @@ func (d *differ) projects(old, next *Broker) { switch { case !inOld: d.add("project", name, true, "%s: new: every secret of project %s in store %s, %s", - what, q(n.Project), q(n.Store), ruleText(n.Rule)) + what, idText(n.Project), q(n.Store), ruleText(n.Rule)) for _, c := range n.Clients { d.add("project", name, true, "%s: client %s may now ask for its secrets", what, q(c)) } @@ -297,13 +308,13 @@ func (d *differ) projects(old, next *Broker) { d.add("project", name, false, "%s: removed", what) continue } - for _, p := range []struct{ key, old, new string }{ - {"store", o.Store, n.Store}, - {"project", o.Project, n.Project}, - } { - if p.old != p.new { - d.add("project", name, true, "%s: now other secrets: %s changed from %s to %s", what, p.key, q(p.old), q(p.new)) - } + if o.Store != n.Store { + d.add("project", name, true, "%s: now other secrets: store changed from %s to %s, project %s", + what, q(o.Store), q(n.Store), idText(n.Project)) + } + if o.Project != n.Project { + a, b := idPair(o.Project, n.Project) + d.add("project", name, true, "%s: now other secrets: project changed from %s to %s", what, a, b) } d.clientList("project", name, what, "ask for its secrets", o.Clients, n.Clients) d.rule("project", name, what, o.Rule, n.Rule) @@ -321,32 +332,34 @@ func (d *differ) logins(old, next *Broker) { switch { case !inOld: d.add("logins", name, true, "%s: new website logins of collection %s in store %s, %s", - what, q(n.Collection), q(n.Store), ruleText(n.Rule)) + what, idText(n.Collection), q(n.Store), ruleText(n.Rule)) for _, c := range n.Clients { d.add("logins", name, true, "%s: client %s may now ask for a login", what, q(c)) } - for _, id := range slices.Sorted(maps.Keys(n.Items)) { - d.add("logins", name, true, "%s: item %s has its own rule: %s", what, q(id), ruleText(n.Items[id].Rule)) + items := slices.Sorted(maps.Keys(n.Items)) + for _, id := range items { + d.add("logins", name, true, "%s: item %s has its own rule: %s", what, itemText(id, items), ruleText(n.Items[id].Rule)) } continue case !inNew: d.add("logins", name, false, "%s: removed", what) continue } - for _, p := range []struct{ key, old, new string }{ - {"store", o.Store, n.Store}, - {"collection", o.Collection, n.Collection}, - } { - if p.old != p.new { - d.add("logins", name, true, "%s: now other logins: %s changed from %s to %s", what, p.key, q(p.old), q(p.new)) - } + if o.Store != n.Store { + d.add("logins", name, true, "%s: now other logins: store changed from %s to %s, collection %s", + what, q(o.Store), q(n.Store), idText(n.Collection)) + } + if o.Collection != n.Collection { + a, b := idPair(o.Collection, n.Collection) + d.add("logins", name, true, "%s: now other logins: collection changed from %s to %s", what, a, b) } d.clientList("logins", name, what, "ask for a login", o.Clients, n.Clients) d.rule("logins", name, what, o.Rule, n.Rule) - for _, id := range sortedUnion(o.Items, n.Items) { + items := sortedUnion(o.Items, n.Items) + for _, id := range items { oi, inO := o.Items[id] ni, inN := n.Items[id] - iw := what + " item " + q(id) + iw := what + " item " + itemText(id, items) switch { case !inO: d.add("logins", name, true, "%s: has its own rule now, in place of the collection's: %s", iw, ruleText(ni.Rule)) @@ -405,6 +418,64 @@ func (d *differ) keys(old, next *Broker) { } } +// idText is the ID of an item, a project or a collection in a store, +// shortened to its last 8 characters, such as "…3f9a1c2e" (issue #196). +// That is enough for the owner to match it with the item in the store, +// and too little to be of use alone. An ID of 8 characters or less, or +// with a character that IDs do not have, is quoted in full. +func idText(id string) string { + r := []rune(id) + idChar := func(c rune) bool { + return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '-' || c == '_' + } + if len(r) <= idChars || strings.ContainsFunc(id, func(c rune) bool { return !idChar(c) }) { + return q(id) + } + return "…" + string(r[len(r)-idChars:]) +} + +// idChars is the number of characters of an ID that idText shows. +const idChars = 8 + +// idPair is idText of two IDs that differ. When their short forms are +// the same, also in another case, it gives both IDs in full, so that a +// change always shows. +func idPair(old, next string) (string, string) { + a, b := idText(old), idText(next) + if strings.EqualFold(a, b) { + return q(old), q(next) + } + return a, b +} + +// itemText is idText of id, one of ids. When another ID in ids has the +// same short form, also in another case, it gives id in full, so that two +// items never look like one. +func itemText(id string, ids []string) string { + for _, other := range ids { + if other != id && strings.EqualFold(idText(other), idText(id)) { + return q(id) + } + } + return idText(id) +} + +// secretRef names the item that a [secret.*] section reads: the item's +// ID shortened, and the field for 1password when it is not "password"; +// for infisical, the project's ID shortened, the environment, the path +// and the secret's name. +func secretRef(s Secret) string { + if s.ID == "" && s.Project != "" { + return fmt.Sprintf("project %s, environment %s, path %s, name %s", + idText(s.Project), q(s.Environment), q(s.Path), q(s.SecretName)) + } + ref := "item " + idText(s.ID) + if s.Field != "" && s.Field != "password" { + ref += ", field " + q(s.Field) + } + return ref +} + func hostsText(hosts []string) string { if len(hosts) == 0 { return "every host in known_hosts" diff --git a/internal/config/diff_test.go b/internal/config/diff_test.go index 4d352a3..b6a1cbf 100644 --- a/internal/config/diff_test.go +++ b/internal/config/diff_test.go @@ -115,7 +115,7 @@ func TestDiffMarksWidening(t *testing.T) { "store = \"vault\"\nid = \"00000000-0000-0000-0000-000000000001\""}}, want: `secret "github-token": now another item: store changed from "main" to "vault"`}, {name: "another item", new: []edit{{"00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000009"}}, - want: `secret "github-token": now another item: id changed`}, + want: `secret "github-token": item changed from …00000001 to …00000009`}, {name: "another key file", new: []edit{{"/ssh-deploy", "/bw-master-password"}}, want: `SSH key "deploy": file changed`}, {name: "listen", new: []edit{{"192.0.2.10:7743", "192.0.2.11:7743"}}, want: `listen: changed from "192.0.2.10:7743" to "192.0.2.11:7743"`}, {name: "tls_key", new: []edit{{"/broker-tls-key", "/ssh-backup"}}, want: "tls_key: changed"}, @@ -299,3 +299,146 @@ func ntfyWith(b *Broker, f func(*Ntfy)) *Broker { c.Ntfy = &n return c } + +// TestDiffNamesTheItem: each line about a new, changed or moved store +// reference names the item, project or collection by the last 8 +// characters of its ID (issue #196). So a change that keeps a name the +// owner trusts but reads another item shows. +func TestDiffNamesTheItem(t *testing.T) { + const ( + id1 = "00000000-0000-4000-8000-1111aaaa1111" + id2 = "00000000-0000-4000-8000-2222bbbb2222" + col1 = "0a1b2c3d-4e5f-4a6b-8c7d-9e0f3f9a1c2e" + col2 = "1b2c3d4e-5f6a-4b7c-8d9e-0f1a7c6d5e4f" + ) + base := func() *Broker { + b := reloadBase() + b.Stores = map[string]Store{"main": {Name: "main", Type: StoreBWS}, "other": {Name: "other", Type: StoreBWS}, + "vault": {Name: "vault", Type: StoreBW}, "vault2": {Name: "vault2", Type: StoreBW}, + "op": {Name: "op", Type: StoreOnePassword}, "inf": {Name: "inf", Type: StoreInfisical}} + b.Secrets = map[string]Secret{"token": {Name: "token", Store: "main", ID: id1, Clients: []string{"laptop"}, + Rule: Rule{Ask: AskAlways}}} + b.Projects = map[string]Project{"ci": {Name: "ci", Store: "main", Project: id1, Clients: []string{"laptop"}, + Rule: Rule{Ask: AskAlways}}} + b.Logins = map[string]Logins{"web": {Name: "web", Store: "vault", Collection: col1, Clients: []string{"laptop"}, + Rule: Rule{Ask: AskAlways}, Items: map[string]LoginItemRule{}}} + return b + } + with := func(f func(b *Broker)) *Broker { + b := base() + f(b) + return b + } + empty := with(func(b *Broker) { b.Secrets, b.Projects, b.Logins = nil, nil, nil }) + for _, c := range []struct { + name string + old, next *Broker + want string + }{ + {"a new secret", empty, base(), `secret "token": new secret in store "main", item …aaaa1111, ask = "always"`}, + {"a new 1password secret", empty, with(func(b *Broker) { + b.Secrets["token"] = Secret{Name: "token", Store: "op", ID: "abcdefghijklmnopqrstuvwxyz", Field: "otp", + Clients: []string{"laptop"}, Rule: Rule{Ask: AskAlways}} + }), `secret "token": new secret in store "op", item …stuvwxyz, field "otp", ask = "always"`}, + {"a new infisical secret", empty, with(func(b *Broker) { + b.Secrets["token"] = Secret{Name: "token", Store: "inf", Project: id2, Environment: "prod", Path: "/", + SecretName: "TOKEN", Clients: []string{"laptop"}, Rule: Rule{Ask: AskAlways}} + }), `secret "token": new secret in store "inf", project …bbbb2222, environment "prod", path "/", name "TOKEN", ask`}, + {"a secret's item", base(), with(func(b *Broker) { s := b.Secrets["token"]; s.ID = id2; b.Secrets["token"] = s }), + `secret "token": item changed from …aaaa1111 to …bbbb2222`}, + {"a secret moved", base(), with(func(b *Broker) { s := b.Secrets["token"]; s.Store = "other"; b.Secrets["token"] = s }), + `secret "token": now another item: store changed from "main" to "other", item …aaaa1111`}, + {"an infisical project", with(func(b *Broker) { + b.Secrets["token"] = Secret{Name: "token", Store: "inf", Project: id1, Environment: "prod", Path: "/", + SecretName: "TOKEN", Clients: []string{"laptop"}, Rule: Rule{Ask: AskAlways}} + }), with(func(b *Broker) { + b.Secrets["token"] = Secret{Name: "token", Store: "inf", Project: id2, Environment: "prod", Path: "/", + SecretName: "TOKEN", Clients: []string{"laptop"}, Rule: Rule{Ask: AskAlways}} + }), `secret "token": now another item: project changed from …aaaa1111 to …bbbb2222`}, + {"a new project", empty, base(), `project "ci": new: every secret of project …aaaa1111 in store "main"`}, + {"a project's ID", base(), with(func(b *Broker) { p := b.Projects["ci"]; p.Project = id2; b.Projects["ci"] = p }), + `project "ci": now other secrets: project changed from …aaaa1111 to …bbbb2222`}, + {"a project moved", base(), with(func(b *Broker) { p := b.Projects["ci"]; p.Store = "other"; b.Projects["ci"] = p }), + `project "ci": now other secrets: store changed from "main" to "other", project …aaaa1111`}, + {"new logins", empty, base(), `logins "web": new website logins of collection …3f9a1c2e in store "vault"`}, + {"a collection", base(), with(func(b *Broker) { l := b.Logins["web"]; l.Collection = col2; b.Logins["web"] = l }), + `logins "web": now other logins: collection changed from …3f9a1c2e to …7c6d5e4f`}, + {"logins moved", base(), with(func(b *Broker) { l := b.Logins["web"]; l.Store = "vault2"; b.Logins["web"] = l }), + `logins "web": now other logins: store changed from "vault" to "vault2", collection …3f9a1c2e`}, + {"an item rule", base(), with(func(b *Broker) { + l := b.Logins["web"] + l.Items = map[string]LoginItemRule{id2: {ID: id2, Clients: []string{"laptop"}, Rule: Rule{Ask: AskNever}}} + b.Logins["web"] = l + }), `logins "web" item …bbbb2222: has its own rule now`}, + {"the same short form", base(), with(func(b *Broker) { + s := b.Secrets["token"] + s.ID = "99999999-0000-4000-8000-1111aaaa1111" + b.Secrets["token"] = s + }), `secret "token": item changed from "` + id1 + `" to "99999999-0000-4000-8000-1111aaaa1111"`}, + {"the same short form in another case", base(), with(func(b *Broker) { + s := b.Secrets["token"] + s.ID = "99999999-0000-4000-8000-1111AAAA1111" + b.Secrets["token"] = s + }), `secret "token": item changed from "` + id1 + `" to "99999999-0000-4000-8000-1111AAAA1111"`}, + {"two item rules with the same short form", with(func(b *Broker) { + l := b.Logins["web"] + l.Items = map[string]LoginItemRule{id2: {ID: id2, Clients: []string{"laptop"}, Rule: Rule{Ask: AskAlways}}} + b.Logins["web"] = l + }), with(func(b *Broker) { + l := b.Logins["web"] + other := "99999999-0000-4000-8000-2222bbbb2222" + l.Items = map[string]LoginItemRule{other: {ID: other, Clients: []string{"laptop"}, Rule: Rule{Ask: AskNever}}} + b.Logins["web"] = l + }), `logins "web" item "99999999-0000-4000-8000-2222bbbb2222": has its own rule now`}, + {"an infisical environment", with(func(b *Broker) { + b.Secrets["token"] = Secret{Name: "token", Store: "inf", Project: id1, Environment: "prod", Path: "/", + SecretName: "TOKEN", Clients: []string{"laptop"}, Rule: Rule{Ask: AskAlways}} + }), with(func(b *Broker) { + b.Secrets["token"] = Secret{Name: "token", Store: "inf", Project: id1, Environment: "dev", Path: "/", + SecretName: "TOKEN", Clients: []string{"laptop"}, Rule: Rule{Ask: AskAlways}} + }), `secret "token": now another item: environment changed from "prod" to "dev", project …aaaa1111, environment "dev"`}, + } { + t.Run(c.name, func(t *testing.T) { + changes := Diff(c.old, c.next) + got, ok := findChange(changes, c.want) + if !ok || !got.Widens || !strings.HasPrefix(got.String(), "⚠ ") { + t.Fatalf("no marked change with %q; the diff:\n%s", c.want, diffText(changes)) + } + if _, ok := findChange(changes, "does not know"); ok { + t.Errorf("a known change is also an unknown one:\n%s", diffText(changes)) + } + for _, ch := range changes { + for _, full := range []string{id1, id2, col1, col2} { + if !strings.HasPrefix(c.name, "the same short form") && !strings.HasPrefix(c.name, "two item") && + strings.Contains(ch.Text, full) { + t.Errorf("a full ID in %q", ch.Text) + } + } + } + }) + } +} + +// TestDiffOnlyTheItem: a change of only the item of a secret, with the +// same name and rule, is one line, and it is marked (issue #196). +func TestDiffOnlyTheItem(t *testing.T) { + changes := diffCase{new: []edit{{"00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-0000deadbeef"}}}.run(t) + if len(changes) != 1 || !changes[0].Widens || + changes[0].String() != `⚠ secret "github-token": item changed from …00000001 to …deadbeef` { + t.Fatalf("the diff:\n%s", diffText(changes)) + } +} + +func TestIDText(t *testing.T) { + for in, want := range map[string]string{ + "00000000-0000-4000-8000-1111aaaa1111": "…aaaa1111", + "abcdefgh": `"abcdefgh"`, + "": `""`, + "abc def ghi jkl": `"abc def ghi jkl"`, + "aaaaaaaa\nbbbbbbbbb": `"aaaaaaaa\nbbbbbbbbb"`, + } { + if got := idText(in); got != want { + t.Errorf("idText(%q) = %s, want %s", in, got, want) + } + } +} diff --git a/internal/config/logins_test.go b/internal/config/logins_test.go index 32b51f9..a37e420 100644 --- a/internal/config/logins_test.go +++ b/internal/config/logins_test.go @@ -136,11 +136,11 @@ func TestDiffLogins(t *testing.T) { new: []edit{{"preapprove = true\n", "preapprove = true\n\n[[logins.web.items]]\nid = \"" + testItem + "\"\nclients = [\"laptop\"]\nask = \"always\"\n"}}, want: "has its own rule now"}, true}, {diffCase{name: "an item gets another client", old: []edit{added}, new: []edit{{"clients = [\"backup-box\"]\nask = \"always\"", "clients = [\"backup-box\", \"laptop\"]\nask = \"always\""}}, - want: `item "` + testItem2 + `": client "laptop" may now ask for it`}, true}, + want: `item …4f3a2b1c: client "laptop" may now ask for it`}, true}, {diffCase{name: "logins removed", old: []edit{added}, new: []edit{{loginsTOML, "[key.deploy]"}}, want: `logins "web": removed`}, false}, {diffCase{name: "an item's window", old: []edit{added}, new: []edit{{"window = \"30m\"", "window = \"1h\""}}, - want: `item "` + strings.ToLower(testItem) + `": window changed from 30m to 1h`}, true}, + want: `item …3e2f1a0b: window changed from 30m to 1h`}, true}, } { t.Run(c.name, func(t *testing.T) { changes := c.run(t)