Skip to content

fix(api): require auth on agents/[id] routes - #47

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

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

Conversation

@cursor

@cursor cursor Bot commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Closes an authentication gap on per-agent API routes.

Bug and impact

GET/PATCH/DELETE /api/agents/[id] had no auth() check while /api/agents required a session. Unauthenticated callers could read, overwrite, or delete in-memory agent configs (system prompts, models, tools).

Root cause

src/app/api/agents/[id]/route.ts was added without mirroring the collection route's session gate.

Fix and validation

  • Require auth() for GET, PATCH, and DELETE; return 401 when absent.
  • Added tests/api/agents-id-route.test.ts.
  • pnpm run test:run -- tests/api/agents-id-route.test.ts — pass.
Open in Web View Automation 

GET/PATCH/DELETE on /api/agents/[id] were reachable without a session while
the collection route required auth, allowing unauthenticated read/modify/delete
of in-memory agent configs.

Adds Vitest coverage for 401 and authenticated GET.

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

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

This branch was successfully deployed

1 active deployment
Preview — 3081c539 Deployed Aug 8, 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