CWE-540Data exposureSeverity · Low

Source maps in production

Production serves source maps that rebuild the full front-end code, with comments and internal routes. Attackers can read the app as its own developers do.

At a glance

Controls
CWE-540 · A01:2021 Broken Access Control
Typical severityLow
ReferenceCWE-540
OWASP Top 10A01:2021 Broken Access Control

What it is

Build tools create source maps so developers can debug compressed JavaScript. When these files ship to production, anyone can download them and rebuild the original source. That includes comments, hidden routes, feature flags and sometimes keys left in the code.

Attackers use the rebuilt source to find admin pages, unused API endpoints and checks that only run in the browser. This shortens their search for weaker targets. AI-assisted attackers can read a whole rebuilt code base quickly and list every endpoint and interesting comment.

Where it hides

What a reviewer can look for in the code and in the behaviour, before anyone proves it.

  • JavaScript bundles with a sourceMappingURL comment at the end
  • .map files sitting next to bundles on the CDN
  • Build settings that differ between staging and production
  • Admin and internal tools built with the same pipeline

How MATT tests it

The proof runs against the deployed product, on every release, whoever wrote the code.

  1. 01Load the production site and list every JavaScript file it requests.
  2. 02Request the matching .map file for each bundle and note which ones return content.
  3. 03Rebuild the source from any returned map and list the internal routes and comments it reveals.
The rule, in plain English

Production must not publish source maps or internal code.

Executable check

as anonymous: GET /assets/{bundle}.js expect: no sourceMappingURL comment in the body as anonymous: GET /assets/{bundle}.js.map expect: 403 or 404

Every rule MATT holds →

What the fix looks like

  1. 01

    Turn off public source map output in the production build.

  2. 02

    If maps are needed for error tracking, upload them privately to that tool.

  3. 03

    Strip comments and dead code from production bundles.

  4. 04

    Keep secrets out of front‑end code entirely, since everything shipped to the browser is readable.

A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →

ExploitOps discovery call

Understand where your security loop breaks.

A call with a MATT co-founder to understand your product and whether an ExploitOps Review is worth doing. If there is a real need, we scope one with the research team.

Let’s understand your priority

What brings you to MATT?

What would you like help with?
01 / 02