PatchPaste · Guides

Last updated 1 November 2026

Are source maps a security risk in production?

Scan your live app free. It checks whether the JavaScript your site sends to visitors comes with downloadable source maps, and searches that JavaScript for Stripe, OpenAI, Anthropic, AWS, GitHub and Supabase admin keys. No login, no code access.

Short answer: a public source map lets anyone read your app's original frontend code, comments and all. It's a medium risk: it doesn't open your database, but it makes every other weakness easier to find. Both Vite and Next.js leave production source maps off by default, so if yours are public, a setting turned them on. Turn it off and redeploy. And if a secret key is in your frontend, hiding the source map doesn't fix that.

What a source map is

When Lovable, Bolt, Cursor or v0 publishes your app, the build squashes your code into small, hard-to-read JavaScript files. A source map (app-1a2b3c.js.map) is a separate file that maps that squashed code back to the original. It usually contains your original source files in full, so DevTools can show them with their real folder names. That's great while debugging and rarely needed on a live site.

What a public source map gives away, and what it doesn't

Gives awayDoesn't give away
Your original frontend code, file names and folder structureYour server code, Edge Functions or database (they aren't in the browser build)
Code comments, TODOs and notes such as “temporary admin bypass”Anything the minified JavaScript didn't already contain
Routes and features hidden in the UI, such as admin pagesYour Supabase data, if RLS is set up properly
How your app talks to Supabase, Stripe and other APIsSecrets stored only on the server

The honest take: anything in your frontend is public already. A source map just makes it readable. So the real fixes are still the same: no secret keys in the frontend, real RLS policies on every table, and permission checks on the server, not in the UI. Then turn source maps off so you aren't handing out a guide.

Check your live app in 2 minutes

  1. Open your published site in a private window and open DevTools → Network. Filter to JS and reload.
  2. Open the main JavaScript file (often in /assets/ for Vite apps or /_next/static/ for Next.js). Search it for sourceMappingURL.
    • sourceMappingURL=index-abc123.js.map means a map file is linked.
    • sourceMappingURL=data: means the map is inlined inside the file itself.
  3. Even if there's no comment, add .map to the end of the JavaScript file's address and open it. If it downloads a file containing "sources", your maps are public.
  4. Also look in DevTools → Sources. If you see a readable src/ folder with your component names, the browser found your source maps.

Check the live site, not your editor. Only the published build matters here.

How to turn them off

Vite (Lovable, Bolt and most React apps)

Vite's build.sourcemap option defaults to false. Open vite.config.ts and either delete the sourcemap line or set it to false:

export default defineConfig({
  build: {
    sourcemap: false,
  },
});

The other values, and what they mean on a live site:

Next.js (Cursor, v0 and other Next.js apps)

Next.js leaves browser source maps off in production unless productionBrowserSourceMaps is set to true in next.config. When it is on, Next.js serves the maps next to your JavaScript automatically. Remove the line, or set it to false, and redeploy.

Need source maps for error tracking?

Use 'hidden' maps, upload them to your error-tracking tool as part of the build, then delete the .map files before the site is deployed. The tool gets readable stack traces and visitors get nothing.

A prompt to paste into Lovable, Bolt or Cursor

Turn off production source maps. If this is a Vite app, set build.sourcemap to false in vite.config (or remove the option). If this is a Next.js app, remove productionBrowserSourceMaps from next.config or set it to false. Do not use 'hidden' or 'inline'. Do not change anything else. Then tell me exactly which file and line you changed.

After you publish, repeat the 2-minute check. The .map address should return a 404. Don't take the AI's word for it.

While you're in there

Before launch, run the full Lovable/Bolt pre-launch checklist. Also see is my Lovable app secure?

Source map FAQ

Are source maps a security risk?

They are an information leak, not a break-in. A public source map lets anyone read your original frontend code, with file names and comments, instead of the minified version. That makes it easier to find weak spots such as admin routes, hidden features or a key someone hardcoded. It doesn't give anyone access your minified JavaScript didn't already give them.

Does turning off source maps hide my API keys?

No. A key in your frontend is already in the minified JavaScript every visitor downloads. Removing source maps only makes it a little harder to find. Move the key to a server or Edge Function and rotate it.

Are source maps on by default in Vite?

No. Vite's build.sourcemap option defaults to false. If your Lovable, Bolt or other Vite app serves .map files, something in vite.config turned them on, often an AI edit made while debugging.

Are source maps on by default in Next.js?

No. Next.js turns browser source maps off for production builds unless productionBrowserSourceMaps is set to true. When it is true, Next.js serves the .map files next to your JavaScript.

Is sourcemap: 'hidden' safe?

Only if you don't deploy the .map files. Vite's 'hidden' option still writes the maps and only removes the comment pointing to them. If they are uploaded with your site, anyone can still guess the address by adding .map to a JavaScript file's name.

Does PatchPaste check for source maps?

Yes. The free scan looks at the JavaScript files your live homepage loads, follows any sourceMappingURL comment, also tries the same file name with .map added, and flags any map it can download. It doesn't detect maps inlined into the JavaScript as a data: URL; search for sourceMappingURL=data: by hand to check for those.

Check your app for free

Paste your live URL for a free A to F report with every problem in plain English. Fix prompts for that report are a one-off £9 (or £29 for 10 reports). Scans are free to rerun, so you can check again after you turn source maps off and redeploy.

Free. No login. No code access.

Want to see one first? View a sample report.

Sources (checked 1 Nov 2026): Vite, Build options: build.sourcemap (default false; true writes a separate map file; 'inline' appends it as a data URI; 'hidden' works like true but drops the sourcemap comment); Next.js, productionBrowserSourceMaps (off for production builds by default; when on, maps are output next to the JavaScript and served automatically).