Skip to content

memory_export has no repo-visibility filter — any session can export every repository's rows #143

Closed

Description

@abogartz

memory_export writes the entire active store across all repositories — there is no visibility filter on the export path.

Evidence

src/portable.ts:50 (unchanged by #133, still present on fix/security-127-129):

export async function exportMemories(opts: ExportOptions = {}): Promise<ExportResult> {
  let mems = (await loadAll()).filter(isActive);
  if (opts.scope) mems = mems.filter((m) => m.scope === opts.scope);

memory_export is a model-facing tool. A session in repo A can call memory_export and receive repo B's private rows (content, tags, kw, repo stamps) in the written JSONL — the exact breadth that #127's fix made a property of the entry point (ADMIN_READER) for every other read path.

This contradicts:

Distinct from existing issues

Suggested fix

Filter exportMemories by the caller's Reader (threaded from the tool entry like every other #127 path): a plugin session exports its repo + global rows. Keep full breadth for out-of-plugin/admin callers (ADMIN_READER), and consider an explicit allRepos: true option gated to the admin reader for the cross-machine-hop use case. Regression test: seed private rows in repos A and B, export from A, assert B's marker is absent.

Found during the adversarial review of #133/#135 (2026-10-26).

Activity

  1. added
    store-security
    on Oct 27, 2026
  2. WhollyMindless commented on Oct 28, 2026

    @WhollyMindless
    Contributor

    Taking this one — working on branch fix/security-143-153 off 91f7a56 (0.14.13), covering #143 and #153 together since they are the same defect principle: the last two model-facing surfaces that bypass the entry-point reader — export (read side) and undo (write side).

    Approach, regression-first in the house style:

    Not touching #74 (content scrubbing is a separate contract from visibility) or #24 (already fixed by #145).

  3. added a commit that references this issue on Oct 28, 2026
  4. WhollyMindless commented on Oct 28, 2026

    @WhollyMindless
    Contributor

    @abogartz This is verified fixed by #156, merged in 1bd2123 and included in v0.14.15. Independent verification of final head 834ccba confirmed session-scoped export, fail-closed unresolved-session behavior, and collision-safe default export names. Verification: #156 (comment) . The separate explicit-filename replacement decision remains tracked in #159. Please close this issue as completed; GitHub denied this account permission to close it.

  5. added
    verified-on-main
    on Oct 30, 2026
  6. abogartz commented on Oct 30, 2026

    @abogartz
    OwnerAuthor

    Fixed — export breadth is now a property of the reader

    src/portable.ts:150-151:

    const reader = readerFromSid(opts.sessionID);
    let mems = (await loadAll()).filter(isActive).filter((m) => isVisibleTo(m, reader));

    The tool entry threads it (src/index.ts:1118-1119: exportMemories({ scope, file, sessionID: sid })), so a plugin session exports its own repo plus global rows, while an absent/"?" sid resolves the ambient reader and keeps full-store breadth for viewer/CLI maintenance — exactly the ADMIN_READER split every other #127 path uses.

    The regression test this ticket asked for exists as test/export-visibility.test.ts, and it covers the shape you specified plus two more:

    • an export run by repo A's session omits repo B's private rows (the cross-repo marker assertion)
    • session-less (viewer/CLI-shaped) callers keep full breadth — the entry-point property
    • an unbound session's export carries no foreign rows (fail-closed)
    • two sessions exporting in the same second keep separate artifacts

    Both contradictions you cited are therefore now true as written: #133's "breadth is a property of the entry point, never of a missing session", and the README's "project A's facts never surface in project B".

    Unaffected: #159 stays open as the decision record for the explicit-file: replace case in the shared exports/ namespace. That is a substitution question, not a content-visibility question, and this fix does not touch it.


    Severity triage 2026-10-30 — reviewed against main @ 525ed89 (v0.14.24). Labeled verified-on-main: the behavior this ticket describes no longer exists, so there is nothing to build. Full-suite baseline at that commit: 722 pass / 12 skip / 0 fail. Closing is your call; the evidence is here so the claim is checkable rather than asserted.

  7. abogartz commented on Nov 2, 2026

    @abogartz
    OwnerAuthor

    Closing on the verified-on-main call. Fixed by PR #156 (merged 2026-10-28): memory_export filters by repo visibility, and default export destinations are now unique per call (stamp + randomUUID, O_EXCL when no file is named).

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

    store-securityverified-on-main

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions