LeakRay
CORS · Origin Reflection · Passive Audit

CORS Misconfiguration & Reflection Checker

Detect cross-origin misconfigurations where your server blindly reflects untrusted Origin headers alongside Access-Control-Allow-Credentials: true—allowing malicious sites to read authenticated user data.

01 · Exact Passive Checks

What LeakRay inspects on your live URL

Read /bot passive safety guarantees →
Rule ID & CheckWhat It InspectsWhy It's Passive & Safe
cors-misconfiguration
CORS Arbitrary Origin Reflection + Credentials
Sends a benign unauthenticated probe with Origin: https://evil-check.invalid and flags responses that echo that untrusted origin in Access-Control-Allow-Origin together with Access-Control-Allow-Credentials: true.Strictly passive GET header check without cookies, tokens, or state-changing requests.
cookie-security-flags
Session Cookie SameSite & Secure Flags
Checks Set-Cookie headers on session cookies for missing SameSite, Secure, or HttpOnly flags that amplify cross-origin credential exposure.Inspects only unauthenticated response headers without logging in or replaying cookies.
security-headers-core
CSP, Framing & Content-Type Policies
Verifies complementary browser isolation headers including Content-Security-Policy, frame-ancestors/X-Frame-Options, and X-Content-Type-Options.Reads standard HTTP response headers from a single passive GET request.
cross-origin-isolation
Cross-Origin-Opener-Policy & Permissions-Policy
Checks whether COOP and Permissions-Policy isolate your browsing context and restrict sensitive browser capabilities.Passive response header analysis only.

02 · Vulnerable vs. Fixed

Common production leak pattern and the exact fix

Vulnerable
ts
// Vulnerable: Dynamically echoing any Origin with credentials enabled
export function applyCors(req: Request, headers: Headers) {
  const origin = req.headers.get("origin");
  if (origin) {
    // HIGH RISK: Trusts every website on the internet with user cookies
    headers.set("Access-Control-Allow-Origin", origin);
    headers.set("Access-Control-Allow-Credentials", "true");
  }
}
Fixed
ts
// Fixed: Enforce an explicit origin allowlist and set Vary: Origin
const ALLOWED_ORIGINS = new Set([
  "https://app.example.com",
  "https://admin.example.com",
]);

export function applyCors(req: Request, headers: Headers) {
  const origin = req.headers.get("origin");
  if (origin && ALLOWED_ORIGINS.has(origin)) {
    headers.set("Access-Control-Allow-Origin", origin);
    headers.set("Access-Control-Allow-Credentials", "true");
    headers.set("Vary", "Origin");
  }
}

03 · AI Fix Prompt

Paste into Cursor, Claude Code, Lovable, or Bolt

Fix CORS origin reflection and credential exposure across my API and web routes:
1. Search the codebase for `Access-Control-Allow-Origin`, `cors(`, and `Access-Control-Allow-Credentials`.
2. Replace any dynamic `req.headers.origin` reflection or overly broad regex (like `.includes("myapp.com")`) with an exact `Set` allowlist of trusted production origins.
3. Add `Vary: Origin` whenever `Access-Control-Allow-Origin` varies by request origin so CDNs do not cache cross-origin headers incorrectly.
4. Remove `Access-Control-Allow-Credentials: true` on public unauthenticated endpoints that do not require cookies or Authorization headers.

04 · Developer FAQ

Frequently asked questions

