@pnpm/lockfile.fs 1100.1.16 → 1100.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,72 @@
1
1
  # @pnpm/lockfile-file
2
2
 
3
+ ## 1100.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **Security fix.** Affects projects using `namedRegistries` on pnpm 11.1.0–11.19.x. It is **semi-breaking** for those projects — see "If you use named registries" below.
8
+
9
+ The lockfile recorded no marker for which registry a package came from. Packages were keyed by `name@version` alone, and entry lookup went through `refToRelative(ref, name)`, so a dependency you declared against one registry could be satisfied by an entry that was actually resolved from another. When two registries served the same name and version, both collapsed onto a single `packages:` entry and whichever resolved first decided the tarball every consumer got.
10
+
11
+ That is a package-substitution risk: a package you expect from your private registry could be installed from a different registry that publishes the same name and version, and the lockfile recorded nothing that would let you tell.
12
+
13
+ Packages resolved from a named registry are now recorded under registry-qualified keys (`<name>@<registryName>:<version>`, e.g. `foo@work:1.0.0`), so each registry gets its own entry and the lockfile pins which one a dependency came from.
14
+
15
+ The lockfile format version is unchanged. Registry-qualified keys appear only for packages resolved from a named registry, so a project that does not use `namedRegistries` sees no difference, and older pnpm versions keep reading the file.
16
+
17
+ ### If you use named registries
18
+
19
+ Your next non-frozen install re-keys those entries, which shows up as a lockfile diff. Commit it — that diff is the fix being applied. Review it: an entry that moves to a registry you did not expect is worth investigating.
20
+
21
+ Everyone working on the project should be on this version or newer before you do. An older pnpm reads the re-keyed lockfile fine — frozen installs are unaffected — but it does not produce registry-qualified keys itself, so any install that updates the lockfile writes those entries back to the old shape, and the next install on a current pnpm re-qualifies them. The result is a lockfile that flips back and forth, and while it is in the old shape the project is exposed again. Because the lockfile format version is deliberately unchanged, pnpm cannot detect this and warn you about it.
22
+
23
+ There is no setting to keep the old behavior: the old shape is the vulnerability.
24
+
25
+ Tarball URLs that follow the standard registry layout are no longer written to the lockfile for named-registry packages; they are recomputed from the `namedRegistries` setting on demand.
26
+
27
+ To use named registries, map your aliases in `pnpm-workspace.yaml`:
28
+
29
+ ```yaml
30
+ namedRegistries:
31
+ work: https://npm.enterprise.example.com/
32
+ ```
33
+
34
+ ### New built-in `npmjs:` alias
35
+
36
+ `npmjs:` now resolves to `https://registry.npmjs.org/` with no configuration, alongside the existing `gh:` alias for GitHub Packages. It pins a dependency to the public registry even when `registry` points elsewhere, such as an internal proxy:
37
+
38
+ ```json
39
+ { "dependencies": { "left-pad": "npmjs:^1.3.0" } }
40
+ ```
41
+
42
+ `npm:` cannot do this — it is the alias protocol (`npm:<name>@<range>`) and resolves through whatever `registry` points at.
43
+
44
+ **If you mirror or proxy npmjs, point the alias at your mirror:**
45
+
46
+ ```yaml
47
+ namedRegistries:
48
+ npmjs: https://npm.internal.example.com/
49
+ ```
50
+
51
+ Built-in registry URLs are also the prefixes a lockfile's recorded tarball URL is matched against when pnpm verifies a package. Without the override, an entry whose tarball URL is on `registry.npmjs.org` is verified against the public registry rather than your mirror. This only affects lockfiles that record such URLs — a canonical URL for your configured registry is omitted from the lockfile and unaffected — and only when a tarball-URL, `minimumReleaseAge`, or `trustPolicy` check runs. Overriding the alias is the same escape hatch GHES users already have for `gh`.
52
+
53
+ Every alias the lockfile references must stay in `namedRegistries`: reading an entry whose alias is gone fails with `ERR_PNPM_MISSING_NAMED_REGISTRY` rather than silently falling back to the default registry, since that would fetch a different package. Renaming an alias re-resolves the packages that used it.
54
+
55
+ Named registry aliases that shadow a reserved dependency specifier prefix (`file`, `link`, `workspace`, `runtime`, `npm`, `jsr`, ...) are now rejected with `ERR_PNPM_RESERVED_NAMED_REGISTRY_NAME` instead of being silently shadowed by the corresponding resolver.
56
+
57
+ `pnpm licenses` and `pnpm sbom` now keep the two artifacts apart as well: license records carry the registry alias, and SBOM components carry the purl `repository_url` qualifier.
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies:
62
+ - @pnpm/constants@1101.0.0
63
+ - @pnpm/deps.path@1100.1.0
64
+ - @pnpm/error@1100.1.1
65
+ - @pnpm/lockfile.merger@1100.0.19
66
+ - @pnpm/lockfile.types@1100.0.19
67
+ - @pnpm/lockfile.utils@1101.0.0
68
+ - @pnpm/types@1101.9.0
69
+
3
70
  ## 1100.1.16
4
71
 
5
72
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/lockfile.fs",
3
- "version": "1100.1.16",
3
+ "version": "1100.2.0",
4
4
  "description": "Read/write pnpm-lock.yaml files",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -29,15 +29,15 @@
29
29
  "!*.map"
30
30
  ],
31
31
  "dependencies": {
32
- "@pnpm/constants": "1100.0.1",
33
- "@pnpm/deps.path": "1100.0.13",
34
- "@pnpm/error": "1100.1.0",
35
- "@pnpm/lockfile.merger": "1100.0.18",
36
- "@pnpm/lockfile.types": "1100.0.18",
37
- "@pnpm/lockfile.utils": "1100.1.7",
32
+ "@pnpm/constants": "1101.0.0",
33
+ "@pnpm/deps.path": "1100.1.0",
34
+ "@pnpm/error": "1100.1.1",
35
+ "@pnpm/lockfile.merger": "1100.0.19",
36
+ "@pnpm/lockfile.types": "1100.0.19",
37
+ "@pnpm/lockfile.utils": "1101.0.0",
38
38
  "@pnpm/network.git-utils": "1100.0.3",
39
39
  "@pnpm/object.key-sorting": "1100.0.2",
40
- "@pnpm/types": "1101.8.0",
40
+ "@pnpm/types": "1101.9.0",
41
41
  "@zkochan/rimraf": "^4.0.0",
42
42
  "comver-to-semver": "^2.0.0",
43
43
  "js-yaml": "npm:@zkochan/js-yaml@0.0.11",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@jest/globals": "30.4.1",
55
- "@pnpm/lockfile.fs": "1100.1.16",
55
+ "@pnpm/lockfile.fs": "1100.2.0",
56
56
  "@pnpm/logger": "1100.0.0",
57
57
  "@types/js-yaml": "^4.0.9",
58
58
  "@types/normalize-path": "^3.0.2",