Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(): update pnpm to v9.15.0 [security] #1437

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 11, 2024

This PR contains the following updates:

Package Type Update Change OpenSSF
pnpm (source) packageManager minor 9.12.2 -> 9.15.0 OpenSSF Scorecard
pnpm (source) engines minor ^9.0.0 -> ^9.15.0 OpenSSF Scorecard

pnpm no-script global cache poisoning via overrides / ignore-scripts evasion

CVE-2024-53866 / GHSA-vm32-9rqf-rh3r

More information

Details

Summary

pnpm seems to mishandle overrides and global cache:

  1. Overrides from one workspace leak into npm metadata saved in global cache
  2. npm metadata from global cache affects other workspaces
  3. installs by default don't revalidate the data (including on first lockfile generation)

This can make workspace A (even running with ignore-scripts=true) posion global cache and execute scripts in workspace B

Users generally expect ignore-scripts to be sufficient to prevent immediate code execution on install (e.g. when the tree is just repacked/bundled without executing it).

Here, that expectation is broken

Details

See PoC.

In it, overrides from a single run of A get leaked into e.g. ~/Library/Caches/pnpm/metadata/registry.npmjs.org/rimraf.json and persistently affect all other projects using the cache

PoC

Postinstall code used in PoC is benign and can be inspected in https://www.npmjs.com/package/ponyhooves?activeTab=code, it's just a console.log

  1. Remove store and cache
    On mac: rm -rf ~/Library/Caches/pnpm ~/Library/pnpm/store
    This step is not required in general, but we'll be using a popular package for PoC that's likely cached
  2. Create A/package.json:
    {
      "name": "A",
      "pnpm": { "overrides": { "rimraf>glob": "npm:ponyhooves@1" } },
      "dependencies": { "rimraf": "6.0.1" }
    }
    Install it with pnpm i --ignore-scripts (the flag is not required, but the point of the demo is to show that it doesn't help)
  3. Create B/package.json:
    {
      "name": "B",
      "dependencies": { "rimraf": "6.0.1" }
    }
    Install it with pnpm i

Result:

Packages: +3
+++
Progress: resolved 3, reused 3, downloaded 0, added 3, done
node_modules/.pnpm/[email protected]/node_modules/ponyhooves: Running postinstall script, done in 51ms

dependencies:
+ rimraf 6.0.1

Done in 1.4s

Also, that code got leaked into another project and it's lockfile now!

Impact

Global state integrity is lost via operations that one would expect to be secure, enabling subsequently running arbitrary code execution on installs

As a work-around, use separate cache and store dirs in each workspace

Severity

  • CVSS Score: Unknown
  • Vector String: CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:N/VI:L/VA:N/SC:H/SI:H/SA:H

References

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


Release Notes

pnpm/pnpm (pnpm)

v9.15.0

Compare Source

v9.14.4

Compare Source

v9.14.3

Compare Source

v9.14.2

Compare Source

Patch Changes

  • pnpm publish --json should work #​8788.

Platinum Sponsors

Bit Bit Figma

Gold Sponsors

Discord Prisma
u|screen JetBrains
Nx CodeRabbit
Route4Me

v9.14.1

Compare Source

Minor Changes

  • Added support for pnpm pack --json to print packed tarball and contents in JSON format #​8765.

Patch Changes

  • pnpm exec should print a meaningful error message when no command is provided #​8752.
  • pnpm setup should remove the CLI from the target location before moving the new binary #​8173.
  • Fix ERR_PNPM_TARBALL_EXTRACT error while installing a dependency from GitHub having a slash in branch name #​7697.
  • Don't crash if the use-node-version setting is used and the system has no Node.js installed #​8769.
  • Convert settings in local .npmrc files to their correct types. For instance, child-concurrency should be a number, not a string #​5075.
  • pnpm should fail if a project requires a different package manager even if manage-package-manager-versions is set to true.
  • pnpm init should respect the --dir option #​8768.

Platinum Sponsors

Bit Bit Figma

Gold Sponsors

Discord Prisma
u|screen JetBrains
Nx CodeRabbit
Route4Me

v9.14.0

Compare Source

v9.13.2: pnpm 9.13.2

Compare Source

Patch Changes

  • Detection of circular peer dependencies should not crash with aliased dependencies #​8759. Fixes a regression introduced in the previous version.
  • Fix race condition of symlink creations caused by multiple parallel dlx processes.

Platinum Sponsors

Bit Bit Figma

Gold Sponsors

Discord Prisma
u|screen JetBrains
Nx CodeRabbit
Route4Me

Silver Sponsors

Leniolabs_ Vercel
Depot moonrepo
devowl.io Cerbos
vlt Vite

v9.13.1: pnpm 9.13.1

Compare Source

Patch Changes

  • Fixed some edge cases where resolving circular peer dependencies caused a dead lock #​8720.

Platinum Sponsors

Bit Bit Figma

Gold Sponsors

Discord Prisma
u|screen JetBrains
Nx CodeRabbit
Route4Me

Silver Sponsors

Leniolabs_ Vercel
Depot moonrepo
devowl.io Cerbos
vlt Vite

v9.13.0: pnpm 9.13

Compare Source

Minor Changes

  • The self-update now accepts a version specifier to install a specific version of pnpm. E.g.:

    pnpm self-update 9.5.0
    

    or

    pnpm self-update next-10
    

Patch Changes

  • Fix Cannot read properties of undefined (reading 'name') that is printed while trying to render the missing peer dependencies warning message #​8538.

Platinum Sponsors

Bit Figma

Gold Sponsors

Discord Prisma
u|screen JetBrains
Nx CodeRabbit
Route4Me

Silver Sponsors

Leniolabs_ Vercel
Depot moonrepo
devowl.io Cerbos
vlt Vite

v9.12.3

Compare Source

Patch Changes
  • Don't purge node_modules, when typing "n" in the prompt that asks whether to remove node_modules before installation #​8655.
  • Fix a bug causing pnpm to infinitely spawn itself when manage-package-manager-versions=true is set and the .tools directory is corrupt.
  • Use crypto.hash, when available, for improved performance #​8629.
  • Fixed a race condition in temporary file creation in the store by including worker thread ID in filename. Previously, multiple worker threads could attempt to use the same temporary file. Temporary files now include both process ID and thread ID for uniqueness #​8703.
  • All commands should read settings from the package.json at the root of the workspace #​8667.
  • When manage-package-manager-versions is set to true, errors spawning a self-managed version of pnpm will now be shown (instead of being silent).
  • Pass the find command to npm, it is an alias for npm search

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, 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.

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
inreach-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 7:25am

@renovate renovate bot requested a review from JoeKarow as a code owner December 11, 2024 07:20
@renovate renovate bot added automerge Enable Kodiak auto-merge dependencies Change in project dependencies. kodiak: merge.method = 'squash' Kodiak will squash merge this PR. security Addressing a vulnerability or security risk in this project. labels Dec 11, 2024
Copy link
Contributor

coderabbitai bot commented Dec 11, 2024

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or <!-- #coderabbitai summary --> to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

sonarcloud bot commented Dec 11, 2024

Copy link

relativeci bot commented Dec 11, 2024

#1876 Bundle Size — 5.64MiB (0%).

6750125(current) vs 6822567 dev#1689(baseline)

Warning

Bundle contains 5 duplicate packages – View duplicate packages

Bundle metrics  Change 1 change
                 Current
#1876
     Baseline
#1689
No change  Initial JS 3.05MiB 3.05MiB
No change  Initial CSS 9.7KiB 9.7KiB
Change  Cache Invalidation 28.34% 30.48%
No change  Chunks 67 67
No change  Assets 80 80
No change  Modules 2016 2016
No change  Duplicate Modules 361 361
No change  Duplicate Code 10% 10%
No change  Packages 159 159
No change  Duplicate Packages 5 5
Bundle size by type  no changes
                 Current
#1876
     Baseline
#1689
No change  JS 4.4MiB 4.4MiB
No change  Other 1.13MiB 1.13MiB
No change  Fonts 94.54KiB 94.54KiB
No change  CSS 9.7KiB 9.7KiB
No change  IMG 8.57KiB 8.57KiB

Bundle analysis reportBranch renovate/npm-pnpm-vulnerabilityProject dashboard


Generated by RelativeCIDocumentationReport issue

Copy link
Contributor

📦 Next.js Bundle Analysis for @weareinreach/app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

🤖 No test run has been triggered as your Meticulous project has been deactivated (since you haven't viewed any test results in a while). Click here to reactivate.

Last updated for commit 6750125. This comment will update as new commits are pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Enable Kodiak auto-merge dependencies Change in project dependencies. kodiak: merge.method = 'squash' Kodiak will squash merge this PR. security Addressing a vulnerability or security risk in this project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants