mobbdev 0.0.188 → 0.0.190
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/README.md +1 -1
- package/dist/index.mjs +53 -48
- package/package.json +18 -18
package/README.md
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -27,10 +27,6 @@ import yargs from "yargs/yargs";
|
|
|
27
27
|
// src/args/commands/analyze.ts
|
|
28
28
|
import fs5 from "node:fs";
|
|
29
29
|
|
|
30
|
-
// src/commands/index.ts
|
|
31
|
-
import fs4 from "node:fs";
|
|
32
|
-
import path7 from "node:path";
|
|
33
|
-
|
|
34
30
|
// src/constants.ts
|
|
35
31
|
import path from "node:path";
|
|
36
32
|
import { fileURLToPath } from "node:url";
|
|
@@ -1234,7 +1230,7 @@ var GetProjectMembersDataZ = z3.object({
|
|
|
1234
1230
|
)
|
|
1235
1231
|
})
|
|
1236
1232
|
});
|
|
1237
|
-
var
|
|
1233
|
+
var RepoArgsZ = z3.object({
|
|
1238
1234
|
originalUrl: z3.string().url(),
|
|
1239
1235
|
branch: z3.string(),
|
|
1240
1236
|
commitSha: z3.string()
|
|
@@ -1342,9 +1338,9 @@ var VUL_REPORT_DIGEST_TIMEOUT_MS = 1e3 * 60 * 30;
|
|
|
1342
1338
|
|
|
1343
1339
|
// src/features/analysis/index.ts
|
|
1344
1340
|
import crypto from "node:crypto";
|
|
1345
|
-
import
|
|
1341
|
+
import fs4 from "node:fs";
|
|
1346
1342
|
import os from "node:os";
|
|
1347
|
-
import
|
|
1343
|
+
import path7 from "node:path";
|
|
1348
1344
|
import { pipeline } from "node:stream/promises";
|
|
1349
1345
|
|
|
1350
1346
|
// src/utils/index.ts
|
|
@@ -1355,6 +1351,7 @@ __export(utils_exports, {
|
|
|
1355
1351
|
getDirName: () => getDirName,
|
|
1356
1352
|
getTopLevelDirName: () => getTopLevelDirName,
|
|
1357
1353
|
keypress: () => keypress,
|
|
1354
|
+
packageJson: () => packageJson,
|
|
1358
1355
|
sleep: () => sleep
|
|
1359
1356
|
});
|
|
1360
1357
|
|
|
@@ -1406,6 +1403,21 @@ function Spinner({ ci = false } = {}) {
|
|
|
1406
1403
|
};
|
|
1407
1404
|
}
|
|
1408
1405
|
|
|
1406
|
+
// src/utils/check_node_version.ts
|
|
1407
|
+
import fs from "node:fs";
|
|
1408
|
+
import path3 from "node:path";
|
|
1409
|
+
import semver from "semver";
|
|
1410
|
+
var packageJson = JSON.parse(
|
|
1411
|
+
fs.readFileSync(path3.join(getDirName(), "../package.json"), "utf8")
|
|
1412
|
+
);
|
|
1413
|
+
if (!semver.satisfies(process.version, packageJson.engines.node)) {
|
|
1414
|
+
console.error(
|
|
1415
|
+
`
|
|
1416
|
+
\u26A0\uFE0F ${packageJson.name} requires node version ${packageJson.engines.node}, but running ${process.version}.`
|
|
1417
|
+
);
|
|
1418
|
+
process.exit(1);
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1409
1421
|
// src/utils/index.ts
|
|
1410
1422
|
var sleep = (ms = 2e3) => new Promise((r) => setTimeout(r, ms));
|
|
1411
1423
|
var CliError = class extends Error {
|
|
@@ -1418,7 +1430,6 @@ import Debug16 from "debug";
|
|
|
1418
1430
|
import extract from "extract-zip";
|
|
1419
1431
|
import fetch4 from "node-fetch";
|
|
1420
1432
|
import open2 from "open";
|
|
1421
|
-
import semver from "semver";
|
|
1422
1433
|
import tmp2 from "tmp";
|
|
1423
1434
|
import { z as z22 } from "zod";
|
|
1424
1435
|
|
|
@@ -1707,25 +1718,25 @@ var getCommitDescription = ({
|
|
|
1707
1718
|
guidances,
|
|
1708
1719
|
fixUrl
|
|
1709
1720
|
}) => {
|
|
1710
|
-
const parseIssueTypeRes = z6.nativeEnum(IssueType_Enum).safeParse(issueType);
|
|
1711
|
-
if (!parseIssueTypeRes.success) {
|
|
1712
|
-
return "";
|
|
1713
|
-
}
|
|
1714
|
-
const staticData = fixDetailsData[parseIssueTypeRes.data];
|
|
1715
|
-
if (!staticData) {
|
|
1716
|
-
return "";
|
|
1717
|
-
}
|
|
1718
1721
|
const issueTypeString = getIssueTypeFriendlyString(issueType);
|
|
1719
1722
|
let description = `This change fixes a **${severity} severity** (${severityToEmoji[severity]}) **${issueTypeString}** issue reported by **${capitalizeFirstLetter(
|
|
1720
1723
|
vendor
|
|
1721
1724
|
)}**.
|
|
1722
1725
|
|
|
1723
|
-
|
|
1726
|
+
`;
|
|
1727
|
+
const parseIssueTypeRes = z6.nativeEnum(IssueType_Enum).safeParse(issueType);
|
|
1728
|
+
if (issueType && parseIssueTypeRes.success) {
|
|
1729
|
+
const staticData = fixDetailsData[parseIssueTypeRes.data];
|
|
1730
|
+
if (staticData) {
|
|
1731
|
+
description += `## Issue description
|
|
1724
1732
|
${staticData.issueDescription}
|
|
1725
1733
|
|
|
1726
1734
|
## Fix instructions
|
|
1727
1735
|
${staticData.fixInstructions}
|
|
1728
|
-
|
|
1736
|
+
`;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
description += `
|
|
1729
1740
|
${guidances.map(({ guidance }) => `## Additional actions required
|
|
1730
1741
|
${guidance}
|
|
1731
1742
|
`).join("")}
|
|
@@ -1983,6 +1994,11 @@ var insecureRandomness = {
|
|
|
1983
1994
|
content: () => "We use the `RandomNumberGenerator` class from the `System.Security.Cryptography` package. Does this class exist for the .NET version you use?",
|
|
1984
1995
|
description: () => "See [the official documentation](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.randomnumbergenerator?view=net-8.0#applies-to) for more details.",
|
|
1985
1996
|
guidance: () => ""
|
|
1997
|
+
},
|
|
1998
|
+
net_version_gt_6: {
|
|
1999
|
+
content: () => "We are able to offer a more concise solution if the .NET version is greater then .NET 6",
|
|
2000
|
+
description: () => "",
|
|
2001
|
+
guidance: () => ""
|
|
1986
2002
|
}
|
|
1987
2003
|
};
|
|
1988
2004
|
|
|
@@ -4528,9 +4544,9 @@ async function brokerRequestHandler(endpoint, options) {
|
|
|
4528
4544
|
}
|
|
4529
4545
|
|
|
4530
4546
|
// src/features/analysis/scm/scmSubmit/index.ts
|
|
4531
|
-
import
|
|
4547
|
+
import fs2 from "node:fs/promises";
|
|
4532
4548
|
import parseDiff from "parse-diff";
|
|
4533
|
-
import
|
|
4549
|
+
import path4 from "path";
|
|
4534
4550
|
import { simpleGit } from "simple-git";
|
|
4535
4551
|
import tmp from "tmp";
|
|
4536
4552
|
import { z as z15 } from "zod";
|
|
@@ -7260,8 +7276,8 @@ var GQLClient = class {
|
|
|
7260
7276
|
};
|
|
7261
7277
|
|
|
7262
7278
|
// src/features/analysis/pack.ts
|
|
7263
|
-
import
|
|
7264
|
-
import
|
|
7279
|
+
import fs3 from "node:fs";
|
|
7280
|
+
import path5 from "node:path";
|
|
7265
7281
|
import AdmZip from "adm-zip";
|
|
7266
7282
|
import Debug11 from "debug";
|
|
7267
7283
|
import { globby } from "globby";
|
|
@@ -7313,20 +7329,20 @@ async function pack(srcDirPath, vulnFiles) {
|
|
|
7313
7329
|
const zip = new AdmZip();
|
|
7314
7330
|
debug11("compressing files");
|
|
7315
7331
|
for (const filepath of filepaths) {
|
|
7316
|
-
const absFilepath =
|
|
7332
|
+
const absFilepath = path5.join(srcDirPath, filepath.toString());
|
|
7317
7333
|
vulnFiles = vulnFiles.concat(_get_manifest_files_suffixes());
|
|
7318
7334
|
if (!endsWithAny(
|
|
7319
|
-
absFilepath.toString().replaceAll(
|
|
7335
|
+
absFilepath.toString().replaceAll(path5.win32.sep, path5.posix.sep),
|
|
7320
7336
|
vulnFiles
|
|
7321
7337
|
)) {
|
|
7322
7338
|
debug11("ignoring %s because it is not a vulnerability file", filepath);
|
|
7323
7339
|
continue;
|
|
7324
7340
|
}
|
|
7325
|
-
if (
|
|
7341
|
+
if (fs3.lstatSync(absFilepath).size > MAX_FILE_SIZE) {
|
|
7326
7342
|
debug11("ignoring %s because the size is > 5MB", filepath);
|
|
7327
7343
|
continue;
|
|
7328
7344
|
}
|
|
7329
|
-
const data = git ? await git.showBuffer([`HEAD:./${filepath}`]) :
|
|
7345
|
+
const data = git ? await git.showBuffer([`HEAD:./${filepath}`]) : fs3.readFileSync(absFilepath);
|
|
7330
7346
|
if (isBinary(null, data)) {
|
|
7331
7347
|
debug11("ignoring %s because is seems to be a binary file", filepath);
|
|
7332
7348
|
continue;
|
|
@@ -7463,7 +7479,7 @@ import Debug13 from "debug";
|
|
|
7463
7479
|
import { existsSync } from "fs";
|
|
7464
7480
|
import { createSpinner as createSpinner2 } from "nanospinner";
|
|
7465
7481
|
import { type } from "os";
|
|
7466
|
-
import
|
|
7482
|
+
import path6 from "path";
|
|
7467
7483
|
var debug12 = Debug13("mobbdev:checkmarx");
|
|
7468
7484
|
var require2 = createRequire(import.meta.url);
|
|
7469
7485
|
var getCheckmarxPath = () => {
|
|
@@ -7523,9 +7539,9 @@ async function getCheckmarxReport({ reportPath, repositoryRoot, branch, projectN
|
|
|
7523
7539
|
await startCheckmarxConfigationPrompt();
|
|
7524
7540
|
await validateCheckamxCredentials();
|
|
7525
7541
|
}
|
|
7526
|
-
const extension =
|
|
7527
|
-
const filePath =
|
|
7528
|
-
const fileName =
|
|
7542
|
+
const extension = path6.extname(reportPath);
|
|
7543
|
+
const filePath = path6.dirname(reportPath);
|
|
7544
|
+
const fileName = path6.basename(reportPath, extension);
|
|
7529
7545
|
const checkmarxCommandArgs = getCheckmarxCommandArgs({
|
|
7530
7546
|
repoPath: repositoryRoot,
|
|
7531
7547
|
branch,
|
|
@@ -7692,7 +7708,7 @@ async function downloadRepo({
|
|
|
7692
7708
|
const { createSpinner: createSpinner4 } = Spinner2({ ci });
|
|
7693
7709
|
const repoSpinner = createSpinner4("\u{1F4BE} Downloading Repo").start();
|
|
7694
7710
|
debug15("download repo %s %s %s", repoUrl, dirname);
|
|
7695
|
-
const zipFilePath =
|
|
7711
|
+
const zipFilePath = path7.join(dirname, "repo.zip");
|
|
7696
7712
|
debug15("download URL: %s auth headers: %o", downloadUrl, authHeaders);
|
|
7697
7713
|
const response = await fetch4(downloadUrl, {
|
|
7698
7714
|
method: "GET",
|
|
@@ -7705,19 +7721,19 @@ async function downloadRepo({
|
|
|
7705
7721
|
repoSpinner.error({ text: "\u{1F4BE} Repo download failed" });
|
|
7706
7722
|
throw new Error(`Can't access ${chalk4.bold(repoUrl)}`);
|
|
7707
7723
|
}
|
|
7708
|
-
const fileWriterStream =
|
|
7724
|
+
const fileWriterStream = fs4.createWriteStream(zipFilePath);
|
|
7709
7725
|
if (!response.body) {
|
|
7710
7726
|
throw new Error("Response body is empty");
|
|
7711
7727
|
}
|
|
7712
7728
|
await pipeline(response.body, fileWriterStream);
|
|
7713
7729
|
await extract(zipFilePath, { dir: dirname });
|
|
7714
|
-
const repoRoot =
|
|
7730
|
+
const repoRoot = fs4.readdirSync(dirname, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name)[0];
|
|
7715
7731
|
if (!repoRoot) {
|
|
7716
7732
|
throw new Error("Repo root not found");
|
|
7717
7733
|
}
|
|
7718
7734
|
debug15("repo root %s", repoRoot);
|
|
7719
7735
|
repoSpinner.success({ text: "\u{1F4BE} Repo downloaded successfully" });
|
|
7720
|
-
return
|
|
7736
|
+
return path7.join(dirname, repoRoot);
|
|
7721
7737
|
}
|
|
7722
7738
|
var LOGIN_MAX_WAIT = 10 * 60 * 1e3;
|
|
7723
7739
|
var LOGIN_CHECK_DELAY = 5 * 1e3;
|
|
@@ -7730,14 +7746,6 @@ var getReportUrl = ({
|
|
|
7730
7746
|
fixReportId
|
|
7731
7747
|
}) => `${WEB_APP_URL}/organization/${organizationId}/project/${projectId}/report/${fixReportId}`;
|
|
7732
7748
|
var debug15 = Debug16("mobbdev:index");
|
|
7733
|
-
var packageJson = JSON.parse(
|
|
7734
|
-
fs3.readFileSync(path6.join(getDirName(), "../package.json"), "utf8")
|
|
7735
|
-
);
|
|
7736
|
-
if (!semver.satisfies(process.version, packageJson.engines.node)) {
|
|
7737
|
-
throw new CliError2(
|
|
7738
|
-
`${packageJson.name} requires node version ${packageJson.engines.node}, but running ${process.version}.`
|
|
7739
|
-
);
|
|
7740
|
-
}
|
|
7741
7749
|
var config2 = new Configstore(packageJson.name, { apiToken: "" });
|
|
7742
7750
|
debug15("config %o", config2);
|
|
7743
7751
|
async function runAnalysis(params, options) {
|
|
@@ -7840,7 +7848,7 @@ async function getReport(params, { skipPrompts }) {
|
|
|
7840
7848
|
authHeaders: scm.getAuthHeaders(),
|
|
7841
7849
|
downloadUrl
|
|
7842
7850
|
});
|
|
7843
|
-
const reportPath =
|
|
7851
|
+
const reportPath = path7.join(dirname, "report.json");
|
|
7844
7852
|
switch (scanner) {
|
|
7845
7853
|
case "snyk":
|
|
7846
7854
|
await getSnykReport(reportPath, repositoryRoot, { skipPrompts });
|
|
@@ -8340,10 +8348,7 @@ async function analyze({
|
|
|
8340
8348
|
{ skipPrompts }
|
|
8341
8349
|
);
|
|
8342
8350
|
}
|
|
8343
|
-
var
|
|
8344
|
-
fs4.readFileSync(path7.join(getDirName(), "../package.json"), "utf8")
|
|
8345
|
-
);
|
|
8346
|
-
var config3 = new Configstore2(packageJson2.name, { apiToken: "" });
|
|
8351
|
+
var config3 = new Configstore2(packageJson.name, { apiToken: "" });
|
|
8347
8352
|
async function addScmToken(addScmTokenOptions) {
|
|
8348
8353
|
const { apiKey, token, organization, scmType, url, refreshToken } = addScmTokenOptions;
|
|
8349
8354
|
const gqlClient = new GQLClient({
|
|
@@ -8741,7 +8746,7 @@ var parseArgs = async (args) => {
|
|
|
8741
8746
|
handler() {
|
|
8742
8747
|
yargsInstance.showHelp();
|
|
8743
8748
|
}
|
|
8744
|
-
}).strictOptions().help("h").alias("h", "help").epilog(chalk9.bgBlue("Made with \u2764\uFE0F
|
|
8749
|
+
}).strictOptions().help("h").alias("h", "help").epilog(chalk9.bgBlue("Made with \u2764\uFE0F by Mobb")).showHelpOnFail(true).wrap(Math.min(120, yargsInstance.terminalWidth())).parse();
|
|
8745
8750
|
};
|
|
8746
8751
|
|
|
8747
8752
|
// src/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobbdev",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.190",
|
|
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",
|
|
@@ -28,25 +28,25 @@
|
|
|
28
28
|
"author": "",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@gitbeaker/core": "41.
|
|
32
|
-
"@gitbeaker/requester-utils": "41.
|
|
33
|
-
"@gitbeaker/rest": "41.
|
|
31
|
+
"@gitbeaker/core": "41.3.0",
|
|
32
|
+
"@gitbeaker/requester-utils": "41.3.0",
|
|
33
|
+
"@gitbeaker/rest": "41.3.0",
|
|
34
34
|
"@octokit/core": "5.2.0",
|
|
35
35
|
"@octokit/graphql": "5.0.6",
|
|
36
36
|
"@octokit/plugin-rest-endpoint-methods": "7.2.3",
|
|
37
37
|
"@octokit/request-error": "3.0.3",
|
|
38
38
|
"@types/libsodium-wrappers": "0.7.13",
|
|
39
39
|
"adm-zip": "0.5.16",
|
|
40
|
-
"axios": "1.7.
|
|
40
|
+
"axios": "1.7.9",
|
|
41
41
|
"azure-devops-node-api": "12.1.0",
|
|
42
42
|
"bitbucket": "2.11.0",
|
|
43
43
|
"chalk": "5.3.0",
|
|
44
44
|
"chalk-animation": "2.0.3",
|
|
45
45
|
"configstore": "6.0.0",
|
|
46
|
-
"debug": "4.
|
|
47
|
-
"dotenv": "16.4.
|
|
46
|
+
"debug": "4.4.0",
|
|
47
|
+
"dotenv": "16.4.7",
|
|
48
48
|
"extract-zip": "2.0.1",
|
|
49
|
-
"globby": "
|
|
49
|
+
"globby": "14.0.2",
|
|
50
50
|
"graphql": "16.9.0",
|
|
51
51
|
"graphql-request": "6.1.0",
|
|
52
52
|
"graphql-tag": "2.12.6",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"parse-diff": "0.11.1",
|
|
63
63
|
"semver": "7.6.3",
|
|
64
64
|
"simple-git": "3.27.0",
|
|
65
|
-
"snyk": "1.1294.
|
|
65
|
+
"snyk": "1.1294.2",
|
|
66
66
|
"supports-color": "9.4.0",
|
|
67
67
|
"tar": "6.2.1",
|
|
68
68
|
"tmp": "0.2.3",
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@graphql-codegen/cli": "5.0.3",
|
|
77
|
-
"@graphql-codegen/typescript": "4.1.
|
|
77
|
+
"@graphql-codegen/typescript": "4.1.2",
|
|
78
78
|
"@graphql-codegen/typescript-graphql-request": "6.2.0",
|
|
79
|
-
"@graphql-codegen/typescript-operations": "4.
|
|
79
|
+
"@graphql-codegen/typescript-operations": "4.4.0",
|
|
80
80
|
"@octokit/request-error": "3.0.3",
|
|
81
|
-
"@octokit/types": "13.6.
|
|
82
|
-
"@types/adm-zip": "0.5.
|
|
81
|
+
"@octokit/types": "13.6.2",
|
|
82
|
+
"@types/adm-zip": "0.5.7",
|
|
83
83
|
"@types/chalk-animation": "1.6.3",
|
|
84
84
|
"@types/configstore": "6.0.2",
|
|
85
85
|
"@types/debug": "4.1.12",
|
|
@@ -92,19 +92,19 @@
|
|
|
92
92
|
"@types/yargs": "17.0.33",
|
|
93
93
|
"@typescript-eslint/eslint-plugin": "7.17.0",
|
|
94
94
|
"@typescript-eslint/parser": "7.17.0",
|
|
95
|
-
"@vitest/coverage-istanbul": "2.1.
|
|
96
|
-
"@vitest/ui": "
|
|
95
|
+
"@vitest/coverage-istanbul": "2.1.8",
|
|
96
|
+
"@vitest/ui": "2.1.8",
|
|
97
97
|
"eslint": "8.57.0",
|
|
98
98
|
"eslint-plugin-import": "2.31.0",
|
|
99
99
|
"eslint-plugin-prettier": "5.2.1",
|
|
100
100
|
"eslint-plugin-simple-import-sort": "10.0.0",
|
|
101
|
-
"prettier": "3.
|
|
101
|
+
"prettier": "3.4.2",
|
|
102
102
|
"tsup": "7.2.0",
|
|
103
103
|
"typescript": "4.9.5",
|
|
104
|
-
"vitest": "2.1.
|
|
104
|
+
"vitest": "2.1.8"
|
|
105
105
|
},
|
|
106
106
|
"engines": {
|
|
107
|
-
"node": ">=18.
|
|
107
|
+
"node": ">=18.20.4"
|
|
108
108
|
},
|
|
109
109
|
"files": [
|
|
110
110
|
"bin/cli.mjs",
|