Why is reflecting Origin with Access-Control-Allow-Credentials: true worse than wildcard *?
Browsers forbid combining Access-Control-Allow-Origin: * with Access-Control-Allow-Credentials: true. Developers often work around that by echoing req.headers.origin dynamically—which bypasses the browser safeguard and lets any malicious site read authenticated responses from logged-in users.
Is Access-Control-Allow-Origin: * always a vulnerability?
No. A wildcard * header without Access-Control-Allow-Credentials is completely safe for intentionally public, unauthenticated APIs or static assets. LeakRay focuses on high-signal credentialed origin reflection to avoid false-positive noise.
How does LeakRay test CORS safely without attacking my app?
LeakRay sends a single unauthenticated GET request containing a harmless synthetic header (Origin: https://evil-check.invalid) and inspects the returned Access-Control-Allow-Origin and Access-Control-Allow-Credentials headers.
Why should I include Vary: Origin when using an allowlist behind Cloudflare or Vercel?
Without Vary: Origin, a CDN or shared proxy can cache an Access-Control-Allow-Origin response generated for one origin and serve it to requests from another origin, causing broken fetches or unintended header leakage.

More Passive Scanners

Supabase · PostgREST · Passive Audit

Supabase RLS & Key Exposure Checker

Passively scan your live app for leaked Supabase service_role keys, exposed PostgREST schemas, and missing RLS signals. Zero signup, <15s.

Open scanner
Next.js · App Router & Pages Router · Passive Audit

Next.js Production Security Scanner

Audit live Next.js apps for __NEXT_DATA__ secret leaks, debug stack traces, exposed source maps, .env files, and missing security headers.

Open scanner
JS Bundles · Entropy + Context Validation · Passive Audit

Leaked API Key & Frontend Secret Scanner

Scan your live HTML and JavaScript bundles for leaked Stripe, OpenAI, Anthropic, Gemini, AWS, and GitHub keys—without false-positive noise.

Open scanner
Server Config · Dotfiles · Passive Audit

Exposed .env & .git File Checker

Check if your live website publicly exposes /.env, /.git/HEAD, or backup config files. Passive read-only URL scan with instant fixes. Zero signup.

Open scanner
Firebase · Firestore · Passive Audit

Firebase & Firestore Security Scanner

Passively audit live Firebase apps for leaked Admin SDK keys, exposed .env files, public source maps, and weak security headers without public apiKey noise.

Open scanner
Cursor · Lovable · Bolt · v0 · Passive Audit

Security Scanner for Vibe-Coded Apps

Free pre-launch security check for AI-built apps from Cursor, Claude Code, Lovable, Bolt, and v0. Catch leaked keys, open files, and missing headers.

Open scanner
JavaScript Bundles · .js.map · Passive Audit

Production Source Map Exposure Checker

Check if your live Next.js, Vite, or React app publicly exposes .js.map source maps. Passive URL scan with framework-specific fixes and AI prompts.

Open scanner
Headers · CORS · Cookies · Passive Audit

HTTP Security Headers & CORS Checker

Check HSTS, CSP, SRI, COOP, CORS credential reflection, and cookie flags — plus JS secret & file checks that header-only scanners miss. Zero signup.

Open scanner
Git Metadata · /.git/HEAD · Passive Audit

Exposed .git Directory & Config Checker

Check if your live site publicly serves /.git/HEAD or /.git/config before attackers dump source code and commit history. Passive URL scan, zero signup.

Open scanner
GraphQL · __schema · Passive Audit

GraphQL Introspection Exposure Checker

Verify whether /graphql or /api/graphql exposes your full __schema to unauthenticated callers in production. Read-only passive scan with Apollo & Yoga fixes.

Open scanner
Set-Cookie · HttpOnly · Secure · SameSite

Cookie Security Flags Checker

Audit Set-Cookie headers on your live app for missing HttpOnly, Secure, and SameSite flags on session and auth cookies. Zero signup, passive URL scan.

Open scanner
Lovable · Supabase · Vite · Passive Audit

Lovable App Security & Supabase Scanner

Passive pre-launch security check for Lovable apps: catch leaked Supabase service_role keys, missing RLS signals, public source maps, and missing headers.

Open scanner
Bolt.new · Vite · Client Bundles · Passive Audit

Bolt.new Security & Vite Bundle Scanner

Scan live Bolt.new and Vite apps for VITE_* client bundle leaks, exposed .env files, public .js.map source maps, and BaaS key misconfigurations in <15s.

Open scanner
Cursor · Vercel v0 · Next.js · Passive Audit

Cursor & v0 Next.js Security Scanner

Audit live Next.js apps built with Cursor and Vercel v0 for __NEXT_DATA__ leaks, NEXT_PUBLIC_* secrets, debug routes, source maps, and missing headers.

Open scanner