# GHSA-6JPM-P5CQ-9Q44: Input sourcemap sourcesContent leaks, revealing input source code

- Database: GitHub
- Severity: CVSS 5.3 (Medium)
- Published: 2026-11-20
- Modified: 2026-11-30

## Tracked as

- [CVE-2026-140012](https://cve.now/CVE-2026-140012.md): Terser source code leak in source map generation

## Affected versions

- terser (npm): 5.51.3

## Description

### Impact

Leakage of user source code, which may include comments, constants with secret tokens, etc.

When using Terser with an input sourcemap (sourceMap.content), and this input sourcemap has original source information (`sourcesContent`), Terser leaks this `sourcesContent` into the output, even when the user specified `includeSources: false` to opt-out.

### Details

To help developers debug their JS applications, Terser's minify function reads and produces [source maps](https://developer.mozilla.org/en-US/docs/Glossary/Source_map).

To minify a JS file that has a corresponding source map, and generate a source map in turn, we call Terser's minify function like so:

```js
const out = await minify(INPUTFILE, {
    sourceMap: {
        content: INPUTMAP,
    },
});
out.map // output source map
```

Source maps may contain the content of files, in their `sourcesContent` property. Files which may include secrets.
 
Terser shouldn't include `sourcesContent` by default, unless we pass `includeSources: true` under `sourceMap` options.

But it does include the `sourcesContent` of  the INPUTMAP even if `includeSources: false`, which is the leak we're discussing.

### Patches

The problem will be patched in version `5.51.3`, and `4.8.2`.

### Workarounds

Do not use an input sourcemap (`sourceMap.content` option).

### References

- [Terser source maps documentation](https://terser.org/docs/api-reference/#source-map-options)
- [Terser source maps documentation (CLI)](https://terser.org/docs/cli-usage/#cli-source-map-options)

## References

- https://github.com/terser/terser/security/advisories/GHSA-6jpm-p5cq-9q44

Page: https://cve.now/GHSA-6JPM-P5CQ-9Q44

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
