Skip to content

chore(deps): update dependency postcss to v8.5.18 [security] - #400

Open
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/npm-postcss-vulnerability
Open

chore(deps): update dependency postcss to v8.5.18 [security]#400
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/npm-postcss-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
postcss (source) 8.5.158.5.18 age confidence

PostCSS: Path Traversal in Previous Source Map Auto-Loading (sourceMappingURL) leads to Arbitrary .map File Disclosure

GHSA-r28c-9q8g-f849

More information

Details

Vulnerability Details

File: lib/previous-map.js
Line: 87-98 (loadFile), 129-144 (loadMap)

Root Cause

PostCSS auto-detects a /*# sourceMappingURL=... */ comment inside the CSS text it is asked to parse and, unless the caller explicitly passes map: false, attempts to load that path from disk as a "previous source map." This happens on every postcss.parse() / postcss().process() call by default (opt-out, not opt-in).

loadMap() builds the candidate path via join(dirname(opts.from), annotation), where annotation is the raw, attacker-controlled string from the CSS comment. path.join() normalizes but does not sandbox .. segments, so a ../../../ prefix walks the resolved path outside the intended directory. If opts.from is not set at all, the annotation is used completely unmodified — an absolute path in the CSS comment is read verbatim.

8.5.12 already fixed a strictly worse variant of this (any file, any extension, could be read) by requiring the resolved path to end in .map (loadFile()). That fix did not address the traversal itself, only the target extension. Since the join(dirname(file), map) logic has existed unchanged since PostCSS 8.0.0 (Feb 2020), any file ending in .map remains readable through this path in the current release (8.5.16).

Once loaded, MapGenerator.isMap() treats the mere presence of a loaded "previous map" as an implicit request to generate result.map, even when the caller never set the map option. If the loaded map has a sourcesContent field (common for maps emitted by bundlers/transpilers), that content is merged into result.map and returned to the caller — disclosing the traversed-to file's content to whoever supplied the CSS.

Attack Scenario
  1. A service accepts user-submitted CSS and runs it through PostCSS to lint/format/transform it, e.g. postcss().process(userCss, { from: '/app/uploads/user123/input.css', to: '/app/uploads/user123/output.css' }) — idiomatic usage; map option untouched.
  2. Attacker submits CSS containing /*# sourceMappingURL=../../../../some/other/app/dist/bundle.js.map */ (or an absolute path if from is unset).
  3. PostCSS reads that .map file and folds its sourcesContent into result.map.
  4. The service does what most build pipelines do with a truthy result.map — writes it next to the CSS output or returns it via API (source maps are meant to be consumed by browser devtools, so this is commonly public/served).
  5. Attacker retrieves the emitted map and reads out the traversed file's content.
Impact

Disclosure of the contents of arbitrary .map files reachable via path traversal (or absolute path when from is unset) from the process's filesystem. Affects any application processing CSS it does not fully trust without explicitly passing map: false. No authentication or user interaction beyond submitting CSS text is required.

Vulnerable Code
loadFile(path, cssFile, trusted) {
  if (!trusted && !this.unsafeMap) {
    if (!/\.map$/i.test(path)) {
      return undefined
    }
  }
  this.root = dirname(path)
  if (existsSync(path)) {
    this.mapFile = path
    return readFileSync(path, 'utf-8').toString().trim()
  }
}

loadMap(file, prev) {
  ...
  } else if (this.annotation) {
    let map = this.annotation
    if (file) map = join(dirname(file), map)
    let unknown = this.loadFile(map, file, false)
    ...
  }
}
Recommended Fix

Constrain the resolved path to remain inside the CSS file's own directory instead of relying solely on a filename-extension check:

loadFile(path, cssFile, trusted) {
  if (!trusted && !this.unsafeMap) {
    if (!/\.map$/i.test(path)) {
      return undefined
    }
    if (!cssFile) return undefined
    let root = resolve(dirname(cssFile))
    let resolvedPath = resolve(root, path)
    if (resolvedPath !== root && !resolvedPath.startsWith(root + sep)) {
      return undefined
    }
  }
  this.root = dirname(path)
  if (existsSync(path)) {
    this.mapFile = path
    return readFileSync(path, 'utf-8').toString().trim()
  }
}

