Skip to content

fix(api): isolate in-memory agents by session user - #53

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-a4e7
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-a4e7

Conversation

@cursor

@cursor cursor Bot commented Aug 23, 2026

Copy link
Copy Markdown

Authenticated /api/agents still used a process-global AgentStore. Any signed-in user could list another user's agents (including systemPrompt and tool bindings). /api/agents/[id] had no auth() at all, so GET/PATCH/DELETE worked unauthenticated. Playground chat then ran that agent.

Trigger

User A POST /api/agents with a private systemPrompt. User B on the same Node process GET /api/agents sees A's agent. B can PATCH/DELETE by id, or POST /api/playground/chat with A's agentId and run A's prompt/tools.

Distinct from #47 (auth-only on [id], no owner filter), #49 (connectors), and #51 (MCP registry).

Fix

Tests

pnpm exec vitest run tests/api/agents-ownership.test.ts plus full pnpm test:run (248 tests).

Not in this PR

Does not switch the live path to unused src/lib/db/agents.ts.

Open in Web View Automation 

Process-global AgentStore listed, mutated, and executed every user's
agents. Stamp ownerUserId from the session, ignore client-supplied
owner ids, and keep seed agents as read-only shared templates.

Co-authored-by: esadrianno <esadrianno@gmail.com>
@vercel

vercel Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v0-agent-kit Ready Ready Preview, v0 Aug 23, 2026 11:14am

This branch was successfully deployed

1 active deployment
Preview — 7c76e5f8 Deployed Aug 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant