@pnpm/lockfile.utils 1100.0.11 → 1100.0.12

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.
package/lib/index.d.ts CHANGED
@@ -4,6 +4,6 @@ export { packageIdFromSnapshot } from './packageIdFromSnapshot.js';
4
4
  export { packageIsIndependent } from './packageIsIndependent.js';
5
5
  export { pkgSnapshotToResolution } from './pkgSnapshotToResolution.js';
6
6
  export { refIsLocalDirectory, refIsLocalTarball } from './refIsLocalTarball.js';
7
- export { toLockfileResolution } from './toLockfileResolution.js';
7
+ export { isGitHostedTarballUrl, toLockfileResolution } from './toLockfileResolution.js';
8
8
  export * from '@pnpm/lockfile.types';
9
9
  export declare const getPkgShortId: typeof refToRelative;
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@ export { packageIdFromSnapshot } from './packageIdFromSnapshot.js';
4
4
  export { packageIsIndependent } from './packageIsIndependent.js';
5
5
  export { pkgSnapshotToResolution } from './pkgSnapshotToResolution.js';
6
6
  export { refIsLocalDirectory, refIsLocalTarball } from './refIsLocalTarball.js';
7
- export { toLockfileResolution } from './toLockfileResolution.js';
7
+ export { isGitHostedTarballUrl, toLockfileResolution } from './toLockfileResolution.js';
8
8
  export * from '@pnpm/lockfile.types';
9
9
  // for backward compatibility
10
10
  export const getPkgShortId = refToRelative;
@@ -59,9 +59,14 @@ function preservingGitHosted(resolution, gitHosted) {
59
59
  // dep graph. Used as a fallback when callers haven't pre-set the
60
60
  // `gitHosted` field on TarballResolution.
61
61
  export function isGitHostedTarballUrl(url) {
62
- return (url.startsWith('https://codeload.github.com/') ||
63
- url.startsWith('https://bitbucket.org/') ||
64
- url.startsWith('https://gitlab.com/')) && url.includes('tar.gz');
62
+ // Schemes and hostnames are case-insensitive, so match against a lowercased
63
+ // copy: a tampered `https://CODELOAD.GITHUB.COM/...` must not slip past as a
64
+ // non-git-hosted (and therefore registry-trusted) tarball. Only the
65
+ // lowercased copy is inspected; the original URL is never rewritten.
66
+ const lowerUrl = url.toLowerCase();
67
+ return (lowerUrl.startsWith('https://codeload.github.com/') ||
68
+ lowerUrl.startsWith('https://bitbucket.org/') ||
69
+ lowerUrl.startsWith('https://gitlab.com/')) && lowerUrl.includes('tar.gz');
65
70
  }
66
71
  function removeProtocol(url) {
67
72
  return url.split('://')[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/lockfile.utils",
3
- "version": "1100.0.11",
3
+ "version": "1100.0.12",
4
4
  "description": "Utils for dealing with pnpm-lock.yaml",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -31,12 +31,12 @@
31
31
  "dependencies": {
32
32
  "get-npm-tarball-url": "^2.1.0",
33
33
  "ramda": "npm:@pnpm/ramda@0.28.1",
34
- "@pnpm/deps.path": "1100.0.6",
35
- "@pnpm/hooks.types": "1100.0.10",
36
- "@pnpm/resolving.resolver-base": "1100.4.0",
37
- "@pnpm/lockfile.types": "1100.0.9",
38
- "@pnpm/error": "1100.0.0",
39
- "@pnpm/types": "1101.3.0"
34
+ "@pnpm/deps.path": "1100.0.7",
35
+ "@pnpm/lockfile.types": "1100.0.10",
36
+ "@pnpm/resolving.resolver-base": "1100.4.1",
37
+ "@pnpm/types": "1101.3.1",
38
+ "@pnpm/hooks.types": "1100.0.11",
39
+ "@pnpm/error": "1100.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@jest/globals": "30.3.0",
@@ -44,7 +44,7 @@
44
44
  "tempy": "3.0.0",
45
45
  "write-yaml-file": "^6.0.0",
46
46
  "yaml-tag": "1.1.0",
47
- "@pnpm/lockfile.utils": "1100.0.11"
47
+ "@pnpm/lockfile.utils": "1100.0.12"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=22.13"