mobbdev 0.0.89 → 0.0.92
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/dist/index.mjs +147 -94
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -118,6 +118,7 @@ __export(utils_exports, {
|
|
|
118
118
|
CliError: () => CliError,
|
|
119
119
|
Spinner: () => Spinner,
|
|
120
120
|
getDirName: () => getDirName,
|
|
121
|
+
getTopLevelDirName: () => getTopLevelDirName,
|
|
121
122
|
keypress: () => keypress,
|
|
122
123
|
sleep: () => sleep
|
|
123
124
|
});
|
|
@@ -128,6 +129,9 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
128
129
|
function getDirName() {
|
|
129
130
|
return path2.dirname(fileURLToPath2(import.meta.url));
|
|
130
131
|
}
|
|
132
|
+
function getTopLevelDirName(fullPath) {
|
|
133
|
+
return path2.parse(fullPath).name;
|
|
134
|
+
}
|
|
131
135
|
|
|
132
136
|
// src/utils/keypress.ts
|
|
133
137
|
import readline from "node:readline";
|
|
@@ -181,12 +185,13 @@ import fetch3 from "node-fetch";
|
|
|
181
185
|
import open2 from "open";
|
|
182
186
|
import semver from "semver";
|
|
183
187
|
import tmp2 from "tmp";
|
|
184
|
-
import { z as
|
|
188
|
+
import { z as z11 } from "zod";
|
|
185
189
|
|
|
186
190
|
// src/features/analysis/git.ts
|
|
187
191
|
import Debug2 from "debug";
|
|
188
192
|
import { simpleGit } from "simple-git";
|
|
189
193
|
var debug2 = Debug2("mobbdev:git");
|
|
194
|
+
var GIT_NOT_INITIALIZED_ERROR_MESSAGE = "not a git repository";
|
|
190
195
|
async function getGitInfo(srcDirPath) {
|
|
191
196
|
debug2("getting git info for %s", srcDirPath);
|
|
192
197
|
const git = simpleGit({
|
|
@@ -206,8 +211,14 @@ async function getGitInfo(srcDirPath) {
|
|
|
206
211
|
debug2("failed to run git %o", e);
|
|
207
212
|
if (e.message.includes(" spawn ")) {
|
|
208
213
|
debug2("git cli not installed");
|
|
209
|
-
} else if (e.message.includes(
|
|
214
|
+
} else if (e.message.includes(GIT_NOT_INITIALIZED_ERROR_MESSAGE)) {
|
|
210
215
|
debug2("folder is not a git repo");
|
|
216
|
+
return {
|
|
217
|
+
success: false,
|
|
218
|
+
hash: void 0,
|
|
219
|
+
reference: void 0,
|
|
220
|
+
repoUrl: void 0
|
|
221
|
+
};
|
|
211
222
|
} else {
|
|
212
223
|
throw e;
|
|
213
224
|
}
|
|
@@ -221,6 +232,7 @@ async function getGitInfo(srcDirPath) {
|
|
|
221
232
|
repoUrl = repoUrl.replace("git@github.com:", "https://github.com/");
|
|
222
233
|
}
|
|
223
234
|
return {
|
|
235
|
+
success: true,
|
|
224
236
|
repoUrl,
|
|
225
237
|
hash,
|
|
226
238
|
reference
|
|
@@ -1081,16 +1093,16 @@ var GQLClient = class {
|
|
|
1081
1093
|
import { Octokit as Octokit3 } from "@octokit/core";
|
|
1082
1094
|
import Debug4 from "debug";
|
|
1083
1095
|
import parseDiff from "parse-diff";
|
|
1084
|
-
import { z as
|
|
1096
|
+
import { z as z10 } from "zod";
|
|
1085
1097
|
|
|
1086
1098
|
// src/features/analysis/scm/ado.ts
|
|
1087
1099
|
import querystring2 from "node:querystring";
|
|
1088
1100
|
import * as api from "azure-devops-node-api";
|
|
1089
|
-
import { z as
|
|
1101
|
+
import { z as z9 } from "zod";
|
|
1090
1102
|
|
|
1091
1103
|
// src/features/analysis/scm/scm.ts
|
|
1092
1104
|
import { Octokit as Octokit2 } from "@octokit/core";
|
|
1093
|
-
import { z as
|
|
1105
|
+
import { z as z8 } from "zod";
|
|
1094
1106
|
|
|
1095
1107
|
// src/features/analysis/scm/github/encryptSecret.ts
|
|
1096
1108
|
import sodium from "libsodium-wrappers";
|
|
@@ -1686,18 +1698,30 @@ function deleteGeneralPrComment(client, params) {
|
|
|
1686
1698
|
return client.request(DELETE_GENERAL_PR_COMMENT, params);
|
|
1687
1699
|
}
|
|
1688
1700
|
|
|
1689
|
-
// src/features/analysis/scm/gitlab.ts
|
|
1701
|
+
// src/features/analysis/scm/gitlab/gitlab.ts
|
|
1690
1702
|
import querystring from "node:querystring";
|
|
1691
|
-
import {
|
|
1703
|
+
import {
|
|
1704
|
+
Gitlab
|
|
1705
|
+
} from "@gitbeaker/rest";
|
|
1692
1706
|
import { ProxyAgent } from "undici";
|
|
1707
|
+
import { z as z5 } from "zod";
|
|
1708
|
+
|
|
1709
|
+
// src/features/analysis/scm/gitlab/types.ts
|
|
1693
1710
|
import { z as z4 } from "zod";
|
|
1711
|
+
var GitlabAuthResultZ = z4.object({
|
|
1712
|
+
access_token: z4.string(),
|
|
1713
|
+
token_type: z4.string(),
|
|
1714
|
+
refresh_token: z4.string()
|
|
1715
|
+
});
|
|
1716
|
+
|
|
1717
|
+
// src/features/analysis/scm/gitlab/gitlab.ts
|
|
1718
|
+
var EnvVariablesZod2 = z5.object({
|
|
1719
|
+
GITLAB_API_TOKEN: z5.string().optional()
|
|
1720
|
+
});
|
|
1721
|
+
var { GITLAB_API_TOKEN } = EnvVariablesZod2.parse(process.env);
|
|
1694
1722
|
function removeTrailingSlash2(str) {
|
|
1695
1723
|
return str.trim().replace(/\/+$/, "");
|
|
1696
1724
|
}
|
|
1697
|
-
var EnvVariablesZod2 = z4.object({
|
|
1698
|
-
GITLAB_API_TOKEN: z4.string().optional()
|
|
1699
|
-
});
|
|
1700
|
-
var { GITLAB_API_TOKEN } = EnvVariablesZod2.parse(process.env);
|
|
1701
1725
|
function getGitBeaker(options) {
|
|
1702
1726
|
const token = options?.gitlabAuthToken ?? GITLAB_API_TOKEN ?? "";
|
|
1703
1727
|
const url = options.url;
|
|
@@ -1850,6 +1874,18 @@ async function createMergeRequest(options) {
|
|
|
1850
1874
|
);
|
|
1851
1875
|
return res.iid;
|
|
1852
1876
|
}
|
|
1877
|
+
async function getGitlabMergeRequest({
|
|
1878
|
+
url,
|
|
1879
|
+
prNumber,
|
|
1880
|
+
accessToken
|
|
1881
|
+
}) {
|
|
1882
|
+
const { projectPath } = parseGitlabOwnerAndRepo(url);
|
|
1883
|
+
const api2 = getGitBeaker({
|
|
1884
|
+
url,
|
|
1885
|
+
gitlabAuthToken: accessToken
|
|
1886
|
+
});
|
|
1887
|
+
return await api2.MergeRequests.show(projectPath, prNumber);
|
|
1888
|
+
}
|
|
1853
1889
|
async function getGitlabRepoDefaultBranch(repoUrl, options) {
|
|
1854
1890
|
const api2 = getGitBeaker({
|
|
1855
1891
|
url: repoUrl,
|
|
@@ -1938,11 +1974,6 @@ async function getGitlabBlameRanges({ ref, gitlabUrl, path: path9 }, options) {
|
|
|
1938
1974
|
};
|
|
1939
1975
|
});
|
|
1940
1976
|
}
|
|
1941
|
-
var GitlabAuthResultZ = z4.object({
|
|
1942
|
-
access_token: z4.string(),
|
|
1943
|
-
token_type: z4.string(),
|
|
1944
|
-
refresh_token: z4.string()
|
|
1945
|
-
});
|
|
1946
1977
|
function initGitlabFetchMock() {
|
|
1947
1978
|
const globalFetch = global.fetch;
|
|
1948
1979
|
function myFetch(input, init) {
|
|
@@ -1968,77 +1999,77 @@ import os from "os";
|
|
|
1968
1999
|
import path3 from "path";
|
|
1969
2000
|
import { simpleGit as simpleGit2 } from "simple-git";
|
|
1970
2001
|
import tmp from "tmp";
|
|
1971
|
-
import { z as
|
|
2002
|
+
import { z as z7 } from "zod";
|
|
1972
2003
|
|
|
1973
2004
|
// src/features/analysis/scm/scmSubmit/types.ts
|
|
1974
|
-
import { z as
|
|
1975
|
-
var BaseSubmitToScmMessageZ =
|
|
1976
|
-
submitFixRequestId:
|
|
1977
|
-
fixes:
|
|
1978
|
-
|
|
1979
|
-
fixId:
|
|
1980
|
-
diff:
|
|
2005
|
+
import { z as z6 } from "zod";
|
|
2006
|
+
var BaseSubmitToScmMessageZ = z6.object({
|
|
2007
|
+
submitFixRequestId: z6.string().uuid(),
|
|
2008
|
+
fixes: z6.array(
|
|
2009
|
+
z6.object({
|
|
2010
|
+
fixId: z6.string().uuid(),
|
|
2011
|
+
diff: z6.string()
|
|
1981
2012
|
})
|
|
1982
2013
|
),
|
|
1983
|
-
commitHash:
|
|
1984
|
-
repoUrl:
|
|
2014
|
+
commitHash: z6.string(),
|
|
2015
|
+
repoUrl: z6.string()
|
|
1985
2016
|
});
|
|
1986
2017
|
var submitToScmMessageType = {
|
|
1987
2018
|
commitToSameBranch: "commitToSameBranch",
|
|
1988
2019
|
submitFixesForDifferentBranch: "submitFixesForDifferentBranch"
|
|
1989
2020
|
};
|
|
1990
2021
|
var CommitToSameBranchParamsZ = BaseSubmitToScmMessageZ.merge(
|
|
1991
|
-
|
|
1992
|
-
type:
|
|
1993
|
-
branch:
|
|
1994
|
-
commitMessage:
|
|
1995
|
-
commitDescription:
|
|
1996
|
-
githubCommentId:
|
|
2022
|
+
z6.object({
|
|
2023
|
+
type: z6.literal(submitToScmMessageType.commitToSameBranch),
|
|
2024
|
+
branch: z6.string(),
|
|
2025
|
+
commitMessage: z6.string(),
|
|
2026
|
+
commitDescription: z6.string().nullish(),
|
|
2027
|
+
githubCommentId: z6.number().nullish()
|
|
1997
2028
|
})
|
|
1998
2029
|
);
|
|
1999
|
-
var SubmitFixesToDifferentBranchParamsZ =
|
|
2000
|
-
type:
|
|
2001
|
-
submitBranch:
|
|
2002
|
-
baseBranch:
|
|
2030
|
+
var SubmitFixesToDifferentBranchParamsZ = z6.object({
|
|
2031
|
+
type: z6.literal(submitToScmMessageType.submitFixesForDifferentBranch),
|
|
2032
|
+
submitBranch: z6.string(),
|
|
2033
|
+
baseBranch: z6.string()
|
|
2003
2034
|
}).merge(BaseSubmitToScmMessageZ);
|
|
2004
|
-
var SubmitFixesMessageZ =
|
|
2035
|
+
var SubmitFixesMessageZ = z6.union([
|
|
2005
2036
|
CommitToSameBranchParamsZ,
|
|
2006
2037
|
SubmitFixesToDifferentBranchParamsZ
|
|
2007
2038
|
]);
|
|
2008
|
-
var FixResponseArrayZ =
|
|
2009
|
-
|
|
2010
|
-
fixId:
|
|
2039
|
+
var FixResponseArrayZ = z6.array(
|
|
2040
|
+
z6.object({
|
|
2041
|
+
fixId: z6.string().uuid()
|
|
2011
2042
|
})
|
|
2012
2043
|
);
|
|
2013
|
-
var SubmitFixesBaseResponseMessageZ =
|
|
2014
|
-
submitFixRequestId:
|
|
2015
|
-
submitBranches:
|
|
2016
|
-
|
|
2017
|
-
branchName:
|
|
2044
|
+
var SubmitFixesBaseResponseMessageZ = z6.object({
|
|
2045
|
+
submitFixRequestId: z6.string().uuid(),
|
|
2046
|
+
submitBranches: z6.array(
|
|
2047
|
+
z6.object({
|
|
2048
|
+
branchName: z6.string(),
|
|
2018
2049
|
fixes: FixResponseArrayZ
|
|
2019
2050
|
})
|
|
2020
2051
|
),
|
|
2021
|
-
error:
|
|
2022
|
-
type:
|
|
2052
|
+
error: z6.object({
|
|
2053
|
+
type: z6.enum([
|
|
2023
2054
|
"InitialRepoAccessError",
|
|
2024
2055
|
"PushBranchError",
|
|
2025
2056
|
"UnknownError"
|
|
2026
2057
|
]),
|
|
2027
|
-
info:
|
|
2028
|
-
message:
|
|
2029
|
-
pushBranchName:
|
|
2058
|
+
info: z6.object({
|
|
2059
|
+
message: z6.string(),
|
|
2060
|
+
pushBranchName: z6.string().optional()
|
|
2030
2061
|
})
|
|
2031
2062
|
}).optional()
|
|
2032
2063
|
});
|
|
2033
|
-
var SubmitFixesToSameBranchResponseMessageZ =
|
|
2034
|
-
type:
|
|
2035
|
-
githubCommentId:
|
|
2064
|
+
var SubmitFixesToSameBranchResponseMessageZ = z6.object({
|
|
2065
|
+
type: z6.literal(submitToScmMessageType.commitToSameBranch),
|
|
2066
|
+
githubCommentId: z6.number().nullish()
|
|
2036
2067
|
}).merge(SubmitFixesBaseResponseMessageZ);
|
|
2037
|
-
var SubmitFixesToDifferentBranchResponseMessageZ =
|
|
2038
|
-
type:
|
|
2039
|
-
githubCommentId:
|
|
2068
|
+
var SubmitFixesToDifferentBranchResponseMessageZ = z6.object({
|
|
2069
|
+
type: z6.literal(submitToScmMessageType.submitFixesForDifferentBranch),
|
|
2070
|
+
githubCommentId: z6.number().optional()
|
|
2040
2071
|
}).merge(SubmitFixesBaseResponseMessageZ);
|
|
2041
|
-
var SubmitFixesResponseMessageZ =
|
|
2072
|
+
var SubmitFixesResponseMessageZ = z6.discriminatedUnion("type", [
|
|
2042
2073
|
SubmitFixesToSameBranchResponseMessageZ,
|
|
2043
2074
|
SubmitFixesToDifferentBranchResponseMessageZ
|
|
2044
2075
|
]);
|
|
@@ -2056,7 +2087,7 @@ var isValidBranchName = async (branchName) => {
|
|
|
2056
2087
|
return false;
|
|
2057
2088
|
}
|
|
2058
2089
|
};
|
|
2059
|
-
var FixesZ =
|
|
2090
|
+
var FixesZ = z7.array(z7.object({ fixId: z7.string(), diff: z7.string() })).nonempty();
|
|
2060
2091
|
|
|
2061
2092
|
// src/features/analysis/scm/scm.ts
|
|
2062
2093
|
function getCloudScmLibTypeFromUrl(url) {
|
|
@@ -2276,6 +2307,14 @@ var SCMLib = class {
|
|
|
2276
2307
|
}
|
|
2277
2308
|
return new StubSCMLib(trimmedUrl, void 0, void 0);
|
|
2278
2309
|
}
|
|
2310
|
+
_validateAccessTokenAndUrl() {
|
|
2311
|
+
if (!this.accessToken) {
|
|
2312
|
+
throw new InvalidAccessTokenError("no access token");
|
|
2313
|
+
}
|
|
2314
|
+
if (!this.url) {
|
|
2315
|
+
throw new InvalidRepoUrlError("no url");
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2279
2318
|
};
|
|
2280
2319
|
var AdoSCMLib = class extends SCMLib {
|
|
2281
2320
|
updatePrComment(_params, _oktokit) {
|
|
@@ -2442,8 +2481,9 @@ var AdoSCMLib = class extends SCMLib {
|
|
|
2442
2481
|
accessToken: this.accessToken
|
|
2443
2482
|
});
|
|
2444
2483
|
}
|
|
2445
|
-
|
|
2446
|
-
|
|
2484
|
+
getPrUrl(prNumber) {
|
|
2485
|
+
this._validateAccessTokenAndUrl();
|
|
2486
|
+
return Promise.resolve(getAdoPrUrl({ prNumber, url: this.url }));
|
|
2447
2487
|
}
|
|
2448
2488
|
postGeneralPrComment() {
|
|
2449
2489
|
throw new Error("Method not implemented.");
|
|
@@ -2628,8 +2668,14 @@ var GitlabSCMLib = class extends SCMLib {
|
|
|
2628
2668
|
updatePrComment(_params, _oktokit) {
|
|
2629
2669
|
throw new Error("updatePrComment not implemented.");
|
|
2630
2670
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2671
|
+
async getPrUrl(prNumber) {
|
|
2672
|
+
this._validateAccessTokenAndUrl();
|
|
2673
|
+
const res = await getGitlabMergeRequest({
|
|
2674
|
+
url: this.url,
|
|
2675
|
+
prNumber,
|
|
2676
|
+
accessToken: this.accessToken
|
|
2677
|
+
});
|
|
2678
|
+
return res.web_url;
|
|
2633
2679
|
}
|
|
2634
2680
|
postGeneralPrComment() {
|
|
2635
2681
|
throw new Error("Method not implemented.");
|
|
@@ -2774,7 +2820,7 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
2774
2820
|
owner,
|
|
2775
2821
|
repo
|
|
2776
2822
|
});
|
|
2777
|
-
return
|
|
2823
|
+
return z8.string().parse(prRes.data);
|
|
2778
2824
|
}
|
|
2779
2825
|
async getRepoList(_scmOrg) {
|
|
2780
2826
|
if (!this.accessToken) {
|
|
@@ -2896,17 +2942,18 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
2896
2942
|
githubAuthToken: this.accessToken
|
|
2897
2943
|
});
|
|
2898
2944
|
}
|
|
2899
|
-
async
|
|
2945
|
+
async getPrUrl(prNumber) {
|
|
2900
2946
|
if (!this.url || !this.oktokit) {
|
|
2901
2947
|
console.error("no url");
|
|
2902
2948
|
throw new Error("no url");
|
|
2903
2949
|
}
|
|
2904
2950
|
const { owner, repo } = parseGithubOwnerAndRepo(this.url);
|
|
2905
|
-
|
|
2951
|
+
const getPrRes = await getPr(this.oktokit, {
|
|
2906
2952
|
owner,
|
|
2907
2953
|
repo,
|
|
2908
2954
|
pull_number: prNumber
|
|
2909
2955
|
});
|
|
2956
|
+
return getPrRes.data.html_url;
|
|
2910
2957
|
}
|
|
2911
2958
|
async postGeneralPrComment(params, auth) {
|
|
2912
2959
|
const { prNumber, body } = params;
|
|
@@ -3032,7 +3079,7 @@ var StubSCMLib = class extends SCMLib {
|
|
|
3032
3079
|
console.error("updatePrComment() not implemented");
|
|
3033
3080
|
throw new Error("updatePrComment() not implemented");
|
|
3034
3081
|
}
|
|
3035
|
-
async
|
|
3082
|
+
async getPrUrl(_prNumber) {
|
|
3036
3083
|
console.error("getPr() not implemented");
|
|
3037
3084
|
throw new Error("getPr() not implemented");
|
|
3038
3085
|
}
|
|
@@ -3052,22 +3099,22 @@ function removeTrailingSlash3(str) {
|
|
|
3052
3099
|
return str.trim().replace(/\/+$/, "");
|
|
3053
3100
|
}
|
|
3054
3101
|
async function _getOrgsForOauthToken({ oauthToken }) {
|
|
3055
|
-
const profileZ =
|
|
3056
|
-
displayName:
|
|
3057
|
-
publicAlias:
|
|
3058
|
-
emailAddress:
|
|
3059
|
-
coreRevision:
|
|
3060
|
-
timeStamp:
|
|
3061
|
-
id:
|
|
3062
|
-
revision:
|
|
3102
|
+
const profileZ = z9.object({
|
|
3103
|
+
displayName: z9.string(),
|
|
3104
|
+
publicAlias: z9.string().min(1),
|
|
3105
|
+
emailAddress: z9.string(),
|
|
3106
|
+
coreRevision: z9.number(),
|
|
3107
|
+
timeStamp: z9.string(),
|
|
3108
|
+
id: z9.string(),
|
|
3109
|
+
revision: z9.number()
|
|
3063
3110
|
});
|
|
3064
|
-
const accountsZ =
|
|
3065
|
-
count:
|
|
3066
|
-
value:
|
|
3067
|
-
|
|
3068
|
-
accountId:
|
|
3069
|
-
accountUri:
|
|
3070
|
-
accountName:
|
|
3111
|
+
const accountsZ = z9.object({
|
|
3112
|
+
count: z9.number(),
|
|
3113
|
+
value: z9.array(
|
|
3114
|
+
z9.object({
|
|
3115
|
+
accountId: z9.string(),
|
|
3116
|
+
accountUri: z9.string(),
|
|
3117
|
+
accountName: z9.string()
|
|
3071
3118
|
})
|
|
3072
3119
|
)
|
|
3073
3120
|
});
|
|
@@ -3298,6 +3345,12 @@ async function getAdoRepoList({
|
|
|
3298
3345
|
}, []);
|
|
3299
3346
|
return repos;
|
|
3300
3347
|
}
|
|
3348
|
+
function getAdoPrUrl({
|
|
3349
|
+
url,
|
|
3350
|
+
prNumber
|
|
3351
|
+
}) {
|
|
3352
|
+
return `${url}/pullrequest/${prNumber}`;
|
|
3353
|
+
}
|
|
3301
3354
|
function getAdoDownloadUrl({
|
|
3302
3355
|
repoUrl,
|
|
3303
3356
|
branch
|
|
@@ -3491,10 +3544,10 @@ function parseAdoOwnerAndRepo(adoUrl) {
|
|
|
3491
3544
|
async function getAdoBlameRanges() {
|
|
3492
3545
|
return [];
|
|
3493
3546
|
}
|
|
3494
|
-
var AdoAuthResultZ =
|
|
3495
|
-
access_token:
|
|
3496
|
-
token_type:
|
|
3497
|
-
refresh_token:
|
|
3547
|
+
var AdoAuthResultZ = z9.object({
|
|
3548
|
+
access_token: z9.string().min(1),
|
|
3549
|
+
token_type: z9.string().min(1),
|
|
3550
|
+
refresh_token: z9.string().min(1)
|
|
3498
3551
|
});
|
|
3499
3552
|
|
|
3500
3553
|
// src/features/analysis/scm/constants.ts
|
|
@@ -3675,7 +3728,7 @@ async function getRelevantVulenrabilitiesFromDiff(params) {
|
|
|
3675
3728
|
});
|
|
3676
3729
|
const lineAddedRanges = calculateRanges(fileNumbers);
|
|
3677
3730
|
const fileFilter = {
|
|
3678
|
-
path:
|
|
3731
|
+
path: z10.string().parse(file.to),
|
|
3679
3732
|
ranges: lineAddedRanges.map(([startLine, endLine]) => ({
|
|
3680
3733
|
endLine,
|
|
3681
3734
|
startLine
|
|
@@ -4566,8 +4619,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
4566
4619
|
analysisId,
|
|
4567
4620
|
gqlClient,
|
|
4568
4621
|
scm,
|
|
4569
|
-
githubActionToken:
|
|
4570
|
-
scanner:
|
|
4622
|
+
githubActionToken: z11.string().parse(githubActionToken),
|
|
4623
|
+
scanner: z11.nativeEnum(SCANNERS).parse(scanner)
|
|
4571
4624
|
})
|
|
4572
4625
|
);
|
|
4573
4626
|
}
|
|
@@ -4579,7 +4632,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
4579
4632
|
try {
|
|
4580
4633
|
const sumbitRes = await gqlClient.submitVulnerabilityReport({
|
|
4581
4634
|
fixReportId: reportUploadInfo.fixReportId,
|
|
4582
|
-
repoUrl:
|
|
4635
|
+
repoUrl: z11.string().parse(repo),
|
|
4583
4636
|
reference,
|
|
4584
4637
|
projectId,
|
|
4585
4638
|
vulnerabilityReportFileName: "report.json",
|
|
@@ -4795,9 +4848,9 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
4795
4848
|
await gqlClient.submitVulnerabilityReport({
|
|
4796
4849
|
fixReportId: reportUploadInfo.fixReportId,
|
|
4797
4850
|
projectId,
|
|
4798
|
-
repoUrl: repo || gitInfo.repoUrl,
|
|
4799
|
-
reference: gitInfo.reference,
|
|
4800
|
-
sha: commitHash || gitInfo.hash
|
|
4851
|
+
repoUrl: repo || gitInfo.repoUrl || getTopLevelDirName(srcPath),
|
|
4852
|
+
reference: gitInfo.reference || "no-branch",
|
|
4853
|
+
sha: commitHash || gitInfo.hash || "0123456789abcdef"
|
|
4801
4854
|
});
|
|
4802
4855
|
} catch (e) {
|
|
4803
4856
|
mobbSpinner2.error({ text: "\u{1F575}\uFE0F\u200D\u2642\uFE0F Mobb analysis failed" });
|
|
@@ -4998,7 +5051,7 @@ var scmTokenOption = {
|
|
|
4998
5051
|
// src/args/validation.ts
|
|
4999
5052
|
import chalk6 from "chalk";
|
|
5000
5053
|
import path8 from "path";
|
|
5001
|
-
import { z as
|
|
5054
|
+
import { z as z12 } from "zod";
|
|
5002
5055
|
function throwRepoUrlErrorMessage({
|
|
5003
5056
|
error,
|
|
5004
5057
|
repoUrl,
|
|
@@ -5015,7 +5068,7 @@ Example:
|
|
|
5015
5068
|
)}`;
|
|
5016
5069
|
throw new CliError(formattedErrorMessage);
|
|
5017
5070
|
}
|
|
5018
|
-
var UrlZ =
|
|
5071
|
+
var UrlZ = z12.string({
|
|
5019
5072
|
invalid_type_error: "is not a valid GitHub / GitLab / ADO URL"
|
|
5020
5073
|
}).refine((data) => !!sanityRepoURL(data), {
|
|
5021
5074
|
message: "is not a valid GitHub / GitLab / ADO URL"
|