mobbdev 1.0.60 → 1.0.63
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 +98 -94
- package/package.json +23 -19
package/dist/index.mjs
CHANGED
|
@@ -4,12 +4,10 @@ var __export = (target, all) => {
|
|
|
4
4
|
for (var name in all)
|
|
5
5
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
6
|
};
|
|
7
|
-
var __publicField = (obj, key, value) =>
|
|
8
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9
|
-
return value;
|
|
10
|
-
};
|
|
7
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
11
8
|
|
|
12
9
|
// src/index.ts
|
|
10
|
+
import Debug19 from "debug";
|
|
13
11
|
import { hideBin } from "yargs/helpers";
|
|
14
12
|
|
|
15
13
|
// src/types.ts
|
|
@@ -235,6 +233,7 @@ var Vulnerability_Report_Vendor_Enum = /* @__PURE__ */ ((Vulnerability_Report_Ve
|
|
|
235
233
|
Vulnerability_Report_Vendor_Enum3["Checkmarx"] = "checkmarx";
|
|
236
234
|
Vulnerability_Report_Vendor_Enum3["CheckmarxXml"] = "checkmarxXml";
|
|
237
235
|
Vulnerability_Report_Vendor_Enum3["Codeql"] = "codeql";
|
|
236
|
+
Vulnerability_Report_Vendor_Enum3["Datadog"] = "datadog";
|
|
238
237
|
Vulnerability_Report_Vendor_Enum3["Fortify"] = "fortify";
|
|
239
238
|
Vulnerability_Report_Vendor_Enum3["Opengrep"] = "opengrep";
|
|
240
239
|
Vulnerability_Report_Vendor_Enum3["Semgrep"] = "semgrep";
|
|
@@ -1593,7 +1592,8 @@ var SCANNERS = {
|
|
|
1593
1592
|
Fortify: "fortify",
|
|
1594
1593
|
Snyk: "snyk",
|
|
1595
1594
|
Sonarqube: "sonarqube",
|
|
1596
|
-
Semgrep: "semgrep"
|
|
1595
|
+
Semgrep: "semgrep",
|
|
1596
|
+
Datadog: "datadog"
|
|
1597
1597
|
};
|
|
1598
1598
|
var scannerToVulnerability_Report_Vendor_Enum = {
|
|
1599
1599
|
[SCANNERS.Checkmarx]: "checkmarx" /* Checkmarx */,
|
|
@@ -1601,14 +1601,17 @@ var scannerToVulnerability_Report_Vendor_Enum = {
|
|
|
1601
1601
|
[SCANNERS.Sonarqube]: "sonarqube" /* Sonarqube */,
|
|
1602
1602
|
[SCANNERS.Codeql]: "codeql" /* Codeql */,
|
|
1603
1603
|
[SCANNERS.Fortify]: "fortify" /* Fortify */,
|
|
1604
|
-
[SCANNERS.Semgrep]: "semgrep" /* Semgrep
|
|
1604
|
+
[SCANNERS.Semgrep]: "semgrep" /* Semgrep */,
|
|
1605
|
+
[SCANNERS.Datadog]: "datadog" /* Datadog */
|
|
1605
1606
|
};
|
|
1606
1607
|
var SupportedScannersZ = z8.enum([SCANNERS.Checkmarx, SCANNERS.Snyk]);
|
|
1607
1608
|
var envVariablesSchema = z8.object({
|
|
1608
1609
|
WEB_APP_URL: z8.string(),
|
|
1609
1610
|
API_URL: z8.string(),
|
|
1610
1611
|
HASURA_ACCESS_KEY: z8.string(),
|
|
1611
|
-
LOCAL_GRAPHQL_ENDPOINT: z8.string()
|
|
1612
|
+
LOCAL_GRAPHQL_ENDPOINT: z8.string(),
|
|
1613
|
+
HTTP_PROXY: z8.string().optional().default(""),
|
|
1614
|
+
HTTPS_PROXY: z8.string().optional().default("")
|
|
1612
1615
|
}).required();
|
|
1613
1616
|
var envVariables = envVariablesSchema.parse(process.env);
|
|
1614
1617
|
debug("config %o", envVariables);
|
|
@@ -1645,6 +1648,8 @@ var WEB_APP_URL = envVariables.WEB_APP_URL;
|
|
|
1645
1648
|
var API_URL = envVariables.API_URL;
|
|
1646
1649
|
var HASURA_ACCESS_KEY = envVariables.HASURA_ACCESS_KEY;
|
|
1647
1650
|
var LOCAL_GRAPHQL_ENDPOINT = envVariables.LOCAL_GRAPHQL_ENDPOINT;
|
|
1651
|
+
var HTTPS_PROXY = envVariables.HTTPS_PROXY;
|
|
1652
|
+
var HTTP_PROXY = envVariables.HTTP_PROXY;
|
|
1648
1653
|
var errorMessages = {
|
|
1649
1654
|
missingCxProjectName: `project name ${chalk.bold(
|
|
1650
1655
|
"(--cx-project-name)"
|
|
@@ -1717,8 +1722,7 @@ import {
|
|
|
1717
1722
|
createSpinner as _createSpinner
|
|
1718
1723
|
} from "nanospinner";
|
|
1719
1724
|
function printToStdError(opts) {
|
|
1720
|
-
if (opts?.text)
|
|
1721
|
-
console.error(opts.text);
|
|
1725
|
+
if (opts?.text) console.error(opts.text);
|
|
1722
1726
|
}
|
|
1723
1727
|
var mockSpinner = {
|
|
1724
1728
|
success: (opts) => {
|
|
@@ -2090,8 +2094,7 @@ function capitalizeFirstLetter(str) {
|
|
|
2090
2094
|
return str?.length ? str[0].toUpperCase() + str.slice(1) : "";
|
|
2091
2095
|
}
|
|
2092
2096
|
function lowercaseFirstLetter(str) {
|
|
2093
|
-
if (!str)
|
|
2094
|
-
return str;
|
|
2097
|
+
if (!str) return str;
|
|
2095
2098
|
return `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
|
|
2096
2099
|
}
|
|
2097
2100
|
var severityToEmoji = {
|
|
@@ -3839,11 +3842,9 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
3839
3842
|
hostname,
|
|
3840
3843
|
scmType
|
|
3841
3844
|
});
|
|
3842
|
-
if (!repo)
|
|
3843
|
-
return null;
|
|
3845
|
+
if (!repo) return null;
|
|
3844
3846
|
const { organization, repoName } = repo;
|
|
3845
|
-
if (!organization || !repoName)
|
|
3846
|
-
return null;
|
|
3847
|
+
if (!organization || !repoName) return null;
|
|
3847
3848
|
if (!organization.match(NAME_REGEX) || !repoName.match(NAME_REGEX))
|
|
3848
3849
|
return null;
|
|
3849
3850
|
const res = {
|
|
@@ -5659,6 +5660,7 @@ import {
|
|
|
5659
5660
|
createRequesterFn
|
|
5660
5661
|
} from "@gitbeaker/requester-utils";
|
|
5661
5662
|
import {
|
|
5663
|
+
AccessLevel,
|
|
5662
5664
|
Gitlab
|
|
5663
5665
|
} from "@gitbeaker/rest";
|
|
5664
5666
|
import Debug4 from "debug";
|
|
@@ -5745,21 +5747,22 @@ async function getGitlabUsername(url, accessToken) {
|
|
|
5745
5747
|
return res.username;
|
|
5746
5748
|
}
|
|
5747
5749
|
async function getGitlabIsUserCollaborator({
|
|
5748
|
-
username,
|
|
5749
5750
|
accessToken,
|
|
5750
5751
|
repoUrl
|
|
5751
5752
|
}) {
|
|
5752
5753
|
try {
|
|
5753
5754
|
const { projectPath } = parseGitlabOwnerAndRepo(repoUrl);
|
|
5754
5755
|
const api2 = getGitBeaker({ url: repoUrl, gitlabAuthToken: accessToken });
|
|
5755
|
-
const
|
|
5756
|
-
const
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5756
|
+
const proj = await api2.Projects.show(projectPath);
|
|
5757
|
+
const groupAccess = proj.permissions?.group_access?.access_level || 0;
|
|
5758
|
+
const projectAccess = proj.permissions?.project_access?.access_level || 0;
|
|
5759
|
+
const accessLevelWithWriteAccess = [
|
|
5760
|
+
AccessLevel.DEVELOPER,
|
|
5761
|
+
AccessLevel.MAINTAINER,
|
|
5762
|
+
AccessLevel.OWNER,
|
|
5763
|
+
AccessLevel.ADMIN
|
|
5764
|
+
];
|
|
5765
|
+
return accessLevelWithWriteAccess.includes(groupAccess) || accessLevelWithWriteAccess.includes(projectAccess);
|
|
5763
5766
|
} catch (e) {
|
|
5764
5767
|
return false;
|
|
5765
5768
|
}
|
|
@@ -6004,8 +6007,7 @@ async function processBody(response) {
|
|
|
6004
6007
|
async function brokerRequestHandler(endpoint, options) {
|
|
6005
6008
|
const { prefixUrl, searchParams } = options || {};
|
|
6006
6009
|
let baseUrl;
|
|
6007
|
-
if (prefixUrl)
|
|
6008
|
-
baseUrl = prefixUrl.endsWith("/") ? prefixUrl : `${prefixUrl}/`;
|
|
6010
|
+
if (prefixUrl) baseUrl = prefixUrl.endsWith("/") ? prefixUrl : `${prefixUrl}/`;
|
|
6009
6011
|
const url = new URL(endpoint, baseUrl);
|
|
6010
6012
|
url.search = searchParams || "";
|
|
6011
6013
|
const dispatcher = url && isBrokerUrl(url.href) ? new ProxyAgent({
|
|
@@ -6117,16 +6119,7 @@ var GitlabSCMLib = class extends SCMLib {
|
|
|
6117
6119
|
}
|
|
6118
6120
|
async getUserHasAccessToRepo() {
|
|
6119
6121
|
this._validateAccessTokenAndUrl();
|
|
6120
|
-
let username = void 0;
|
|
6121
|
-
try {
|
|
6122
|
-
username = await this.getUsername();
|
|
6123
|
-
} catch (e) {
|
|
6124
|
-
console.warn(
|
|
6125
|
-
"could not get username. this is okay if a project token is used"
|
|
6126
|
-
);
|
|
6127
|
-
}
|
|
6128
6122
|
return getGitlabIsUserCollaborator({
|
|
6129
|
-
username,
|
|
6130
6123
|
accessToken: this.accessToken,
|
|
6131
6124
|
repoUrl: this.url
|
|
6132
6125
|
});
|
|
@@ -7133,7 +7126,8 @@ var scannerToFriendlyString = {
|
|
|
7133
7126
|
fortify: "Fortify",
|
|
7134
7127
|
snyk: "Snyk",
|
|
7135
7128
|
sonarqube: "Sonarqube",
|
|
7136
|
-
semgrep: "Semgrep"
|
|
7129
|
+
semgrep: "Semgrep",
|
|
7130
|
+
datadog: "Datadog"
|
|
7137
7131
|
};
|
|
7138
7132
|
|
|
7139
7133
|
// src/features/analysis/add_fix_comments_for_pr/utils/buildCommentBody.ts
|
|
@@ -7415,32 +7409,6 @@ Refresh the page in order to see the changes.`,
|
|
|
7415
7409
|
comment_id: commentId
|
|
7416
7410
|
});
|
|
7417
7411
|
}
|
|
7418
|
-
function buildAnalysisSummaryComment(params) {
|
|
7419
|
-
const { prVulenrabilities: fixesFromDiff, fixesById } = params;
|
|
7420
|
-
const { vulnerabilityReportIssueCodeNodes, fixablePrVuls } = fixesFromDiff;
|
|
7421
|
-
const title = `# ${MobbIconMarkdown} ${fixablePrVuls} ${fixablePrVuls === 1 ? "fix is" : "fixes are"} ready to be committed`;
|
|
7422
|
-
const summary = Object.entries(
|
|
7423
|
-
// count every issue type
|
|
7424
|
-
vulnerabilityReportIssueCodeNodes.reduce(
|
|
7425
|
-
(result, vulnerabilityReportIssueCodeNode) => {
|
|
7426
|
-
const { vulnerabilityReportIssue } = vulnerabilityReportIssueCodeNode;
|
|
7427
|
-
const fix = fixesById[vulnerabilityReportIssue.fixId];
|
|
7428
|
-
if (!fix) {
|
|
7429
|
-
throw new Error(`fix ${vulnerabilityReportIssue.fixId} not found`);
|
|
7430
|
-
}
|
|
7431
|
-
const issueType = getIssueTypeFriendlyString(fix.safeIssueType);
|
|
7432
|
-
const vulnerabilityReportIssueCount = (result[issueType] || 0) + 1;
|
|
7433
|
-
return {
|
|
7434
|
-
...result,
|
|
7435
|
-
[issueType]: vulnerabilityReportIssueCount
|
|
7436
|
-
};
|
|
7437
|
-
},
|
|
7438
|
-
{}
|
|
7439
|
-
)
|
|
7440
|
-
).map(([issueType, issueTypeCount]) => `**${issueType}** - ${issueTypeCount}`);
|
|
7441
|
-
return `${title}
|
|
7442
|
-
${summary.join("\n")}`;
|
|
7443
|
-
}
|
|
7444
7412
|
async function getRelevantVulenrabilitiesFromDiff(params) {
|
|
7445
7413
|
const { gqlClient, diff, vulnerabilityReportId } = params;
|
|
7446
7414
|
const parsedDiff = parseDiff(diff);
|
|
@@ -7469,20 +7437,6 @@ async function getFixesData(params) {
|
|
|
7469
7437
|
const { fixes } = await gqlClient.getFixes(fixesId);
|
|
7470
7438
|
return keyBy(fixes, "id");
|
|
7471
7439
|
}
|
|
7472
|
-
async function postAnalysisSummary(params) {
|
|
7473
|
-
const { prVulenrabilities, fixesById, pullRequest, scm } = params;
|
|
7474
|
-
if (Object.values(fixesById).length === 0) {
|
|
7475
|
-
return;
|
|
7476
|
-
}
|
|
7477
|
-
const analysisSummaryComment = buildAnalysisSummaryComment({
|
|
7478
|
-
fixesById,
|
|
7479
|
-
prVulenrabilities
|
|
7480
|
-
});
|
|
7481
|
-
await scm.postGeneralPrComment({
|
|
7482
|
-
body: analysisSummaryComment,
|
|
7483
|
-
prNumber: pullRequest
|
|
7484
|
-
});
|
|
7485
|
-
}
|
|
7486
7440
|
async function postAnalysisInsightComment(params) {
|
|
7487
7441
|
const { prVulenrabilities, pullRequest, scanner, scm } = params;
|
|
7488
7442
|
const scanerString = scannerToFriendlyString[scanner];
|
|
@@ -7640,12 +7594,6 @@ async function addFixCommentsForPr({
|
|
|
7640
7594
|
pullRequest,
|
|
7641
7595
|
scanner,
|
|
7642
7596
|
scm
|
|
7643
|
-
}),
|
|
7644
|
-
postAnalysisSummary({
|
|
7645
|
-
fixesById,
|
|
7646
|
-
prVulenrabilities,
|
|
7647
|
-
pullRequest,
|
|
7648
|
-
scm
|
|
7649
7597
|
})
|
|
7650
7598
|
]);
|
|
7651
7599
|
}
|
|
@@ -7745,21 +7693,32 @@ async function getGitInfo(srcDirPath) {
|
|
|
7745
7693
|
}
|
|
7746
7694
|
|
|
7747
7695
|
// src/features/analysis/graphql/gql.ts
|
|
7696
|
+
import fetchOrig from "cross-fetch";
|
|
7748
7697
|
import Debug11 from "debug";
|
|
7749
7698
|
import { GraphQLClient } from "graphql-request";
|
|
7699
|
+
import { HttpProxyAgent as HttpProxyAgent2 } from "http-proxy-agent";
|
|
7700
|
+
import { HttpsProxyAgent as HttpsProxyAgent2 } from "https-proxy-agent";
|
|
7750
7701
|
import { v4 as uuidv4 } from "uuid";
|
|
7751
7702
|
|
|
7752
7703
|
// src/features/analysis/graphql/subscribe.ts
|
|
7753
7704
|
import { createClient } from "graphql-ws";
|
|
7705
|
+
import { HttpProxyAgent } from "http-proxy-agent";
|
|
7706
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
7754
7707
|
import WebSocket from "ws";
|
|
7755
7708
|
var SUBSCRIPTION_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
7756
7709
|
function createWSClient(options) {
|
|
7710
|
+
const proxy = options.url.startsWith("https://") && process.env["HTTPS_PROXY"] ? new HttpsProxyAgent(process.env["HTTPS_PROXY"]) : options.url.startsWith("http://") && process.env["HTTP_PROXY"] ? new HttpProxyAgent(process.env["HTTP_PROXY"]) : null;
|
|
7711
|
+
const CustomWebSocket = class extends WebSocket {
|
|
7712
|
+
constructor(address, protocols) {
|
|
7713
|
+
super(address, protocols, proxy ? { agent: proxy } : void 0);
|
|
7714
|
+
}
|
|
7715
|
+
};
|
|
7757
7716
|
return createClient({
|
|
7758
7717
|
//this is needed to prevent AWS from killing the connection
|
|
7759
7718
|
//currently our load balancer has a 29s idle timeout
|
|
7760
7719
|
keepAlive: 1e4,
|
|
7761
7720
|
url: options.url,
|
|
7762
|
-
webSocketImpl: options.websocket || WebSocket,
|
|
7721
|
+
webSocketImpl: proxy ? CustomWebSocket : options.websocket || WebSocket,
|
|
7763
7722
|
connectionParams: () => {
|
|
7764
7723
|
return {
|
|
7765
7724
|
headers: options.type === "apiKey" ? {
|
|
@@ -7896,6 +7855,25 @@ var GetVulByNodesMetadataZ = z27.object({
|
|
|
7896
7855
|
var debug11 = Debug11("mobbdev:gql");
|
|
7897
7856
|
var API_KEY_HEADER_NAME = "x-mobb-key";
|
|
7898
7857
|
var REPORT_STATE_CHECK_DELAY = 5 * 1e3;
|
|
7858
|
+
var fetchWithProxy = (url, options = {}) => {
|
|
7859
|
+
try {
|
|
7860
|
+
const parsedUrl = new URL(url.toString());
|
|
7861
|
+
const isHttp = parsedUrl.protocol === "http:";
|
|
7862
|
+
const isHttps = parsedUrl.protocol === "https:";
|
|
7863
|
+
const proxy = isHttps ? HTTPS_PROXY : isHttp ? HTTP_PROXY : null;
|
|
7864
|
+
if (proxy) {
|
|
7865
|
+
const agent = isHttps ? new HttpsProxyAgent2(proxy) : new HttpProxyAgent2(proxy);
|
|
7866
|
+
return fetchOrig(url, {
|
|
7867
|
+
...options,
|
|
7868
|
+
// @ts-expect-error Node-fetch doesn't type 'agent', but it's valid
|
|
7869
|
+
agent
|
|
7870
|
+
});
|
|
7871
|
+
}
|
|
7872
|
+
} catch (err) {
|
|
7873
|
+
debug11(`Skipping proxy for ${url}. Reason: ${err.message}`);
|
|
7874
|
+
}
|
|
7875
|
+
return fetchOrig(url, options);
|
|
7876
|
+
};
|
|
7899
7877
|
var GQLClient = class {
|
|
7900
7878
|
constructor(args) {
|
|
7901
7879
|
__publicField(this, "_client");
|
|
@@ -7907,6 +7885,7 @@ var GQLClient = class {
|
|
|
7907
7885
|
headers: args.type === "apiKey" ? { [API_KEY_HEADER_NAME]: args.apiKey || "" } : {
|
|
7908
7886
|
Authorization: `Bearer ${args.token}`
|
|
7909
7887
|
},
|
|
7888
|
+
fetch: fetchWithProxy,
|
|
7910
7889
|
requestMiddleware: (request) => {
|
|
7911
7890
|
const requestId = uuidv4();
|
|
7912
7891
|
debug11(
|
|
@@ -7934,6 +7913,17 @@ var GQLClient = class {
|
|
|
7934
7913
|
});
|
|
7935
7914
|
return res.insert_cli_login_one?.id || "";
|
|
7936
7915
|
}
|
|
7916
|
+
async verifyConnection() {
|
|
7917
|
+
try {
|
|
7918
|
+
await this.getUserInfo();
|
|
7919
|
+
} catch (e) {
|
|
7920
|
+
if (e?.toString().startsWith("FetchError")) {
|
|
7921
|
+
debug11("verify connection failed %o", e);
|
|
7922
|
+
return false;
|
|
7923
|
+
}
|
|
7924
|
+
}
|
|
7925
|
+
return true;
|
|
7926
|
+
}
|
|
7937
7927
|
async verifyToken() {
|
|
7938
7928
|
await this.createCommunityUser();
|
|
7939
7929
|
let info;
|
|
@@ -8089,7 +8079,7 @@ var GQLClient = class {
|
|
|
8089
8079
|
projectId,
|
|
8090
8080
|
pullRequest,
|
|
8091
8081
|
sha: sha || "",
|
|
8092
|
-
experimentalEnabled,
|
|
8082
|
+
experimentalEnabled: !!experimentalEnabled,
|
|
8093
8083
|
scanSource: params.scanSource
|
|
8094
8084
|
});
|
|
8095
8085
|
}
|
|
@@ -8381,16 +8371,16 @@ function createSpwan({ args, processPath, name }, options) {
|
|
|
8381
8371
|
return createChildProcess({ childProcess: child, name }, options);
|
|
8382
8372
|
}
|
|
8383
8373
|
function createChildProcess({ childProcess, name }, options) {
|
|
8384
|
-
const
|
|
8374
|
+
const debug19 = Debug13(`mobbdev:${name}`);
|
|
8385
8375
|
const { display } = options;
|
|
8386
8376
|
return new Promise((resolve, reject) => {
|
|
8387
8377
|
let out = "";
|
|
8388
8378
|
const onData = (chunk) => {
|
|
8389
|
-
|
|
8379
|
+
debug19(`chunk received from ${name} std ${chunk}`);
|
|
8390
8380
|
out += chunk;
|
|
8391
8381
|
};
|
|
8392
8382
|
if (!childProcess || !childProcess?.stdout || !childProcess?.stderr) {
|
|
8393
|
-
|
|
8383
|
+
debug19(`unable to fork ${name}`);
|
|
8394
8384
|
reject(new Error(`unable to fork ${name}`));
|
|
8395
8385
|
}
|
|
8396
8386
|
childProcess.stdout?.on("data", onData);
|
|
@@ -8400,11 +8390,11 @@ function createChildProcess({ childProcess, name }, options) {
|
|
|
8400
8390
|
childProcess.stderr?.pipe(process2.stderr);
|
|
8401
8391
|
}
|
|
8402
8392
|
childProcess.on("exit", (code) => {
|
|
8403
|
-
|
|
8393
|
+
debug19(`${name} exit code ${code}`);
|
|
8404
8394
|
resolve({ message: out, code });
|
|
8405
8395
|
});
|
|
8406
8396
|
childProcess.on("error", (err) => {
|
|
8407
|
-
|
|
8397
|
+
debug19(`${name} error %o`, err);
|
|
8408
8398
|
reject(err);
|
|
8409
8399
|
});
|
|
8410
8400
|
});
|
|
@@ -8630,8 +8620,7 @@ async function uploadFile({
|
|
|
8630
8620
|
// src/features/analysis/index.ts
|
|
8631
8621
|
var { CliError: CliError2, Spinner: Spinner2 } = utils_exports;
|
|
8632
8622
|
function _getScanSource(command, ci) {
|
|
8633
|
-
if (command === "review")
|
|
8634
|
-
return "AUTO_FIXER" /* AutoFixer */;
|
|
8623
|
+
if (command === "review") return "AUTO_FIXER" /* AutoFixer */;
|
|
8635
8624
|
const envToCi = [
|
|
8636
8625
|
["GITLAB_CI", "CI_GITLAB" /* CiGitlab */],
|
|
8637
8626
|
["GITHUB_ACTIONS", "CI_GITHUB" /* CiGithub */],
|
|
@@ -8960,7 +8949,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
8960
8949
|
projectId,
|
|
8961
8950
|
vulnerabilityReportFileName: "report.json",
|
|
8962
8951
|
sha,
|
|
8963
|
-
experimentalEnabled,
|
|
8952
|
+
experimentalEnabled: !!experimentalEnabled,
|
|
8964
8953
|
pullRequest: params.pullRequest,
|
|
8965
8954
|
scanSource: _getScanSource(command, ci)
|
|
8966
8955
|
}
|
|
@@ -9115,7 +9104,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
9115
9104
|
reference: ref || gitInfo.reference || "no-branch",
|
|
9116
9105
|
sha: commitHash || gitInfo.hash || "0123456789abcdef",
|
|
9117
9106
|
scanSource: _getScanSource(command, ci),
|
|
9118
|
-
pullRequest: params.pullRequest
|
|
9107
|
+
pullRequest: params.pullRequest,
|
|
9108
|
+
experimentalEnabled: !!experimentalEnabled
|
|
9119
9109
|
}
|
|
9120
9110
|
});
|
|
9121
9111
|
if (command === "review") {
|
|
@@ -9377,6 +9367,18 @@ async function handleMobbLogin({
|
|
|
9377
9367
|
skipPrompts
|
|
9378
9368
|
}) {
|
|
9379
9369
|
const { createSpinner: createSpinner5 } = Spinner({ ci: skipPrompts });
|
|
9370
|
+
const isConnected = await inGqlClient.verifyConnection();
|
|
9371
|
+
if (!isConnected) {
|
|
9372
|
+
createSpinner5().start().error({
|
|
9373
|
+
text: "\u{1F513} Connection to Mobb: failed to connect to the Mobb server"
|
|
9374
|
+
});
|
|
9375
|
+
throw new CliError(
|
|
9376
|
+
"Connection to Mobb: failed to connect to the Mobb server"
|
|
9377
|
+
);
|
|
9378
|
+
}
|
|
9379
|
+
createSpinner5().start().success({
|
|
9380
|
+
text: `\u{1F513} Connection to Mobb: succeeded`
|
|
9381
|
+
});
|
|
9380
9382
|
const userVerify = await inGqlClient.verifyToken();
|
|
9381
9383
|
if (userVerify) {
|
|
9382
9384
|
createSpinner5().start().success({
|
|
@@ -9608,7 +9610,7 @@ function analyzeBuilder(yargs2) {
|
|
|
9608
9610
|
demandOption: true,
|
|
9609
9611
|
type: "string",
|
|
9610
9612
|
describe: chalk8.bold(
|
|
9611
|
-
"Select the vulnerability report to analyze (Checkmarx, Snyk, Fortify, CodeQL, Sonarqube, Semgrep)"
|
|
9613
|
+
"Select the vulnerability report to analyze (Checkmarx, Snyk, Fortify, CodeQL, Sonarqube, Semgrep, Datadog)"
|
|
9612
9614
|
)
|
|
9613
9615
|
}).option("repo", repoOption).option("p", {
|
|
9614
9616
|
alias: "src-path",
|
|
@@ -9828,11 +9830,13 @@ var parseArgs = async (args) => {
|
|
|
9828
9830
|
};
|
|
9829
9831
|
|
|
9830
9832
|
// src/index.ts
|
|
9833
|
+
var debug18 = Debug19("mobbdev:index");
|
|
9831
9834
|
async function run() {
|
|
9832
9835
|
return parseArgs(hideBin(process.argv));
|
|
9833
9836
|
}
|
|
9834
9837
|
(async () => {
|
|
9835
9838
|
try {
|
|
9839
|
+
debug18("Bugsy CLI v%s running...", packageJson.version);
|
|
9836
9840
|
await run();
|
|
9837
9841
|
process.exit(0);
|
|
9838
9842
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobbdev",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.63",
|
|
4
4
|
"description": "Automated secure code remediation tool",
|
|
5
5
|
"repository": "git+https://github.com/mobb-dev/bugsy.git",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"test:coverage": "GIT_PROXY_HOST=http://tinyproxy:8888 TOKEN=$(../../scripts/login_auth0.sh) vitest run --coverage",
|
|
18
18
|
"test:watch": "TOKEN=$(../../scripts/login_auth0.sh) vitest",
|
|
19
19
|
"test:integration": "GIT_PROXY_HOST=http://tinyproxy:8888 TOKEN=$(../../scripts/login_auth0.sh) vitest watch integration.test",
|
|
20
|
+
"test:integration:proxy": "GIT_PROXY_HOST=http://tinyproxy:8888 HTTP_PROXY=http://localhost:8888 API_URL=http://app-api:8080/v1/graphql TOKEN=$(../../scripts/login_auth0.sh) vitest run integration.test.ts",
|
|
20
21
|
"lint": "eslint --cache --max-warnings 0 --ignore-path .eslintignore --ext .ts,.tsx,.jsx .",
|
|
21
22
|
"lint:fix": "eslint --fix --cache --max-warnings 0 --ignore-path .eslintignore --ext .js,.ts,.tsx,.jsx .",
|
|
22
23
|
"lint:fix:files": "eslint --fix --cache --max-warnings 0 --ignore-path .eslintignore --ext .js,.ts,.tsx,.jsx",
|
|
@@ -30,21 +31,22 @@
|
|
|
30
31
|
"author": "",
|
|
31
32
|
"license": "MIT",
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@gitbeaker/core": "42.
|
|
34
|
-
"@gitbeaker/requester-utils": "42.
|
|
35
|
-
"@gitbeaker/rest": "42.
|
|
34
|
+
"@gitbeaker/core": "42.2.0",
|
|
35
|
+
"@gitbeaker/requester-utils": "42.2.0",
|
|
36
|
+
"@gitbeaker/rest": "42.2.0",
|
|
36
37
|
"@octokit/core": "5.2.0",
|
|
37
38
|
"@octokit/graphql": "5.0.6",
|
|
38
39
|
"@octokit/plugin-rest-endpoint-methods": "7.2.3",
|
|
39
40
|
"@octokit/request-error": "5.1.1",
|
|
40
41
|
"@types/libsodium-wrappers": "0.7.14",
|
|
41
42
|
"adm-zip": "0.5.16",
|
|
42
|
-
"axios": "1.8.
|
|
43
|
+
"axios": "1.8.4",
|
|
43
44
|
"azure-devops-node-api": "12.1.0",
|
|
44
45
|
"bitbucket": "2.11.0",
|
|
45
46
|
"chalk": "5.4.1",
|
|
46
47
|
"chalk-animation": "2.0.3",
|
|
47
48
|
"configstore": "6.0.0",
|
|
49
|
+
"cross-fetch": "4.1.0",
|
|
48
50
|
"debug": "4.4.0",
|
|
49
51
|
"dotenv": "16.4.7",
|
|
50
52
|
"extract-zip": "2.0.1",
|
|
@@ -53,6 +55,8 @@
|
|
|
53
55
|
"graphql-request": "6.1.0",
|
|
54
56
|
"graphql-tag": "2.12.6",
|
|
55
57
|
"graphql-ws": "5.16.2",
|
|
58
|
+
"http-proxy-agent": "7.0.2",
|
|
59
|
+
"https-proxy-agent": "7.0.6",
|
|
56
60
|
"inquirer": "9.2.23",
|
|
57
61
|
"isomorphic-ws": "5.0.0",
|
|
58
62
|
"istextorbinary": "6.0.0",
|
|
@@ -64,48 +68,48 @@
|
|
|
64
68
|
"parse-diff": "0.11.1",
|
|
65
69
|
"semver": "7.7.1",
|
|
66
70
|
"simple-git": "3.27.0",
|
|
67
|
-
"snyk": "1.
|
|
71
|
+
"snyk": "1.1296.1",
|
|
68
72
|
"supports-color": "10.0.0",
|
|
69
73
|
"tar": "6.2.1",
|
|
70
74
|
"tmp": "0.2.3",
|
|
71
75
|
"undici": "6.21.1",
|
|
72
76
|
"uuid": "11.1.0",
|
|
73
|
-
"ws": "8.18.
|
|
77
|
+
"ws": "8.18.1",
|
|
74
78
|
"xml2js": "0.6.2",
|
|
75
79
|
"yargs": "17.7.2",
|
|
76
80
|
"zod": "3.24.2"
|
|
77
81
|
},
|
|
78
82
|
"devDependencies": {
|
|
79
83
|
"@graphql-codegen/cli": "5.0.5",
|
|
80
|
-
"@graphql-codegen/typescript": "4.1.
|
|
84
|
+
"@graphql-codegen/typescript": "4.1.6",
|
|
81
85
|
"@graphql-codegen/typescript-graphql-request": "6.2.0",
|
|
82
|
-
"@graphql-codegen/typescript-operations": "4.
|
|
83
|
-
"@octokit/types": "13.
|
|
86
|
+
"@graphql-codegen/typescript-operations": "4.6.0",
|
|
87
|
+
"@octokit/types": "13.10.0",
|
|
84
88
|
"@types/adm-zip": "0.5.7",
|
|
85
89
|
"@types/chalk-animation": "1.6.3",
|
|
86
90
|
"@types/configstore": "6.0.2",
|
|
87
91
|
"@types/debug": "4.1.12",
|
|
88
92
|
"@types/inquirer": "9.0.7",
|
|
89
|
-
"@types/semver": "7.
|
|
93
|
+
"@types/semver": "7.7.0",
|
|
90
94
|
"@types/tar": "6.1.13",
|
|
91
95
|
"@types/tmp": "0.2.6",
|
|
92
96
|
"@types/uuid": "10.0.0",
|
|
93
|
-
"@types/ws": "8.
|
|
97
|
+
"@types/ws": "8.18.1",
|
|
94
98
|
"@types/xml2js": "0.4.14",
|
|
95
99
|
"@types/yargs": "17.0.33",
|
|
96
100
|
"@typescript-eslint/eslint-plugin": "7.17.0",
|
|
97
101
|
"@typescript-eslint/parser": "7.17.0",
|
|
98
|
-
"@vitest/coverage-istanbul": "3.
|
|
99
|
-
"@vitest/ui": "3.
|
|
102
|
+
"@vitest/coverage-istanbul": "3.1.1",
|
|
103
|
+
"@vitest/ui": "3.1.1",
|
|
100
104
|
"eslint": "8.57.0",
|
|
101
105
|
"eslint-plugin-import": "2.31.0",
|
|
102
|
-
"eslint-plugin-prettier": "5.2.
|
|
106
|
+
"eslint-plugin-prettier": "5.2.6",
|
|
103
107
|
"eslint-plugin-simple-import-sort": "10.0.0",
|
|
104
|
-
"nock": "14.0.
|
|
105
|
-
"prettier": "3.5.
|
|
106
|
-
"tsup": "
|
|
108
|
+
"nock": "14.0.3",
|
|
109
|
+
"prettier": "3.5.3",
|
|
110
|
+
"tsup": "8.4.0",
|
|
107
111
|
"typescript": "4.9.5",
|
|
108
|
-
"vitest": "3.
|
|
112
|
+
"vitest": "3.1.1"
|
|
109
113
|
},
|
|
110
114
|
"engines": {
|
|
111
115
|
"node": ">=18.20.4"
|