Skip to content

feat: config-diff names the store item of each secret, and flags a changed item as ⚠ #196

Closed

Description

@groupsky

Why

nodkey broker config-diff is what the owner reads before approving a config change (for example through pullgate, #102). For a new or changed secret it prints:

⚠ secret "x": new secret in store "main", ask = "never"

It does not say which item of the store the secret reads. A change that keeps the secret's name but points it at a different item (another item ID, another project, another collection) looks the same as a harmless one, or shows no line at all if only the ID changed. So whoever can write the config can give a client a different value under a name the owner trusts.

Found in a security review on 2026-11-16 (internal/config/diff.go, the secret, project and logins cases).

Proposal

  • Every line about a new or changed [secret.*], [project.*] or [logins.*] names its store reference: the item ID (or project ID, collection ID) shortened to its last 8 characters, for example item …3f9a1c2e. Enough to match it with the item the owner made, not enough to be useful alone.
  • A change of only the item reference (same name, same rule) is a change by meaning, with a ⚠ line: ⚠ secret "x": item changed from …1111aaaa to …2222bbbb.
  • --short keeps these lines: they count as ⚠ lines, so they come first.

Done when

  • New, changed and moved references show the last 8 characters of the ID on their line, for secrets, projects and logins; tests cover each.
  • A change of only the reference is a ⚠ line; a test covers it.
  • --short keeps them first; a test covers it.
  • docs/setup.md "See what a config change means" shows an example line with an ID, and says why it is there.

Activity

  1. groupsky commented on Nov 17, 2026

    @groupsky
    ContributorAuthor

    Done in #203 (squash commit c1204ca). Evidence for each box:

    • New, changed and moved references show the last 8 characters of the ID, for secrets, projects and logins: TestDiffNamesTheItem in internal/config/diff_test.go. It covers a new secret (bws, 1password with its field, infisical with project, environment, path and name), a changed item, a secret moved to another store, a new and a changed project, a project moved, new logins, a changed collection, logins moved, and a login item rule. When two short forms are the same (also in another case), the full IDs show: the cases "the same short form" and "two item rules with the same short form".
    • A change of only the reference is a ⚠ line: TestDiffOnlyTheItem checks that it is exactly one line, ⚠ secret "github-token": item changed from …00000001 to …deadbeef.
    • --short keeps them first: TestConfigDiffShortItem in cmd/nodkey/configdiff_linux_test.go. A narrowing line sorts first by name, and the ⚠ item line still comes first.
    • docs/setup.md "See what a config change means" shows ⚠ secret "mail-password": new secret in store "main", item …3f9a1c2e, ask = "always" and an "item changed" line, and says why they are there. DESIGN.md (config-diff) and THREAT-MODEL.md say the same.

    CI was green on all checks. A security review and a correctness review found no blocking problem; their low findings (case of the short forms, two login item rules with one short form, the reference on field/environment changes) are fixed in the same PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions