Skip to content

memory_merge_review authorizes before resolving session identity (host reach unproven) #260

Closed

Description

@WhollyMindless

Proposed classification: bug, store-security, severity:low unless a host can reach it. Labels require maintainer permissions, so these are suggestions for your triage.

Finding

memory_merge_review authorizes with readerFromSid(sid) (src/tools/merge-review.ts:40) without first awaiting bindSessionIdentity(sid) (src/index.ts:393). memory_remember, memory_update, memory_import and memory_init all resolve identity first.

For a session the instance hasn't seen, toolIds binds it provisionally to the instance's directory. Authorization can therefore run against the wrong repository, which is the boundary #131 and #204 protect.

Reproduction

A harness probe at 3d9a1df (since merged). The plugin is loaded in repo A, with two repo-A rows seeded, and capture.session.row says the session's directory is repo B:

Order of calls Result
memory_merge_review called with no prompt hook first Merge resolved and the repo-A row retired; session.get was never called
Prompt hook runs first, then the same call Refused: "the loser belongs to another repository"

What is not established

  • No real host has shown this. The prompt hook awaits bindSessionIdentity (src/index.ts:516), so a normal turn is covered. The gap needs a tool call in a plugin instance that hasn't seen a prompt hook. I have not shown a host can do that.
  • Other paths don't close the gap. tool.execute.before only does bookkeeping (src/index.ts:442), and the execution.started API bind isn't awaited (src/index.ts:579).
  • Other tools are unprobed. memory_forget and memory_undo don't call bindSessionIdentity either, but I only probed merge.

Decision requested

Either await bindSessionIdentity(sid) before authorizing in these tools, which looks like one line each, or record that the prompt hook is the guarantee and that the difference from the write tools is intended. Accept, narrow, defer or decline as you see fit.

Found by Claude during review of #259. No fix is in progress.

Activity

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

    @ocsi-triager

    osi-spec-hash: 306e42228970cbbf 2026-11-03T16:09:28Z - 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.

  4. added
    fix:working
    fix:pr-open
    and removed
    fix:working
    on Nov 3, 2026
  5. added a commit that references this issue on Nov 3, 2026
  6. abogartz-opencode-self-improvement commented on Nov 3, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.15.14 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  7. WhollyMindless commented on Nov 3, 2026

    @WhollyMindless
    ContributorAuthor

    Verified #269 is merged and the original four regressions pass; no duplicate implementation of the closed issue is needed. Following the user request to continue this work, I reproduced the pending-lookup follow-up discussed during our earlier review: park the first merge call inside session.get, then issue a second merge for the same session. On current main 24734a0, session.get is called once but the second call resolves the merge and retires the repo-A loser before the parked lookup reports the caller is in repo B; the first call then correctly refuses. This is a deterministic temporary-store/harness probe, not evidence that a real host reaches this interleaving. Taking a separate follow-up PR to share pending identity lookups, preserving the shipped #269 authorization calls and the existing completed-lookup cache. I will reference #260 without reopening it or changing its frozen body; #126 revival semantics stay separate.

  8. added 2 commits that reference this issue on Nov 3, 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

    agent:readybugfix:pr-openreleasedseverity:mediumstore-security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions