medium
Security Vulnerability

Source Map Exposure

Source map exposure occurs when production builds include source maps, allowing anyone to view your original, unminified source code.

Scan for This Vulnerability

What is Source Map Exposure?

Source maps are debugging files that map minified code back to original source. While useful in development, exposing them in production reveals your entire codebase, including business logic, API endpoints, internal comments, and potentially secrets that weren't properly removed.

How It Happens

  • Production build configured to include source maps
  • Source maps uploaded to hosting platform
  • Default build settings not changed
  • Debugging enabled in production

Impact

Business logic exposed to competitors

Internal API endpoints revealed

Comments and documentation visible

Potential secrets found in code

Easier vulnerability discovery for attackers

How to Detect

  • Check for .map files in network requests
  • Look for sourceMappingURL comments in JS files
  • Try accessing /filename.js.map directly
  • Run VAS to detect source map exposure

How to Fix

Disable source maps in production

Configure your build to not generate source maps.

// next.config.js
module.exports = {
  productionBrowserSourceMaps: false,
}

// vite.config.js
export default {
  build: {
    sourcemap: false,
  },
}

Remove existing source maps

Delete any .map files from your production deployment.

Configure hosting to block .map files

Add rules to prevent source map access even if uploaded.

# _headers (Netlify) or similar
/*.map
  X-Robots-Tag: noindex

# Or return 404 for .map files

Is Your App Vulnerable?

VAS automatically scans for source map exposure and provides detailed remediation guidance.

Run Security Scan