fix(api): isolate in-memory agents by session user - #53
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authenticated
/api/agentsstill used a process-globalAgentStore. Any signed-in user could list another user's agents (includingsystemPromptand tool bindings)./api/agents/[id]had noauth()at all, so GET/PATCH/DELETE worked unauthenticated. Playground chat then ran that agent.Trigger
User A
POST /api/agentswith a privatesystemPrompt. User B on the same Node processGET /api/agentssees A's agent. B canPATCH/DELETEby id, orPOST /api/playground/chatwith A'sagentIdand run A's prompt/tools.Distinct from #47 (auth-only on
[id], no owner filter), #49 (connectors), and #51 (MCP registry).Fix
ownerUserIdfromsession.user.id(ignore client-supplied owner)research-agent,code-agent) readable by every authenticated user, not writable/deletablerequireSessionUserIdhelper (same contract as fix(api): isolate connector credentials by session user #49/fix(api): isolate MCP server registry by session user #51; merge should keep one copy)Tests
pnpm exec vitest run tests/api/agents-ownership.test.tsplus fullpnpm test:run(248 tests).Not in this PR
Does not switch the live path to unused
src/lib/db/agents.ts.