Skip to content

Commit eacba29

Browse files
committed
docs: add page about Mitigating supply chain attacks
1 parent 399b9e6 commit eacba29

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed

blog/releases/10.14.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ date: 2025-07-31
99

1010
Declare Node.js, Deno, or Bun in [`devEngines.runtime`](https://github.com/openjs-foundation/package-metadata-interoperability-collab-space/issues/15) (inside `package.json`) and let pnpm download and pin it automatically.
1111

12+
<!-- truncate -->
13+
1214
Usage example:
1315

1416
```json

blog/releases/10.15.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ date: 2025-08-19
1111

1212
Added the [`cleanupUnusedCatalogs`](/settings#cleanupunusedcatalogs) configuration. When set to `true`, pnpm will remove unused catalog entries during installation [#9793](https://github.com/pnpm/pnpm/pull/9793).
1313

14+
<!-- truncate -->
15+
1416
### Config dependency improvement
1517

1618
pnpm will now automatically load pnpmfiles from [config dependencies](/config-dependencies) that are named `@*/pnpm-plugin-*` [#9780](https://github.com/pnpm/pnpm/issues/9780).

blog/releases/10.16.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ date: 2025-09-12
1111

1212
There have been several incidents recently where popular packages were successfully attacked. To reduce the risk of installing a compromised version, we are introducing a new setting that delays the installation of newly released dependencies. In most cases, such attacks are discovered quickly and the malicious versions are removed from the registry within an hour.
1313

14+
<!-- truncate -->
15+
1416
The new setting is called [`minimumReleaseAge`]. It specifies the number of minutes that must pass after a version is published before pnpm will install it. For example, setting `minimumReleaseAge: 1440` ensures that only packages released at least one day ago can be installed.
1517

1618
If you set `minimumReleaseAge` but need to disable this restriction for certain dependencies, you can list them under the [`minimumReleaseAgeExclude`] setting. For instance, with the following configuration pnpm will always install the latest version of webpack, regardless of its release time:

docs/supply-chain-security.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
id: supply-chain-security
3+
title: Mitigating supply chain attacks
4+
---
5+
6+
Sometimes npm packages are compromised and published with malware. Luckily, there are companies like [Socket], [Snyk], and [Aikido] that detect these compromised packages early. The npm registry usually removes the affected versions within hours. However, there is always a window of time between when the malware is published and when it is detected, during which you could be exposed. Fortunately, there are some things you can do with pnpm to minimize the risks.
7+
8+
Historically, most compromised packages have used `postinstall` scripts to run code immediately upon installation. To mitigate this, pnpm v10 disables the automatic execution of `postinstall` scripts in dependencies. Although there is a setting to re-enable them globally using [dangerouslyAllowAllBuilds], we recommend explicitly listing only trusted dependencies. This way, if a dependency did not require a build in the past, it won't suddenly run a malicious script if a compromised version is published. Still, we recommend being cautious when updating a trusted package that has a `postinstall` script, as [it might get compromised].
9+
10+
Another way to reduce the risk of installing compromised packages is to delay updates to your dependencies. Since malware is usually detected quickly, delaying updates by 24 hours will most likely prevent you from installing a bad version. The [`minimumReleaseAge`] setting defines the minimum number of minutes that must pass after a version is published before pnpm will install it. For example, set it to `1440` to wait one day, or `10080` to wait one week before installing a new version.
11+
12+
It goes without saying that you should always lock your dependencies with a lockfile. Commit your lockfile to your repository to avoid unexpected updates.
13+
14+
[Socket]: https://socket.dev/
15+
[Snyk]: https://snyk.io
16+
[Aikido]: https://www.aikido.dev/
17+
[dangerouslyAllowAllBuilds]: settings.md#dangerouslyallowallbuilds
18+
[it might get compromised]: https://socket.dev/blog/nx-packages-compromised
19+
[minimumReleaseAge]: settings.md#minimumreleaseage

sidebars.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
"Recipes": [
120120
"using-changesets",
121121
"continuous-integration",
122+
"supply-chain-security",
122123
"typescript",
123124
"git",
124125
"docker",

versioned_sidebars/version-10.x-sidebars.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,10 @@
367367
"type": "doc",
368368
"id": "continuous-integration"
369369
},
370+
{
371+
"type": "doc",
372+
"id": "supply-chain-security"
373+
},
370374
{
371375
"type": "doc",
372376
"id": "typescript"

0 commit comments

Comments
 (0)