JavaScript Source Maps and Public Exposure
Source maps turn minified JavaScript back into readable original code. That is great for debugging and a surprise for owners who deploy them by accident.
A source map is a .map file that links minified output to your original source files. Bundlers add a comment such as //# sourceMappingURL=app.js.map to the end of the script so browser DevTools can find it.
What a public source map can reveal
- Original file names, folder structure and internal module names.
- Developer comments, TODO notes and commented-out code.
- Internal API paths, feature flags and hints about backend structure.
A source map is not a vulnerability by itself, and your frontend code is already downloadable. The risk is that it makes review easier for anyone, including people who should not learn your internal details. It also makes accidentally bundled secrets much easier to spot.
How to check your site
Look for sourceMappingURL at the bottom of your JavaScript and CSS files, and try opening the referenced .map URL. In CodBy, map files appear in the source inventory of an analyzed project, so you can see them next to the scripts that reference them.
How to stop publishing them
// webpack
devtool: false // or 'hidden-source-map'
// Vite
build: { sourcemap: false }
// Remove existing files from your deploy output
find dist -name "*.map" -delete
If you need maps for error tracking, upload them to the tracking service during the build and do not copy them to the public folder. Also remove the sourceMappingURL comment so browsers do not request a missing file.
Continue with the frontend security checklist to review the rest of your release.
Open CodBy Analyzer