Skip to content

A stripped stamp re-adopted on a different secret-store backend still loses what only the old backend held #2672

Open

Description

@cliffhall

Problem

Follow-up to #2630 (PR #2671, raised in its Copilot review). #2671 carries an unstamped file's missing secrets over from the namespaces its ledger records before purging them. It reads those namespaces through the current run's secret store only. The ledger records entries per store location, so the carry-over has a gap when the backend changes in between:

  1. 2.10 saves on the keychain under namespace ns1, including a confidential DCR client's client_secret.
  2. A ≤ 2.9.x save strips the stamp.
  3. The next 2.10 run lands on a different backend (locked keychain → secrets.json, or the memory fallback). It re-adopts under ns2. The carry-over reads ns1 from that backend, finds nothing, and the stamp commits. The keychain's ns1 record is correctly kept, because only a keychain run purges keychain records.
  4. A later keychain run sees a stamped file (ns2), which never falls back, and purges ns1 from the keychain. That deletes the only copy of the secret.

Why it was not fixed in #2671

The obvious fix is to reconcile missing fields from a superseded namespace into the current, stamped namespace before purging it. That is unsafe as it stands:

  • A field missing from ns2 may be one the user deliberately cleared under ns2 (a logout, a policy downgrade). Carrying ns1's value back would resurrect it. This is why a stamped file never falls back.
  • The store holds a client_secret without the client_id it belongs to. If ns2 re-registered as a public client, a carried-over secret would be paired with the wrong client.

Expected

A design that tells "never carried, because the backend was absent" apart from "cleared since". For example, the ledger could record per location whether a namespace's contents were carried into its successor, and the purge could reconcile only namespaces that were never carried, for the entries the stamped file still indexes. Alternatively, defer the purge and accept the leak, with a warning. Needs both mixed versions and a backend switch between runs, so it is narrower than #2630.

Activity

  1. added this to the v2.11.0 milestone on Oct 12, 2026
  2. added
    bugSomething isn't working
    v2Issues and PRs for v2
    on Oct 12, 2026
  3. cliffhall commented on Oct 12, 2026

    @cliffhall
    MemberAuthor

    Triage: Priority Low (total 5)

    • Severity 2 — re-authorizing recovers; needs mixed versions and a backend switch between runs
    • Urgency 1 — nothing waits on it
    • Bonuses: +1 bug label, +1 milestoned (filed through the create flow)

    Board: #28, Status Todo.

  4. modified the milestones: v2.11.0, v2.12.0 on Oct 12, 2026
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

    bugSomething isn't workingv2Issues and PRs for v2

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions