What are exposed source maps?
A source map is a file (.js.map) that links minified JavaScript back to your original source code for debugging. When it is served publicly in production, anyone can download and read your full front-end source, including comments, internal API routes and sometimes secrets.
How it works
Build tools compress code into unreadable bundles. To debug, they also produce a map that contains the original file contents and names. If the bundle ends with a sourceMappingURL comment and the map file is deployed, a visitor can fetch it and rebuild your whole project tree with a single tool. The risk is not the readability alone: comments, TODOs, feature flags, admin routes, API endpoints and accidentally embedded keys become much easier to find than in minified code.
// end of app.3f9a.js
//# sourceMappingURL=app.3f9a.js.map
# Next.js: keep browser source maps off (default)
// next.config.js
module.exports = { productionBrowserSourceMaps: false };How to tell if your site is affected
- Your JavaScript files end with a //# sourceMappingURL= comment and the .map address returns a file.
- The dev tools Sources tab shows your original file names and folders on the live site.
- Your build config enables sourcemap: true or productionBrowserSourceMaps in production.
- An error tracker is configured to upload maps, but the same files are also deployed publicly.
How to fix it
Turn off production source maps for the browser: build.sourcemap: false in Vite, devtool: false in webpack (or productionBrowserSourceMaps: false in Next.js).
If you need maps for error tracking, upload them to Sentry or similar and delete them from the deployed output.
Remove the sourceMappingURL comment from public bundles and block *.map in nginx or your CDN.
Search the source for secrets anyway and rotate any that appear. Do not rely on obscurity.
Redeploy and check that the old .map addresses now return 404.
How ScanAnt checks for it
The free quick scan looks for source map references in your public scripts and checks whether the map files are downloadable. When they are, it also searches them for keys and secrets, shows only masked values and reports the location. It reads files the site already serves to every visitor.
Questions
Are source maps a vulnerability on their own?
They are an information leak. They are rated low or medium unless secrets or hidden endpoints are inside, but they make finding real bugs easier.
Does open source code make this irrelevant?
If your code is public anyway, the map leaks less. Keys and non-public routes still matter.
Does hiding the map file name help?
No. The URL is in the bundle, and obscurity is not protection. Do not deploy the file.
Will removing maps hurt debugging?
You can keep maps privately in your error tracker. Users and attackers do not need them.
Related terms
See if your site is affected
Free for any public site, no signup. Need the verified or deep scan? Choose the level on the scan page.
Choose a scan level →