Skip to content

fix(api): isolate connector credentials by session user - #49

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-72f3
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-72f3

Conversation

@cursor

@cursor cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

Bug and impact

Authenticated User A saves an API key / OAuth tokens via POST /api/connections (or OAuth callback). Authenticated User B on the same Node process calls GET /api/connections and receives User A's secrets. Non-owners could also PATCH/DELETE or refresh another user's OAuth tokens.

Root cause

connectorStore is a process-global singleton. Connection CRUD and OAuth refresh looked up connections with no ownerUserId filter, so any logged-in user saw and mutated every connection.

Fix

  • Add required ownerUserId on Connection
  • Scope list/get/update/delete/test/refresh to session.user.id
  • Ignore client-supplied ownerUserId on create/update
  • Require an authenticated user on OAuth callback before storing tokens

Validation

  • pnpm exec vitest run tests/lib/connector-store.test.ts tests/api/connections-route.test.ts tests/api/oauth-refresh-route.test.ts (9 passed)
  • pnpm exec tsc --noEmit
Open in Web View Automation 

The in-memory connectorStore returned every connection (including API
keys and OAuth tokens) to any authenticated caller. Scope CRUD and OAuth
refresh/callback to session.user.id and ignore client-supplied owner ids.

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

vercel Bot commented Aug 12, 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 12, 2026 11:15am

This branch was successfully deployed

1 active deployment
Preview — e17756a5 Deployed Aug 12, 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