Skip to content

test(proxy): cover CSP, CORS origin gate, rate-limit IP, and auth guard - #20

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/test-coverage-automation-eb59
Draft

test(proxy): cover CSP, CORS origin gate, rate-limit IP, and auth guard#20
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/test-coverage-automation-eb59

Conversation

@cursor

@cursor cursor Bot commented Jun 29, 2026

Copy link
Copy Markdown

Risky behavior now covered

  • Proxy CORS/origin gate (src/proxy.ts): rejects cross-origin API requests outside allowlist, blocks origin prefix spoofing (app.example.com.attacker.com), allows configured self-origin and localhost in dev, sets CSP nonce headers, handles OPTIONS preflight.
  • Rate-limit client identity (src/lib/rate-limit-client-ip.ts): pinned trusted header, comma-split fallback, x-forwarded-for/x-real-ip chain, anonymous fallback.
  • Auth production guard (src/auth.ts): mock session never activates when NODE_ENV=production, even with PLAYWRIGHT_E2E=1.

Test files added/updated

  • tests/lib/proxy.test.ts (new)
  • tests/lib/rate-limit-client-ip.test.ts (new)
  • tests/lib/auth.test.ts (new)

Why these tests materially reduce regression risk

PR #15 hardened CSP, proxy CORS, OAuth PKCE, and auth bypass guards but only isE2ERateLimitBypass had unit coverage. These tests lock down the security-critical proxy and auth paths that protect API routes from cross-origin abuse and accidental production auth bypass.

Validation

npm run test:run -- tests/lib/rate-limit-client-ip.test.ts tests/lib/proxy.test.ts tests/lib/auth.test.ts

14 tests passed.

Open in Web View Automation 

Add regression tests for proxy security layer, client IP resolution,
and production auth bypass prevention introduced in PR #15.

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

vercel Bot commented Jun 29, 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, Comment, Open in v0 Jun 29, 2026 12:10pm

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