You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fix for GHSA-6g55-p6wh-862q added a guard in lib/previous-map.jsPreviousMap.loadFile() that restricts an attacker-controlled sourceMappingURL (from a CSS comment) to a .map extension and, for untrusted maps, rejects .. traversal and absolute paths. The traversal/absolute rejection is nested inside if (cssFile) { ... }. When PostCSS is invoked without the from option, cssFile is falsy and that branch is skipped, leaving only the .map extension check.
PreviousMap is constructed by lib/input.js whenever pathAvailable && sourceMapAvailable (under Node with source-map available), independent of opts.from/opts.map (the constructor returns early only for opts.map === false). So postcss([]).process(css) on attacker CSS reaches loadFile with cssFile undefined, and an attacker /*# sourceMappingURL=/abs/path/x.map */ (or ../-traversing path) is read via readFileSync. When the file is valid JSON, its sources (filesystem paths) and sourcesContent (source contents) are disclosed in the generated source map.
Affected code (v8.5.22 — the release carrying the GHSA-6g55 fix)
// lib/previous-map.jsloadFile(path,cssFile,trusted){if(!trusted&&!this.unsafeMap){if(!/\.map$/i.test(path)){returnundefined}if(cssFile){// guard runs ONLY when `from` is setletrelativePath=relative(dirname(cssFile),path)if(relativePath==='..'||relativePath.startsWith('..'+sep)||isAbsolute(relativePath)){returnundefined}}}this.root=dirname(path)if(existsSync(path)){this.mapFile=pathreturnreadFileSync(path,'utf-8').toString().trim()// sink}}// loadMap(): untrusted annotation path, trusted=false; file === opts.from}elseif(this.annotation){letmap=this.annotationif(file)map=join(dirname(file),map)// no `from` -> map stays the raw URLletunknown=this.loadFile(map,file,false)// file undefined -> cssFile falsy
Proof of concept (verified on postcss 8.5.22)
constpostcss=require('postcss')constfs=require('fs')// a 'secret' sourcemap OUTSIDE any expected tree (stand-in for another project's .map)constsecret='/tmp/pcpoc/secret_out_of_tree.map'fs.writeFileSync(secret,JSON.stringify({version: 3,sources: ['/etc/REAL_PATH_LEAK'],mappings: '',names: [],sourcesContent: ['TOP_SECRET_abcdef']}))constcss='a{color:red}\n/*# sourceMappingURL='+secret+' */'constleaks=m=>m&&JSON.stringify(m.toJSON ? m.toJSON() : m).includes('TOP_SECRET_abcdef');(async()=>{// A) NO `from` -> guard skipped -> arbitrary absolute .map read + disclosedconsta=awaitpostcss([]).process(css,{map: true})console.log('no from -> leaked:',!!leaks(a.map))// true// B) WITH `from` -> guard active -> blockedconstb=awaitpostcss([]).process(css,{from: '/tmp/pcpoc/in.css',map: true})console.log('with from -> leaked:',!!leaks(b.map))// false})()
Observed output on postcss 8.5.22:
no from -> leaked: true # sourcesContent 'TOP_SECRET_abcdef' AND sources '/etc/REAL_PATH_LEAK' appear in result.map
with from -> leaked: false # guard rejects the absolute path
../ traversal (no from) also succeeds; non-.map targets (.txt, ?x=.map, #.map) are blocked by the .map check. The tested build contains the GHSA-6g55 fix (this.json = JSON.parse(...) in loadMap, consumer() uses this.json || this.text), so this is a residual of that fix.
Impact
Arbitrary .map-file read (absolute path or ../ traversal) and disclosure of the target map's sources (local filesystem paths) and sourcesContent (source) into the generated source map, for any consumer that runs PostCSS on attacker-influenced CSS without a from option and exposes result.map (online CSS playgrounds, minify/lint services, string-input build steps). Bounded to files ending in .map that parse as JSON.
Suggested fix
Apply the traversal/absolute-path rejection to the untrusted map path regardless of whether cssFile is present (resolve against process.cwd() when there is no cssFile, and reject absolute paths and .. escape in all untrusted cases), or refuse to load an untrusted external map when no base file is known.
Closing as stale. main is ~21 commits ahead of this branch's base and already pins postcss via postcss@<=8.5.17: >=8.5.18. This branch also regresses main's other security overrides (reverts js-yaml@<3.15.0 to <4.0.0, undici bound to <8.0.0, and the undici release-age exclude from 8.10.0 to bare 7.28.0) and carries a huge stale lockfile delta. Renovate will re-raise a clean postcss bump against current main if >=8.5.23 is still required.
Because you closed this PR without merging, Renovate will ignore this update (^8.5.18). You will get a PR once a newer version is released. To ignore this dependency forever, add it to the ignoreDeps array of your Renovate config.
If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
8.5.22→8.5.23PostCSS: incomplete fix of GHSA-6g55-p6wh-862q — attacker-controlled sourceMappingURL reads arbitrary .map files when
fromis unsetCVE-2026-69153 / GHSA-fxqj-rqcc-2cmp
More information
Details
Summary
The fix for GHSA-6g55-p6wh-862q added a guard in
lib/previous-map.jsPreviousMap.loadFile()that restricts an attacker-controlledsourceMappingURL(from a CSS comment) to a.mapextension and, for untrusted maps, rejects..traversal and absolute paths. The traversal/absolute rejection is nested insideif (cssFile) { ... }. When PostCSS is invoked without thefromoption,cssFileis falsy and that branch is skipped, leaving only the.mapextension check.PreviousMapis constructed bylib/input.jswheneverpathAvailable && sourceMapAvailable(under Node with source-map available), independent ofopts.from/opts.map(the constructor returns early only foropts.map === false). Sopostcss([]).process(css)on attacker CSS reachesloadFilewithcssFileundefined, and an attacker/*# sourceMappingURL=/abs/path/x.map */(or../-traversing path) is read viareadFileSync. When the file is valid JSON, itssources(filesystem paths) andsourcesContent(source contents) are disclosed in the generated source map.Affected code (v8.5.22 — the release carrying the GHSA-6g55 fix)
Proof of concept (verified on postcss 8.5.22)
Observed output on postcss 8.5.22:
../traversal (nofrom) also succeeds; non-.maptargets (.txt,?x=.map,#.map) are blocked by the.mapcheck. The tested build contains the GHSA-6g55 fix (this.json = JSON.parse(...)inloadMap,consumer()usesthis.json || this.text), so this is a residual of that fix.Impact
Arbitrary
.map-file read (absolute path or../traversal) and disclosure of the target map'ssources(local filesystem paths) andsourcesContent(source) into the generated source map, for any consumer that runs PostCSS on attacker-influenced CSS without afromoption and exposesresult.map(online CSS playgrounds, minify/lint services, string-input build steps). Bounded to files ending in.mapthat parse as JSON.Suggested fix
Apply the traversal/absolute-path rejection to the untrusted map path regardless of whether
cssFileis present (resolve againstprocess.cwd()when there is nocssFile, and reject absolute paths and..escape in all untrusted cases), or refuse to load an untrusted external map when no base file is known.Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
postcss/postcss (postcss)
v8.5.23Compare Source
opts.fromfor security reasons.Configuration
📅 Schedule: (in timezone America/New_York)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.