I've implemented, tested (full existing test suite — 660/660 passing, plus new PoC-based regression checks for both the traversal and legitimate same-directory cases), and can share this fix on request or via a private fork if invited.

Verification

Dynamically confirmed on v8.5.16 (current npm release / repo HEAD) via a standalone Node.js harness against lib/postcss.js: a "secret" .map file placed two directories outside a simulated project directory was read via a crafted sourceMappingURL comment in otherwise-innocuous CSS, with its sourcesContent appearing verbatim in result.map.toString() — with no map option set by the caller. A second harness confirmed the simpler no-from case reads an absolute path directly. A third harness confirmed map: false is the only current workaround. The attached fix branch closes both vectors while keeping all 660 existing unit tests green.

Severity

  • CVSS Score: 7.5 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

postcss/postcss (postcss)

v8.5.18

Compare Source

  • Restricted loading previous source maps file to the opts.from folder for security reasons (use unsafeMap: true to disable the check).

v8.5.17

Compare Source

  • Fixed Maximum call stack size exceeded error.
  • Fixed Prototype hijacking for postcss.fromJSON().
  • Fixed Input#origin() for unmapped end position (by @​chatman-media).

v8.5.16

Compare Source


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot enabled auto-merge (squash) August 2, 2026 04:27
@changeset-bot

changeset-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1aa1346

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

📊 Package size report   No changes

