@pnpm/fetching.git-fetcher 1101.0.9 → 1101.0.10
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.js +6 -0
- package/package.json +10 -10
package/lib/index.js
CHANGED
|
@@ -13,6 +13,9 @@ export function createGitFetcher(createOpts) {
|
|
|
13
13
|
const allowedHosts = new Set(createOpts?.gitShallowHosts ?? []);
|
|
14
14
|
const ignoreScripts = createOpts.ignoreScripts ?? false;
|
|
15
15
|
const gitFetcher = async (cafs, resolution, opts) => {
|
|
16
|
+
if (!isValidCommitHash(resolution.commit)) {
|
|
17
|
+
throw new PnpmError('INVALID_GIT_COMMIT', `Invalid git commit hash "${resolution.commit}" for repository "${resolution.repo}". Expected a 40-character hexadecimal SHA.`);
|
|
18
|
+
}
|
|
16
19
|
const tempLocation = await cafs.tempDir();
|
|
17
20
|
if (allowedHosts.size > 0 && shouldUseShallow(resolution.repo, allowedHosts)) {
|
|
18
21
|
await execGit(['init'], { cwd: tempLocation });
|
|
@@ -65,6 +68,9 @@ export function createGitFetcher(createOpts) {
|
|
|
65
68
|
git: gitFetcher,
|
|
66
69
|
};
|
|
67
70
|
}
|
|
71
|
+
function isValidCommitHash(commit) {
|
|
72
|
+
return /^[0-9a-f]{40}$/i.test(commit);
|
|
73
|
+
}
|
|
68
74
|
function shouldUseShallow(repoUrl, allowedHosts) {
|
|
69
75
|
try {
|
|
70
76
|
const { host } = new URL(repoUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/fetching.git-fetcher",
|
|
3
|
-
"version": "1101.0.
|
|
3
|
+
"version": "1101.0.10",
|
|
4
4
|
"description": "A fetcher for git-hosted packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -27,25 +27,25 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@zkochan/rimraf": "^4.0.0",
|
|
29
29
|
"execa": "npm:safe-execa@0.3.0",
|
|
30
|
+
"@pnpm/exec.prepare-package": "1100.0.14",
|
|
30
31
|
"@pnpm/error": "1100.0.0",
|
|
31
|
-
"@pnpm/
|
|
32
|
-
"@pnpm/exec.prepare-package": "1100.0.13",
|
|
32
|
+
"@pnpm/store.index": "1100.1.0",
|
|
33
33
|
"@pnpm/fs.packlist": "1100.0.1",
|
|
34
|
-
"@pnpm/
|
|
34
|
+
"@pnpm/fetching.fetcher-base": "1100.1.6"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@pnpm/logger": "
|
|
38
|
-
"@pnpm/worker": "^1100.1.
|
|
37
|
+
"@pnpm/logger": "^1001.0.1",
|
|
38
|
+
"@pnpm/worker": "^1100.1.8"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@jest/globals": "30.3.0",
|
|
42
42
|
"@pnpm/util.lex-comparator": "^3.0.2",
|
|
43
43
|
"tempy": "3.0.0",
|
|
44
|
-
"@pnpm/
|
|
45
|
-
"@pnpm/store.cafs": "1100.1.6",
|
|
44
|
+
"@pnpm/store.cafs": "1100.1.7",
|
|
46
45
|
"@pnpm/logger": "1100.0.0",
|
|
47
|
-
"@pnpm/
|
|
48
|
-
"@pnpm/
|
|
46
|
+
"@pnpm/store.create-cafs-store": "1100.0.10",
|
|
47
|
+
"@pnpm/types": "1101.2.0",
|
|
48
|
+
"@pnpm/fetching.git-fetcher": "1101.0.10"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=22.13"
|