GHSA-6jpm-p5cq-9q44

Suggest an improvement
Source
https://github.com/advisories/GHSA-6jpm-p5cq-9q44
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-6jpm-p5cq-9q44/GHSA-6jpm-p5cq-9q44.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-6jpm-p5cq-9q44
Aliases
Published
2026-12-01T18:35:11Z
Modified
2026-12-01T18:45:08Z
Severity
  • 5.3 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N CVSS Calculator
Summary
Terser: Input sourcemap sourcesContent leaks, revealing input source code
Details

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.

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:

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).

Database specific
{
    "cwe_ids":  [
        "CWE-540"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-12-01T18:35:11Z",
    "nvd_published_at":  "2026-11-30T22:17:31Z",
    "severity":  "MODERATE"
}
References

Affected packages

npm / terser

Package

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
4.8.2

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-6jpm-p5cq-9q44/GHSA-6jpm-p5cq-9q44.json"

npm / terser

Package

Affected ranges

Type
SEMVER
Events
Introduced
5.0.0
Fixed
5.51.3

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-6jpm-p5cq-9q44/GHSA-6jpm-p5cq-9q44.json"