File Before After
Total (Includes all files) 3.5 MB 3.5 MB
Tarball size 1.1 MB 1.1 MB
Unchanged files
File Size
.browserslistrc 41 B
.changeset/config.json 311 B
.changeset/README.md 510 B
.codesandbox/ci.json 63 B
.commitlintrc 35 B
.editorconfig 145 B
.gitattributes 115 B
.github/workflows/autofix.yml 913 B
.github/workflows/ci.yml 1.7 kB
.github/workflows/pkg-pr-new.yml 646 B
.github/workflows/pkg-size.yml 702 B
.github/workflows/release.yml 1.3 kB
.markuplintrc 96 B
.nano-staged.js 48 B
.nvmrc 6 B
.postcssrc.cjs 49 B
.prettierignore 41 B
.prettierrc 24 B
.remarkrc 42 B
.renovaterc 49 B
.simple-git-hooks.js 49 B
.stylelintignore 209 B
.stylelintrc 90 B
.yarn/plugins/plugin-prepare-lifecycle.cjs 202 B
.yarn/releases/yarn-4.15.0.cjs 3.0 MB
.yarnrc.yml 398 B
CHANGELOG.md 1.1 kB
default.json 499 B
eslint.config.js 516 B
global.d.ts 53 B
LICENSE 1.1 kB
package.json 2.7 kB
packages/app-config/CHANGELOG.md 55.0 kB
packages/app-config/package.json 769 B
packages/app-config/README.md 2.7 kB
packages/babel-preset/CHANGELOG.md 24.7 kB
packages/babel-preset/config.js 43 B
packages/babel-preset/index.js 5.6 kB
packages/babel-preset/package.json 1.6 kB
packages/babel-preset/README.md 2.7 kB
packages/browserslist-config/_not.js 140 B
packages/browserslist-config/alauda-legacy.js 51 B
packages/browserslist-config/alauda.js 129 B
packages/browserslist-config/CHANGELOG.md 7.5 kB
packages/browserslist-config/index.js 116 B
packages/browserslist-config/latest.js 186 B
packages/browserslist-config/modern.js 167 B
packages/browserslist-config/package.json 570 B
packages/browserslist-config/README.md 2.7 kB
packages/commitlint-config/CHANGELOG.md 14.5 kB
packages/commitlint-config/index.js 537 B
packages/commitlint-config/package.json 638 B
packages/commitlint-config/README.md 2.7 kB
packages/common-config/CHANGELOG.md 51.6 kB
packages/common-config/package.json 954 B
packages/common-config/README.md 2.7 kB
packages/config/CHANGELOG.md 4.0 kB
packages/config/index.d.ts 308 B
packages/config/index.js 1.1 kB
packages/config/package.json 599 B
packages/config/README.md 2.7 kB
packages/eslint-config/_util.js 2.2 kB
packages/eslint-config/angular.js 1.2 kB
packages/eslint-config/base.d.ts 109 B
packages/eslint-config/base.js 5.8 kB
packages/eslint-config/CHANGELOG.md 60.8 kB
packages/eslint-config/index.d.ts 58 B
packages/eslint-config/index.js 58 B
packages/eslint-config/jest.js 391 B
packages/eslint-config/js-base.js 1.4 kB
packages/eslint-config/js.js 582 B
packages/eslint-config/loose.d.ts 110 B
packages/eslint-config/loose.js 1.4 kB
packages/eslint-config/overrides.d.ts 1.2 kB
packages/eslint-config/overrides.js 6.3 kB
packages/eslint-config/package.json 3.1 kB
packages/eslint-config/react.js 1.7 kB
packages/eslint-config/README.md 2.7 kB
packages/eslint-config/recommended.d.ts 116 B
packages/eslint-config/recommended.js 142 B
packages/eslint-config/test.js 309 B
packages/eslint-config/ts-base.js 4.0 kB
packages/eslint-config/vitest.js 396 B
packages/eslint-config/vue.js 1.5 kB
packages/markuplint-config/angular.js 122 B
packages/markuplint-config/base.d.ts 87 B
packages/markuplint-config/base.js 413 B
packages/markuplint-config/CHANGELOG.md 6.5 kB
packages/markuplint-config/index.d.ts 36 B
packages/markuplint-config/index.js 36 B
packages/markuplint-config/package.json 934 B
packages/markuplint-config/README.md 2.7 kB
packages/markuplint-config/vue.d.ts 85 B
packages/markuplint-config/vue.js 240 B
packages/nano-staged/_utils.js 429 B
packages/nano-staged/base.js 1.4 kB
packages/nano-staged/CHANGELOG.md 3.7 kB
packages/nano-staged/index.js 36 B
packages/nano-staged/ngc.js 216 B
packages/nano-staged/package.json 982 B
packages/nano-staged/README.md 2.7 kB
packages/nano-staged/tsc.js 255 B
packages/nano-staged/vue-tsc.js 249 B
packages/postcss-config/CHANGELOG.md 17.9 kB
packages/postcss-config/index.d.ts 88 B
packages/postcss-config/index.js 1.3 kB
packages/postcss-config/package.json 1.2 kB
packages/postcss-config/README.md 2.7 kB
packages/prettier-config/angular.d.ts 36 B
packages/prettier-config/angular.js 210 B
packages/prettier-config/base.d.ts 92 B
packages/prettier-config/base.js 2.0 kB
packages/prettier-config/CHANGELOG.md 29.5 kB
packages/prettier-config/index.d.ts 36 B
packages/prettier-config/index.js 36 B
packages/prettier-config/next.d.ts 36 B
packages/prettier-config/next.js 220 B
packages/prettier-config/package.json 1.5 kB
packages/prettier-config/quote.d.ts 36 B
packages/prettier-config/quote.js 94 B
packages/prettier-config/README.md 2.7 kB
packages/prettier-config/semi/angular.d.ts 37 B
packages/prettier-config/semi/angular.js 90 B
packages/prettier-config/semi/index.d.ts 37 B
packages/prettier-config/semi/index.js 87 B
packages/prettier-config/semi/next.d.ts 37 B
packages/prettier-config/semi/next.js 87 B
packages/prettier-config/semi/quote.d.ts 37 B
packages/prettier-config/semi/quote.js 88 B
packages/prettier-config/semi/vue.d.ts 37 B
packages/prettier-config/semi/vue.js 86 B
packages/prettier-config/vue.d.ts 36 B
packages/prettier-config/vue.js 206 B
packages/remark-preset/CHANGELOG.md 9.0 kB
packages/remark-preset/index.js 1.3 kB
packages/remark-preset/package.json 1.1 kB
packages/remark-preset/README.md 2.7 kB
packages/simple-git-hooks/CHANGELOG.md 4.6 kB
packages/simple-git-hooks/index.js 193 B
packages/simple-git-hooks/package.json 711 B
packages/simple-git-hooks/README.md 2.7 kB
packages/stylelint-config/_overrides.js 939 B
packages/stylelint-config/base.d.ts 76 B
packages/stylelint-config/base.js 1.5 kB
packages/stylelint-config/CHANGELOG.md 23.7 kB
packages/stylelint-config/index.d.ts 80 B
packages/stylelint-config/index.js 72 B
packages/stylelint-config/loose.d.ts 78 B
packages/stylelint-config/loose.js 76 B
packages/stylelint-config/modules.d.ts 82 B
packages/stylelint-config/modules.js 263 B
packages/stylelint-config/package.json 1.3 kB
packages/stylelint-config/README.md 2.7 kB
packages/stylelint-config/scss/base.d.ts 76 B
packages/stylelint-config/scss/base.js 1.4 kB
packages/stylelint-config/scss/index.d.ts 36 B
packages/stylelint-config/scss/index.js 36 B
packages/stylelint-config/scss/loose.d.ts 78 B
packages/stylelint-config/scss/loose.js 369 B
packages/tsconfig/angular.json 306 B
packages/tsconfig/app.json 282 B
packages/tsconfig/CHANGELOG.md 11.7 kB
packages/tsconfig/dom-lib.json 158 B
packages/tsconfig/erasable.json 147 B
packages/tsconfig/lib.json 189 B
packages/tsconfig/loose.json 180 B
packages/tsconfig/ng-lib.json 387 B
packages/tsconfig/node.json 236 B
packages/tsconfig/node16.json 192 B
packages/tsconfig/nodenext.json 196 B
packages/tsconfig/package.json 602 B
packages/tsconfig/README.md 2.7 kB
packages/tsconfig/tsconfig.json 685 B
patches/vue-eslint-parser+10.4.0.patch 977 B
README.md 4.0 kB
SECURITY.md 212 B
tests/_test.ts 1.1 kB
tests/global.d.ts 41 B
tests/test.cjs 742 B
tests/test.component.html 142 B
tests/test.component.ts 198 B
tests/test.css 53 B
tests/test.d.ts 409 B
tests/test.html 191 B
tests/test.js 753 B
tests/test.json 23 B
tests/test.json5 22 B
tests/test.jsonc 37 B
tests/test.less 315 B
tests/test.md 61 B
tests/test.mdx 143 B
tests/test.pug 17 B
tests/test.scss 381 B
tests/test.sh 20 B
tests/test.spec.js 129 B
tests/test.spec.ts 671 B
tests/test.svg 1.2 kB
tests/test.toml 16 B
tests/test.vue 439 B
tests/test.yaml 13 B
tests/test.yml 13 B
tests/test1.jsx 347 B
tests/test2.ts 1.8 kB
tests/test3.tsx 395 B
tsconfig.json 41 B
vitest.config.ts 227 B

🤖 This report was automatically generated by pkg-size-action

@codesandbox-ci

codesandbox-ci Bot commented Aug 2, 2026

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@socket-security

socket-security Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedpostcss@​8.5.15 ⏵ 8.5.26100 +1100 +188295100

View full report

@pkg-pr-new

pkg-pr-new Bot commented Aug 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@1stg/app-config

npm i https://pkg.pr.new/@1stg/app-config@400

@1stg/babel-preset

npm i https://pkg.pr.new/@1stg/babel-preset@400

@1stg/browserslist-config

npm i https://pkg.pr.new/@1stg/browserslist-config@400

@1stg/commitlint-config

npm i https://pkg.pr.new/@1stg/commitlint-config@400

@1stg/common-config

npm i https://pkg.pr.new/@1stg/common-config@400

@1stg/config

npm i https://pkg.pr.new/@1stg/config@400

@1stg/eslint-config

npm i https://pkg.pr.new/@1stg/eslint-config@400

@1stg/markuplint-config

npm i https://pkg.pr.new/@1stg/markuplint-config@400

@1stg/nano-staged

npm i https://pkg.pr.new/@1stg/nano-staged@400

@1stg/postcss-config

npm i https://pkg.pr.new/@1stg/postcss-config@400

@1stg/prettier-config

npm i https://pkg.pr.new/@1stg/prettier-config@400

@1stg/remark-preset

npm i https://pkg.pr.new/@1stg/remark-preset@400

@1stg/simple-git-hooks

npm i https://pkg.pr.new/@1stg/simple-git-hooks@400

@1stg/stylelint-config

npm i https://pkg.pr.new/@1stg/stylelint-config@400

@1stg/tsconfig

npm i https://pkg.pr.new/@1stg/tsconfig@400

commit: 1aa1346

@renovate
renovate Bot force-pushed the renovate/npm-postcss-vulnerability branch from f5a31cb to 1aa1346 Compare August 12, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants