How to fix: JavaScript Source Map Reference Found
A //# sourceMappingURL comment pointing to a .map file was found in the page's JavaScript, indicating a source map may be deployed alongside the production bundle.
Why it matters
If the referenced .map file is publicly fetchable, anyone can reconstruct the original, un-minified source: business logic, internal endpoint names, and code comments.
Bundlers emit a sourceMappingURL comment by default. The comment alone isn't a vulnerability -- the risk depends on whether the referenced .map file is actually served publicly.
How to fix it
- 1Verify whether the referenced .map file is publicly fetchable; if not, this is informational only.
- 2Disable source map generation for production builds, or use a 'hidden' mode that omits the reference comment.
- 3If source maps are needed for error tracking, upload them to your error-tracking service and keep them off the public web server.
Code examples
Disable source maps in production
// next.config.mjs: disable source maps in production builds
export default {
productionBrowserSourceMaps: false,
};
// Vite:
// build: { sourcemap: false }
// If source maps are needed for error tracking, upload to Sentry
// and exclude them from the public web serverReferences
Detected automatically by VulnRadar. The check id is sourcemap-reference, stable across every scan so you can filter or diff on it.
More content checks
- MediumPotential Open Redirect Parameters
- HighDirectory Listing Appears Enabled
- MediumSensitive File References Detected
- HighPotentially Outdated JavaScript Libraries
- Inforobots.txt Present - Review Manually
- InfoCMS / Technology Fingerprinting
- MediumPotentially Dangerous Inline JavaScript
- LowServer version disclosed in response header
Questions
- How severe is JavaScript Source Map Reference Found?
- VulnRadar rates this low severity in the content category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id sourcemap-reference, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does JavaScript Source Map Reference Found map to?
- It maps to CWE-540. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.