semantic-release 25.0.6 → 25.0.7
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/index.d.ts +3 -0
- package/lib/definitions/errors.js +15 -0
- package/lib/git.js +13 -11
- package/lib/verify.js +4 -0
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -627,6 +627,9 @@ declare module "semantic-release" {
|
|
|
627
627
|
* Any valid git url format is supported (see
|
|
628
628
|
* [git protocols](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols))
|
|
629
629
|
*
|
|
630
|
+
* The value must not begin with `-`, as it would otherwise be interpreted
|
|
631
|
+
* by `git` as a command-line option rather than a URL.
|
|
632
|
+
*
|
|
630
633
|
* Default: `repository` property in `package.json`, or git origin url.
|
|
631
634
|
*/
|
|
632
635
|
repositoryUrl?: string | undefined;
|
|
@@ -42,6 +42,21 @@ Please make sure to add the \`repositoryUrl\` to the [semantic-release configura
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export function EINVALIDREPOURL({ repositoryUrl }) {
|
|
46
|
+
return {
|
|
47
|
+
message: "The `repositoryUrl` option is not a valid git URL.",
|
|
48
|
+
details: `The [repositoryUrl option](${linkify(
|
|
49
|
+
"usage/configuration#repositoryurl"
|
|
50
|
+
)}) must be a valid git URL and cannot begin with \`-\`, as \`git\` would otherwise interpret it as a command-line option rather than a URL.
|
|
51
|
+
|
|
52
|
+
The invalid \`repositoryUrl\` is \`${repositoryUrl}\`.
|
|
53
|
+
|
|
54
|
+
Please verify the \`repository\` property in your \`package.json\` and the [repositoryUrl option](${linkify(
|
|
55
|
+
"usage/configuration#repositoryurl"
|
|
56
|
+
)}) in your [semantic-release configuration](${linkify("usage/configuration#configuration")}).`,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
45
60
|
export function EGITNOPERMISSION({ options: { repositoryUrl }, branch: { name } }) {
|
|
46
61
|
return {
|
|
47
62
|
message: "Cannot push to the Git repository.",
|
package/lib/git.js
CHANGED
|
@@ -67,7 +67,7 @@ export async function getCommits(from, to, execaOptions) {
|
|
|
67
67
|
* @throws {Error} If the `git` command fails.
|
|
68
68
|
*/
|
|
69
69
|
export async function getBranches(repositoryUrl, execaOptions) {
|
|
70
|
-
return (await execa("git", ["ls-remote", "--heads", repositoryUrl], execaOptions)).stdout
|
|
70
|
+
return (await execa("git", ["ls-remote", "--heads", "--", repositoryUrl], execaOptions)).stdout
|
|
71
71
|
.split("\n")
|
|
72
72
|
.filter(Boolean)
|
|
73
73
|
.map((branch) => branch.match(/^.+refs\/heads\/(?<branch>.+)$/)[1]);
|
|
@@ -115,8 +115,8 @@ export async function fetch(repositoryUrl, branch, ciBranch, execaOptions) {
|
|
|
115
115
|
"--unshallow",
|
|
116
116
|
"--tags",
|
|
117
117
|
...(branch === ciBranch && !isDetachedHead
|
|
118
|
-
? [repositoryUrl]
|
|
119
|
-
: ["--update-head-ok", repositoryUrl, `+refs/heads/${branch}:refs/heads/${branch}`]),
|
|
118
|
+
? ["--", repositoryUrl]
|
|
119
|
+
: ["--update-head-ok", "--", repositoryUrl, `+refs/heads/${branch}:refs/heads/${branch}`]),
|
|
120
120
|
],
|
|
121
121
|
execaOptions
|
|
122
122
|
);
|
|
@@ -127,8 +127,8 @@ export async function fetch(repositoryUrl, branch, ciBranch, execaOptions) {
|
|
|
127
127
|
"fetch",
|
|
128
128
|
"--tags",
|
|
129
129
|
...(branch === ciBranch && !isDetachedHead
|
|
130
|
-
? [repositoryUrl]
|
|
131
|
-
: ["--update-head-ok", repositoryUrl, `+refs/heads/${branch}:refs/heads/${branch}`]),
|
|
130
|
+
? ["--", repositoryUrl]
|
|
131
|
+
: ["--update-head-ok", "--", repositoryUrl, `+refs/heads/${branch}:refs/heads/${branch}`]),
|
|
132
132
|
],
|
|
133
133
|
execaOptions
|
|
134
134
|
);
|
|
@@ -143,9 +143,9 @@ export async function fetch(repositoryUrl, branch, ciBranch, execaOptions) {
|
|
|
143
143
|
*/
|
|
144
144
|
export async function fetchNotes(repositoryUrl, execaOptions) {
|
|
145
145
|
try {
|
|
146
|
-
await execa("git", ["fetch", "--unshallow", repositoryUrl, `+refs/notes/*:refs/notes/*`], execaOptions);
|
|
146
|
+
await execa("git", ["fetch", "--unshallow", "--", repositoryUrl, `+refs/notes/*:refs/notes/*`], execaOptions);
|
|
147
147
|
} catch {
|
|
148
|
-
await execa("git", ["fetch", repositoryUrl, `+refs/notes/*:refs/notes/*`], {
|
|
148
|
+
await execa("git", ["fetch", "--", repositoryUrl, `+refs/notes/*:refs/notes/*`], {
|
|
149
149
|
...execaOptions,
|
|
150
150
|
reject: false,
|
|
151
151
|
});
|
|
@@ -204,7 +204,7 @@ export async function isGitRepo(execaOptions) {
|
|
|
204
204
|
*/
|
|
205
205
|
export async function verifyAuth(repositoryUrl, branch, execaOptions) {
|
|
206
206
|
try {
|
|
207
|
-
await execa("git", ["push", "--dry-run", "--no-verify", repositoryUrl, `HEAD:${branch}`], execaOptions);
|
|
207
|
+
await execa("git", ["push", "--dry-run", "--no-verify", "--", repositoryUrl, `HEAD:${branch}`], execaOptions);
|
|
208
208
|
} catch (error) {
|
|
209
209
|
debug(error);
|
|
210
210
|
throw error;
|
|
@@ -233,7 +233,7 @@ export async function tag(tagName, ref, execaOptions) {
|
|
|
233
233
|
* @throws {Error} if the push failed.
|
|
234
234
|
*/
|
|
235
235
|
export async function push(repositoryUrl, execaOptions) {
|
|
236
|
-
await execa("git", ["push", "--tags", repositoryUrl], execaOptions);
|
|
236
|
+
await execa("git", ["push", "--tags", "--", repositoryUrl], execaOptions);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
/**
|
|
@@ -245,7 +245,7 @@ export async function push(repositoryUrl, execaOptions) {
|
|
|
245
245
|
* @throws {Error} if the push failed.
|
|
246
246
|
*/
|
|
247
247
|
export async function pushNotes(repositoryUrl, ref, execaOptions) {
|
|
248
|
-
await execa("git", ["push", repositoryUrl, `refs/notes/${GIT_NOTE_REF}-${ref}`], execaOptions);
|
|
248
|
+
await execa("git", ["push", "--", repositoryUrl, `refs/notes/${GIT_NOTE_REF}-${ref}`], execaOptions);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
/**
|
|
@@ -292,7 +292,9 @@ export async function verifyBranchName(branch, execaOptions) {
|
|
|
292
292
|
export async function isBranchUpToDate(repositoryUrl, branch, execaOptions) {
|
|
293
293
|
return (
|
|
294
294
|
(await getGitHead(execaOptions)) ===
|
|
295
|
-
(await execa("git", ["ls-remote", "--heads", repositoryUrl, branch], execaOptions)).stdout.match(
|
|
295
|
+
(await execa("git", ["ls-remote", "--heads", "--", repositoryUrl, branch], execaOptions)).stdout.match(
|
|
296
|
+
/^(?<ref>\w+)?/
|
|
297
|
+
)[1]
|
|
296
298
|
);
|
|
297
299
|
}
|
|
298
300
|
|
package/lib/verify.js
CHANGED
|
@@ -15,6 +15,10 @@ export default async (context) => {
|
|
|
15
15
|
errors.push(getError("ENOGITREPO", { cwd }));
|
|
16
16
|
} else if (!repositoryUrl) {
|
|
17
17
|
errors.push(getError("ENOREPOURL"));
|
|
18
|
+
} else if (repositoryUrl.startsWith("-")) {
|
|
19
|
+
// A `repositoryUrl` beginning with `-` would be interpreted by `git` as a
|
|
20
|
+
// command-line option rather than a URL, enabling argument injection.
|
|
21
|
+
errors.push(getError("EINVALIDREPOURL", { repositoryUrl }));
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
// Verify that compiling the `tagFormat` produce a valid Git tag
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semantic-release",
|
|
3
3
|
"description": "Automated semver compliant package publishing",
|
|
4
|
-
"version": "25.0.
|
|
4
|
+
"version": "25.0.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
|
|
7
7
|
"ava": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"yargs": "^18.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@types/node": "24.13.
|
|
60
|
+
"@types/node": "24.13.3",
|
|
61
61
|
"@types/signale": "1.4.7",
|
|
62
62
|
"ava": "8.0.1",
|
|
63
63
|
"c8": "11.0.0",
|
|
@@ -167,5 +167,5 @@
|
|
|
167
167
|
]
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
|
-
"packageManager": "npm@
|
|
170
|
+
"packageManager": "npm@12.0.0+sha512.ab3bcf41f35263b968ba233aaefedd2f4862e5eb0118b9f594bc316ddc8be57388b2c5b3a183309fcc6abd68587192faa274e47a7612c6bb4ac6c16b15b505cb"
|
|
171
171
|
}
|