Skip to content

fix(auth): block PLAYWRIGHT_E2E stub session in production - #54

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/high-severity-issues-726e
Draft

cursor[bot] wants to merge 2 commits into
mainfrom
cursor/high-severity-issues-726e

Conversation

@cursor

@cursor cursor Bot commented Aug 31, 2026

Copy link
Copy Markdown

Summary

Restores the production auth guard that commit 3244a28 dropped when extracting shouldUseStubAuthSession from src/auth.ts.

Bug

  • File/function: src/lib/auth-mock-session.ts:shouldUseStubAuthSession
  • Trigger: Deploy with NODE_ENV=production and PLAYWRIGHT_E2E=1 (or any accidental env copy from Playwright/E2E). Any caller of auth() then receives the fixed stub user 00000000-0000-0000-0000-000000000001 with no credentials.
  • Impact: Complete authentication bypass in production — every request is the same fake session.
  • Distinct from fix(builder): prevent undo from reverting multiple edits at once #40–fix(api): isolate in-memory agents by session user #53: Those cover builder races, agents/[id] missing auth, store owner isolation, execution overwrite, and setup SSRF — none cover the stub-session production footgun.

Root cause

PR #15 intentionally required NODE_ENV !== "production" and a dev/E2E flag. The Turbopack stub extraction kept only PLAYWRIGHT_E2E=1 || development, and a unit test locked in the insecure behavior.

Fix

  • Hard-return false when NODE_ENV === "production".
  • Keep stub for development and for Playwright (NODE_ENV=test + PLAYWRIGHT_E2E=1 per playwright.config.ts).
  • Update unit tests to assert the production block and the Playwright path.

Validation

npm run test:run -- tests/lib/auth-mock-session.test.ts — 6 passed.

Open in Web View Automation 

Restore the PR #15 double-guard that commit 3244a28 dropped when
extracting shouldUseStubAuthSession. PLAYWRIGHT_E2E=1 must not
authenticate as the fixed stub user when NODE_ENV=production.
Playwright keeps working via NODE_ENV=test + PLAYWRIGHT_E2E=1.

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

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

This branch was successfully deployed

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