Skip to content

Decide snapshot and undo policy for the store scrub before building it (#74 slice 2) #255

Closed as not planned

Description

@abogartz

Part of #83. Follow-up to #74, split out so the recovery-policy question has somewhere to be argued that is not blocking export redaction.

Why this is a decision ticket and not a build ticket

Slice 1 of #74 redacts on the way out of memory_export. It touches no durable data and can be built as soon as CI is green.

A store-wide scrub cannot be built until one question is answered: may an unsanitized snapshot of the pre-scrub store exist after the scrub completes? This repo's own convention is snapshot-first for every destructive operation, and that convention is what makes the scrub cosmetic. memory_undo accepts force=true for an exact rollback (src/tools/undo.ts:20), so any ordinary pre-scrub snapshot restores every secret the scrub removed, verbatim, with no audit trail beyond the undo itself.

Answering that question is a policy ruling with a user-visible consequence. It is not an implementation detail, and an agent should not pick one.

Questions to settle

  1. Recovery copies. Does the scrub write a normal snapshot, a sanitized-only copy, or nothing? @WhollyMindless proposed sanitizing snapshots alongside live rows and creating only sanitized recovery copies, which makes a false-positive redaction deliberately irreversible through ordinary undo. Is that the intended operator contract, and is it stated anywhere a user will read before running it?
  2. The false-positive path. redactSecrets (src/store/secrets.ts:27) is pattern-based. If it rewrites something that was not a credential, and no unsanitized copy is retained, what recovers it? If the answer is "nothing", that has to be in the tool description and the README, not discovered later.
  3. Dry run. Should --dry-run be mandatory-first, reporting matched families and line offsets without echoing the value, and --apply a separate explicit call?
  4. Row identity and epoch invalidation. Rewriting content in place must preserve ts as row identity. Confirm that it still invalidates an epoch under fix(inject): refresh the frozen memory block when its rows change #65's content-hashed storeVersion, and that blocklisted and blocklist-free rows behave as expected afterwards. This one is checkable and belongs in the build ticket; it is listed so the ruling does not contradict it.

Already settled, do not re-litigate

Definition of done for this ticket

A ruling comment from the maintainer answering 1 through 3, then a child ticket carrying acceptance criteria and agent:ready. This ticket is not agent-ready and must not be labelled so: it asks for a decision, and a bot cannot supply one without making the human merge a formality.

Activity

  1. added
    enhancement
    store-security
    severity:high
    agent:ready
    on Nov 2, 2026
  2. ocsi-triager commented on Nov 3, 2026

    @ocsi-triager

    osi-spec-hash: 9aeed7672b7f054e 2026-11-03T22:01:45Z - acceptance criteria frozen at this text. A later edit to the body changes this hash, and the reviewer will withhold approval until a maintainer replies spec ok.

  3. ocsi-fixer commented on Nov 4, 2026

    @ocsi-fixer

    osi-fixer: skipping this ticket — the title begins "Decide" and the body states it is a decision ticket that "must not be labelled" agent:ready. The agent:ready label looks wrong here; leaving labels untouched for a human to correct.

  4. removed
    agent:ready
    on Nov 4, 2026
  5. abogartz commented on Nov 5, 2026

    @abogartz
    OwnerAuthor

    Decision sheet — scrub recovery policy (verified current at 06e4e28: no scrub entry point exists on main; settled list above stands)

    Q1 — Recovery copies. What may exist after the scrub completes?

    • A — sanitized-only recovery (WM's proposal, recommended). The scrub snapshots the pre-scrub store through the same redactSecrets pass. The scrub promise ("no unsanitized copy remains") holds for the whole store tree; recovery still exists for structure and non-secret content.
    • B — normal snapshot, treated as secret material. Full recovery fidelity, but the leak survives in the snapshot directory until it ages out; defensible only if snapshots are declared secret-at-rest, which contradicts how memory_undo snapshots work today (plain day-file copies, viewer-reachable).
    • C — no recovery copy. Cleanest promise; makes Q2 unrecoverable by design — a redactSecrets false positive silently destroys content.

    Q2 — False-positive path (follows Q1). Under A: --dry-run shows exactly what will be rewritten before anything is rewritten; after --apply, recovery is the sanitized copy plus a human edit; the scrub records per-family match counts in evidence so a surprising count is auditable the same day. Under C there is no path — that is the argument against C.

    Q3 — Dry run.

    • A — mandatory two-step (recommended). --dry-run is the default: reports matched families, row ts values and line offsets, never echoes the matched value. --apply is a separate explicit call and re-checks that nothing changed since the preview (store epoch), refusing a stale preview.
    • B — single call with --apply and no preview. Faster for the operator, removes the safety the whole Q2 answer leans on.

    Q4 — Confirmation, not a choice. Rewrites preserve ts as row identity; storeVersion is content-hashed per #65, so an in-place rewrite invalidates epochs automatically. The implementation ticket must pin this with a test, not assume it.

    Recommendation block: A / A / A — sanitized-only recovery, audited false-positive path, mandatory preview. Each keeps a property the repo already promises instead of inventing a new one.

    Maintainer: reply per question (1A 2A 3A), or defer. On ruling, the child ticket with acceptance criteria follows and this record closes.

  6. added
    agent:ready
    on Nov 5, 2026
  7. abogartz commented on Nov 8, 2026

    @abogartz
    OwnerAuthor

    Closed — YAGNI per maintainer (2026-11-08). No snapshot/undo policy work for the store scrub until a demonstrated need exists; slice 1 (write-side redaction) already covers the live exposure.

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

    agent:readyenhancementseverity:highstore-security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions