Skip to main content
ContentMedium PriorityPro

Source Map Exposure

Updated November 2026·SecScanner Team

Source maps help debug minified code but can expose your original source code if publicly accessible.

Results in 1–3 minutes · Free · No signup required

Want the result for your own site? Free Website Vulnerability Scanner — paste your domain, get the report.

Why It Matters

Source maps reveal your application's structure, logic, and potentially hardcoded secrets. This helps attackers understand and exploit your code.

How We Check

We check for .map files and sourceMappingURL comments that might expose your source code.

Good vs Bad Values

Good and bad values for Source Map Exposure
ValueVerdictWhy
/_next/static/chunks/main.js.map returns 404GoodProduction maps are not published. This is the Next.js default, because productionBrowserSourceMaps is off.
app.js ends without a //# sourceMappingURL commentGoodNo pointer to a map. Even if a map file exists on disk, nobody is told where it is.
//# sourceMappingURL=data:application/json;base64,…WeakAn inline map. The check skips it, but the whole original source is inside the bundle and every visitor downloads it. Turn it off for production.
//# sourceMappingURL=app.js.map and the map returns 200BadAnyone can reconstruct your original files, comments and folder names from it.
Response header SourceMap: /maps/app.js.mapBadSame exposure through a header instead of a comment. The check follows the header and tests the file.
/static/js/main.js.map or /bundle.js.map returns 200BadCommon build-tool output paths. The check tries a short list of them directly.
A map reachable only after a login or from a VPNGoodRestricted access is the intended way to keep debugging value without publishing the source.
Any /*.map path answers 200 with an HTML shellWeakA single-page-app catch-all can make the check report a map that is not there. Check the response body: a real map is JSON beginning with {"version":3.

How to Fix

Don't deploy source maps to production. If needed for error tracking, restrict access to authenticated users or specific IPs.

Stop generating them in production.

// next.config.js — this is already false by default
module.exports = { productionBrowserSourceMaps: false };

// webpack.config.js
module.exports = { devtool: false };   // or 'hidden-source-map' to build maps without a pointer
// vite.config.ts
export default { build: { sourcemap: false } };  // or 'hidden'

Create React App: set GENERATE_SOURCEMAP=false in the build environment. Angular: set "sourceMap": false in the production configuration of angular.json.

Keep debugging value without publishing. Build maps with the hidden option, upload them to your error tracker, and delete them from the artifact before deploy. Sentry's build plugins can delete files after upload with sourcemaps.filesToDeleteAfterUpload.

Block them at the server as a second layer.

location ~* \.map$ {
    return 404;
}
# also stop proxied headers from advertising maps
proxy_hide_header SourceMap;
proxy_hide_header X-SourceMap;
<FilesMatch "\.map$">
    Require all denied
</FilesMatch>
Header unset SourceMap
Header unset X-SourceMap

Verify:

curl -s https://example.com/ | grep -o '[^"]*\.js' | head -3
curl -s https://example.com/path/to/main.js | tail -c 200   # look for sourceMappingURL
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/path/to/main.js.map

A 404 on the last command, and no sourceMappingURL at the end of the bundle, is a pass.

Common Mistakes

  • Turning source maps off in the framework and forgetting a separate build step, such as a CSS preprocessor, that still writes .map files into the output folder.
  • Uploading maps to the error tracker from the same directory that is then copied to the web server. Delete them after upload.
  • Assuming a map is harmless because the code is minified. The map contains the original names and sometimes the full source files in sourcesContent.
  • Blocking .map files in the CDN but not on the origin, or the other way around. Test both hostnames.
  • Stripping the sourceMappingURL comment but leaving the file in the directory. Anyone who guesses the filename still downloads it.

Frequently Asked Questions

What is Source Map Exposure?

Source maps help debug minified code but can expose your original source code if publicly accessible.

Why does Source Map Exposure matter for website security?

Source maps reveal your application's structure, logic, and potentially hardcoded secrets. This helps attackers understand and exploit your code.

How do I fix Source Map Exposure issues?

Don't deploy source maps to production. If needed for error tracking, restrict access to authenticated users or specific IPs.

Related Security Checks

Related Tool

Website Vulnerability Scanner

Run all 7 related checks with our free website vulnerability scanner

Check Your Website Now

Run a free security scan to check for Source Map Exposure issues and 61 other security checks.

Scan Your Website Free