LeakyVibe

Guides · Updated 2026-11-27

Missing Content-Security-Policy and an X-Powered-By header: what they mean and how to fix them (Next.js, Vercel, Express)

Short answer: Both are response headers your server sends with every page. X-Powered-By (for example "Next.js" or "Express") just tells strangers which framework you run; it is minor, and you remove it with one setting (Next.js: poweredByHeader: false; Express: app.disable('x-powered-by')). A missing Content-Security-Policy (CSP) matters more: CSP tells the browser which scripts and connections your page may use, so if someone ever manages to inject a script into your app, the browser can block it. Add a CSP in report-only mode first, fix what it reports, then enforce it.

Does your app have this problem? Free scan, 15 sec, no sign-up

or watch it scan our demo app ▶

Check your own app in 1 minute

Open your live site, open the browser's developer tools (F12), go to the Network tab, reload, and click the first request (your page). Under Response Headers, look for two things: a line starting with x-powered-by, and a line starting with content-security-policy. You can also run this in a terminal:

curl -sI https://your-app.example | grep -i -E "x-powered-by|content-security-policy"

If you see x-powered-by, your server is announcing its framework. If you see no content-security-policy line, the browser has no rules about which scripts your page may run. These are two of the header checks LeakyVibe runs on every scan.

X-Powered-By: minor, one line to remove

Next.js and Express send this header by default. It does not leak data or keys. It only makes fingerprinting easier: someone looking for apps on a framework with a known bug can spot yours faster. Express's own security guide calls removing it "reduce fingerprinting" and is honest that it won't stop a determined attacker from working out what you run. Treat it as cheap hygiene, not an emergency.

  • Next.js: in next.config.js (or next.config.ts) set poweredByHeader: false.
  • Express: call app.disable('x-powered-by') right after creating the app, or use the helmet middleware, which removes it and sets several other security headers.
  • Other servers: look for a setting that hides the server or framework name; most have one.
// next.config.js
module.exports = {
  poweredByHeader: false,
}

Content-Security-Policy: why it matters more

Cross-site scripting (XSS) means someone gets their JavaScript to run inside your page, for example through a comment, profile name or URL parameter your app renders without escaping. That script can do anything your own code can: read what's on screen, read local storage (where many apps keep the login session), and send it somewhere else.

A CSP is a list of rules your server sends to the browser: which sources scripts, styles, images and network requests may come from. With a good CSP, an injected inline script or a script from an unknown domain is blocked by the browser even if the bug that let it in still exists. It is a safety net, not a replacement for fixing XSS bugs. The same header can also stop other sites from framing your app (frame-ancestors) and upgrade stray http:// requests to https://.

Why vibe-coded apps usually have none: frameworks and AI builders don't add one by default, because a policy that's too strict breaks the app (blocked Supabase calls, Stripe checkout, analytics, fonts). That's also why you should roll it out in two steps.

Step 1: start in report-only mode

Send the policy as Content-Security-Policy-Report-Only first. The browser does not block anything; it only reports what it would have blocked (you'll see the warnings in the DevTools console). Click through your app, including login, checkout and any page with images or embeds, and add each legitimate domain you see to the policy. A reasonable starting policy for an app that talks to Supabase from the browser:

default-src 'self';
script-src 'self';
connect-src 'self' https://YOUR-PROJECT.supabase.co wss://YOUR-PROJECT.supabase.co;
img-src 'self' data: blob: https://YOUR-PROJECT.supabase.co;
style-src 'self' 'unsafe-inline';
object-src 'none';
base-uri 'self';
frame-ancestors 'none';
upgrade-insecure-requests

Avoid 'unsafe-inline' in script-src: MDN notes it defeats much of the purpose of a CSP, because inline scripts are one of the most common XSS paths. 'unsafe-inline' in style-src is a common compromise to start with. Replace YOUR-PROJECT with your Supabase project URL and add only the other domains your app really uses. If you take payments, Stripe lists the exact script-src, connect-src, frame-src and img-src entries for each of its products in the Content Security Policy section of its security guide (docs.stripe.com/security/guide); copy those rather than guessing.

Step 2: enforce it, per platform

  • Next.js: add the header in next.config.js with async headers() (Next.js documents this route for apps that don't need nonces). For a stricter policy with per-request nonces, Next.js documents a proxy/middleware setup, but it makes pages render dynamically, which costs speed and caching.
  • Vite or React apps deployed on Vercel (common for Lovable and Bolt exports): add a headers entry in vercel.json with source "/(.*)" and the Content-Security-Policy key.
  • Express: helmet() sets a default CSP; adjust its directives to your domains.
  • Static hosting where you can't set headers: MDN says a <meta http-equiv="Content-Security-Policy"> tag in index.html works for client-side single-page apps, but it doesn't support every feature (no report-only mode, and frame-ancestors is ignored in a meta tag).
// next.config.js (no nonces)
module.exports = {
  poweredByHeader: false,
  async headers() {
    return [
      {
        source: '/(.*)',
        headers: [
          { key: 'Content-Security-Policy-Report-Only', value: "default-src 'self'; ..." },
        ],
      },
    ]
  },
}

When the console stays quiet for a few days of normal use, rename the key from Content-Security-Policy-Report-Only to Content-Security-Policy and redeploy. Then re-check with curl that the header is there on your live site.

A prompt for your AI builder

Harden my app's response headers. 1) Remove the X-Powered-By header (Next.js: poweredByHeader: false; Express: app.disable('x-powered-by')). 2) Add a Content-Security-Policy-Report-Only header on all pages that allows only the domains this app actually uses (list them for me first: Supabase, Stripe, analytics, fonts, images), with object-src 'none', base-uri 'self', frame-ancestors 'none' and no 'unsafe-inline' or 'unsafe-eval' in script-src. Don't switch it to enforcing yet. Tell me how to test it and how to turn it on later.

What this won't fix

Headers protect visitors' browsers. They do nothing about a secret key shipped in your JavaScript, a database table without Row Level Security, or an API route that doesn't check who owns a record. Those are the findings that usually matter most in vibe-coded apps, so run a full scan, not just a header check.

Sources

Checked 2026-11-27. Next.js, "poweredByHeader" (https://nextjs.org/docs/app/api-reference/config/next-config-js/poweredByHeader): Next.js adds x-powered-by by default; disable with poweredByHeader: false. Next.js, "Content Security Policy" guide (https://nextjs.org/docs/app/guides/content-security-policy): nonces via proxy require dynamic rendering; without nonces set the header in next.config.js headers(). Express, "Production Best Practices: Security" (https://expressjs.com/en/advanced/best-practice-security.html): app.disable('x-powered-by'), reduce fingerprinting, helmet sets CSP and removes X-Powered-By. Stripe, "Integration security guide" (https://docs.stripe.com/security/guide): CSP directives per Stripe product. MDN, "Content Security Policy (CSP)" (https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) and "Content-Security-Policy-Report-Only" (https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy-Report-Only): XSS defense, avoid 'unsafe-inline', frame-ancestors, report-only rollout, meta tag limits. Vercel, "vercel.json headers" (https://vercel.com/docs/project-configuration/vercel-json#headers).

Check your app for this now

Free scan · about 15 seconds · no sign-up

Passive, read-only checks. Only scan apps you own or have permission to test.