Skip to content

write_user_memory accepts a finished run's id, so an agent key names another person's seat run and writes that person's notes #4121

Closed

Description

@vybe

What

POST /api/agents/{name}/user-memory (routers/public_memory.py::write_user_memory, the MEM-001 write door behind MCP write_user_memory) resolves whose memory it writes from body.execution_id through memory_subject.resolve, after checking only that the row exists and belongs to this agent. Nothing checks that the run is live, or that it is the turn the request comes from.

So an agent's own key, during any turn, can name a finished run of another person (a seat run, a one-to-one channel turn, a signed-in public turn) and replace that person's notes. ent#840 closed the sibling-key version; the agent's own key, driven by whoever it is shared with, still has it.

Found

By the merge-train's independent review of trinity#4114 (2026-10-31), whose agent search door had the same shape; the search door is being fixed on that PR (the named run must be running, and no other live turn on the agent may resolve to a different scope — the ent#926 ledger rule, fail-closed). This door is on dev already and predates that PR.

Fix

Same rule as the search door: execution.status == running, and refuse (memory_turn_ambiguous) when another live turn on the agent resolves to a different scope. Add the handler's reason to test_ent875_exec_control_routes.READ_SITES only once the read is bound. Test over real HTTP with a real agent key, not by calling the handler.

Activity

  1. added
    priority-p1
    type-bug
    theme-security
    complexity-medium
    on Oct 31, 2026
  2. webmixgamer commented on Nov 1, 2026

    @webmixgamer
    Contributor

    /claim

  3. added
    status-in-progress
    on Nov 1, 2026
  4. github-actions commented on Nov 1, 2026

    @github-actions

    Claimed by @webmixgamer. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/4121-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #4121
  5. added
    status-in-dev
    and removed
    status-in-progress
    on Nov 2, 2026
  6. removed
    status-in-dev
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-mediumpriority-p1theme-securitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions