Update dependency postcss to v8.5.12 [SECURITY] - #19
Conversation
|
|
|
Someone is attempting to deploy a commit to a Personal Account owned by @X-oss-byte on Vercel. @X-oss-byte first needs to authorize it. |
|
There was a problem hiding this comment.
PR Type: Enhancement
PR Summary: This pull request updates the postcss package from version 8.4.27 to 8.4.31. This update addresses a security vulnerability identified as CVE-2023-44270, which affects the parsing of characters in CSS, potentially leading to the inclusion of parts of the CSS intended as comments in the PostCSS output. The update ensures that postcss and all related dependencies within the project are aligned with the patched version, mitigating the risk associated with the vulnerability.
Decision: Comment
📝 Type: 'Enhancement' - not supported yet.
- Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
✅ Small diff: the diff is small enough to approve with confidence.
No details provided.
General suggestions:
- Ensure thorough testing of CSS processing within the application to verify that the update does not introduce any regressions.
- Consider setting up automated dependency update tools, if not already in place, to promptly address future security vulnerabilities.
- Review other dependencies for potential security vulnerabilities and update them as necessary.
Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨
ccf7303 to
232af48
Compare
1860338 to
db17405
Compare
db17405 to
8c8abc8
Compare
8c8abc8 to
8fce553
Compare
8fce553 to
2e96356
Compare
f72e973 to
6152e3b
Compare
6152e3b to
c4b0d58
Compare
c9c67f1 to
e329972
Compare
9f9edda to
4cc34d8
Compare
a7c3107 to
b9fbf84
Compare
488b3f3 to
dbeef8f
Compare
dbeef8f to
7d1eae7
Compare
7d1eae7 to
4fb5a7e
Compare
4fb5a7e to
e1cf619
Compare
e1cf619 to
28ad6bf
Compare
28ad6bf to
cb528ac
Compare
This PR contains the following updates:
8.4.27→8.5.12PostCSS line return parsing error
CVE-2023-44270 / GHSA-7fh5-64p2-3v2j
More information
Details
An issue was discovered in PostCSS before 8.4.31. It affects linters using PostCSS to parse external Cascading Style Sheets (CSS). There may be
\rdiscrepancies, as demonstrated by@font-face{ font:(\r/*);}in a rule.This vulnerability affects linters using PostCSS to parse external untrusted CSS. An attacker can prepare CSS in such a way that it will contains parts parsed by PostCSS as a CSS comment. After processing by PostCSS, it will be included in the PostCSS output in CSS nodes (rules, properties) despite being originally included in a comment.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
PostCSS has XSS via Unescaped </style> in its CSS Stringify Output
CVE-2026-41305 / GHSA-qx2v-qp2m-jg93
More information
Details
PostCSS: XSS via Unescaped
</style>in CSS Stringify OutputSummary
PostCSS v8.5.5 (latest) does not escape
</style>sequences when stringifying CSS ASTs. When user-submitted CSS is parsed and re-stringified for embedding in HTML<style>tags,</style>in CSS values breaks out of the style context, enabling XSS.Proof of Concept
Tested output (Node.js v22, postcss v8.5.5):
Impact
Impact non-bundler use cases since bundlers for XSS on their own. Requires some PostCSS plugin to have malware code, which can inject XSS to website.
Suggested Fix
Escape
</stylein all stringified output values:Credits
Discovered and reported by Sunil Kumar (@TharVid)
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
PostCSS: Arbitrary file read and information disclosure via attacker-controlled sourceMappingURL in CSS comments
CVE-2026-45623 / GHSA-6g55-p6wh-862q
More information
Details
Summary
PostCSS's
PreviousMapparses the/*# sourceMappingURL=PATH */comment from any CSS string passed toprocess()and dereferencesPATHagainst the local filesystem with no scheme, allowlist, or traversal check. An attacker who controls the CSS input can cause the host process to read any file readable by Node and leak the first ~10 bytes of its content through the resultingJSON.parseSyntaxErrormessage. The bug also yields a precise file-existence oracle and a controllable-read primitive that may be combined with large-file targets for DoS. The behaviour is triggered with PostCSS's default options — nofrom, nomap, no plugins required — and is therefore reachable from any pipeline that runs untrusted CSS through PostCSS (CMS themes, user-uploaded styles, browser-extension/userstyle processors, build pipelines for third-party packages, blog comment renderers, etc.).Details
The dangerous chain lives in
lib/previous-map.jsand is wired into everyInputconstruction atlib/input.js:70-77.Inputconstructor (lib/input.js:70-77):PreviousMapconstructor (lib/previous-map.js:17-29):Note
opts.map === falseis the only short-circuit. With default options (opts.map === undefined), the rest of the constructor — including the filesystem read — executes.loadAnnotation(lib/previous-map.js:72-84) extracts the URL without sanitisation:getAnnotationURL(lib/previous-map.js:59-61) only strips the/*# sourceMappingURL=prefix and trims whitespace — no scheme check, no path normalisation, no allowlist.loadMap(lib/previous-map.js:124-128) — whenprevis absent and the annotation is not an inlinedata:URI:opts.fromis unset,fileis undefined and the raw attacker-supplied path (e.g./etc/passwd) is used directly.opts.fromis set,path.join(dirname(file), attackerPath)is used.path.joindoes not block..segments, so../../../../../etc/passwdresolves outside the intended directory.loadFile(lib/previous-map.js:86-92) is the sink:The bytes are stored in
this.text.Inputimmediately invokesmap.consumer()(lib/input.js:74), which constructs aSourceMapConsumer(lib/previous-map.js:33). When the file is not valid source-map JSON (the common case),source-map-jscallsJSON.parse, and V8'sSyntaxErrormessage embeds the first ~10 bytes of the file content:This error is propagated back to the caller. Any application that surfaces PostCSS errors (logs, HTTP 500 responses, build-tool output, debug pages) discloses those bytes to the attacker.
Trust-boundary analysis:
postcss().process(css, opts?)./etc/passwd,/proc/self/environ, etc.startWith(annotation, 'data:')) routes inline URIs todecodeInline; everything else hitsloadFile.Primitives obtained:
JSON.parseSyntaxErrormessage.loadFile(existsSyncis false → returns undefined → no map text → no consumer call → no error). Existent non-JSON paths throw. Existent JSON paths succeed silently. Three distinguishable states./dev/zero, very large files, or device files can stall or crash the process.PoC
All commands executed against this repository's HEAD (postcss 8.5.10) on Node v22.12.0.
Vector 1 — Absolute path, default options (no
from, nomap):The first 10 bytes of
/etc/passwd(root:x:0:0) are leaked.Vector 2 — Relative
..traversal withopts.fromset (simulates a build pipeline that pinsfromto the source file):path.join('/var/www/html/styles', '../../../../../etc/passwd')resolves to/etc/passwd.Vector 3 — File-existence oracle:
Vector 4 — Custom file-content leak:
The first 10 bytes of
/tmp/server-secret.env(API_KEY=sk) are leaked — sufficient to confirm a token's presence and, in many cases, recover its prefix.Filesystem-call trace (proves the read happens with no opts at all):
Impact
postcss-loader, vite, parcel, Next.js, Gatsby, etc.) and for runtime CSS-handling libraries (CSS Modules tools, CSS minifiers, theme processors). Any pipeline that runs untrusted user CSS — CMS theme uploads, user-styled blog posts, browser-extension/userstyle services, multi-tenant build farms, third-party-package build pipelines — is exposed.JSON.parseSyntaxError. This is enough to recover SSH-key headers, environment-variable prefixes (API_KEY=sk…),/etc/passwdrecords, the start of/proc/self/environ, and other high-value secrets, and to fingerprint the host (Debian-tri…from/etc/hostname).JSON.parseerror, no-such-file silence), enabling reconnaissance of the host filesystem layout and confirmation of installed software, user accounts, and configuration files./dev/zero,/proc/kcore, very large files, or named pipes —readFileSyncis a synchronous, unbounded read.postcss().process(css)and no options. The only configuration that disables the bug is the explicit, undocumented-for-this-purpose{ map: false }.Recommended Fix
The root cause is that
loadFileaccepts any path the attacker supplies inside a CSS comment. The annotation is meant for tooling, not for production CSS processing of untrusted input. Two layered fixes:Refuse traversal/absolute paths in
loadMap(defence-in-depth):Require explicit opt-in to follow on-disk source-map annotations: gate the
loadFile(map)call inloadMapbehind an option such asopts.map.annotation === trueoropts.map.followAnnotation === true. Today, the only way to opt out is{ map: false }, which also disables in-memory previous-map handling. Inverting the default — only follow disk-resident annotations when explicitly asked — eliminates the entire attack surface for callers that pass untrusted CSS, while preserving build-tool use cases where the annotation is trusted.A user-facing changelog entry should warn that
postcss().process(untrustedCss)previously read attacker-controlled paths, and recommend auditing applications that surfaced PostCSS errors to end users.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
postcss/postcss (postcss)
v8.5.12Compare Source
opts.unsafeMapto disable checks.v8.5.11Compare Source
v8.5.10Compare Source
</style>in non-bundler cases (by @TharVid).v8.5.9Compare Source
v8.5.8Compare Source
Processor#version.v8.5.7Compare Source
v8.5.6Compare Source
ContainerWithChildrentype discriminating (by @Goodwine).v8.5.5Compare Source
package.json→exportscompatibility with some tools (by @JounQin).v8.5.4Compare Source
v8.5.3Compare Source
Unknown worderror (by @hiepxanh).v8.5.2Compare Source
v8.5.1Compare Source
v8.5.0: 8.5 “Duke Alloces”Compare Source
PostCSS 8.5 brought API to work better with non-CSS sources like HTML, Vue.js/Svelte sources or CSS-in-JS.
@romainmenke during his work on Stylelint added
Input#documentin additional toInput#css.Thanks to Sponsors
This release was possible thanks to our community.
If your company wants to support the sustainability of front-end infrastructure or wants to give some love to PostCSS, you can join our supporters by:
v8.4.49Compare Source
source.offset(by @romainmenke).v8.4.48Compare Source
v8.4.47Compare Source
v8.4.46Compare Source
Cannot read properties of undefined (reading 'before').v8.4.45Compare Source
v8.4.44Compare Source
markClean is not a functionerror.v8.4.43Compare Source
markClean is not a functionerror.v8.4.42Compare Source
v8.4.41Compare Source
v8.4.40Compare Source
v8.4.39Compare Source
CssSyntaxErrortypes (by @romainmenke).v8.4.38Compare Source
endIndex: 0in errors and warnings (by @romainmenke).v8.4.37Compare Source
original.column are not numberserror in another case.v8.4.36Compare Source
original.column are not numberserror on broken previous source map.v8.4.35Compare Source
!innode.parent.nodestype.undefinedto node adding method to simplify types.v8.4.34Compare Source
AtRule#nodestype (by Tim Weißenfels).v8.4.33Compare Source
NoWorkResultbehavior difference with normal mode (by Romain Menke).NoWorkResultusage conditions (by @ahmdammarr).v8.4.32Compare Source
postcss().process()types (by Andrew Ferreira).v8.4.31Compare Source
\rparsing to fix CVE-2023-44270.v8.4.30Compare Source
v8.4.29Compare Source
Node#source.offset(by Ido Rosenthal).v8.4.28Compare Source
Root.source.endfor better source map (by Romain Menke).Result.roottypes whenprocess()has no parser.Configuration
📅 Schedule: (UTC)
🚦 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.