mobbdev 0.0.187 → 0.0.189

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.mjs +46 -38
  3. package/package.json +18 -18
package/README.md CHANGED
@@ -55,7 +55,7 @@ Options:
55
55
  Examples:
56
56
  mobbdev scan -r https://github.com/WebGoat/WebGoat Scan an existing repository
57
57
 
58
- Made with ❤️ by Mobb
58
+ Made with ❤️ by Mobb
59
59
  ```
60
60
 
61
61
  To run a new SAST scan on a repo and get fixes, run the **Bugsy Scan** command. Example:
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";
@@ -317,6 +313,7 @@ var GetFixesDocument = `
317
313
  __typename
318
314
  ... on FixData {
319
315
  patch
316
+ patchOriginalEncodingBase64
320
317
  questions {
321
318
  defaultValue
322
319
  extraContext {
@@ -1004,6 +1001,7 @@ var FixExtraContextZ = z3.object({
1004
1001
  var PatchAndQuestionsZ = z3.object({
1005
1002
  __typename: z3.literal("FixData"),
1006
1003
  patch: z3.string(),
1004
+ patchOriginalEncodingBase64: z3.string(),
1007
1005
  questions: z3.array(
1008
1006
  z3.object({
1009
1007
  name: z3.string(),
@@ -1340,9 +1338,9 @@ var VUL_REPORT_DIGEST_TIMEOUT_MS = 1e3 * 60 * 30;
1340
1338
 
1341
1339
  // src/features/analysis/index.ts
1342
1340
  import crypto from "node:crypto";
1343
- import fs3 from "node:fs";
1341
+ import fs4 from "node:fs";
1344
1342
  import os from "node:os";
1345
- import path6 from "node:path";
1343
+ import path7 from "node:path";
1346
1344
  import { pipeline } from "node:stream/promises";
1347
1345
 
1348
1346
  // src/utils/index.ts
@@ -1353,6 +1351,7 @@ __export(utils_exports, {
1353
1351
  getDirName: () => getDirName,
1354
1352
  getTopLevelDirName: () => getTopLevelDirName,
1355
1353
  keypress: () => keypress,
1354
+ packageJson: () => packageJson,
1356
1355
  sleep: () => sleep
1357
1356
  });
1358
1357
 
@@ -1404,6 +1403,21 @@ function Spinner({ ci = false } = {}) {
1404
1403
  };
1405
1404
  }
1406
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
+
1407
1421
  // src/utils/index.ts
1408
1422
  var sleep = (ms = 2e3) => new Promise((r) => setTimeout(r, ms));
1409
1423
  var CliError = class extends Error {
@@ -1416,7 +1430,6 @@ import Debug16 from "debug";
1416
1430
  import extract from "extract-zip";
1417
1431
  import fetch4 from "node-fetch";
1418
1432
  import open2 from "open";
1419
- import semver from "semver";
1420
1433
  import tmp2 from "tmp";
1421
1434
  import { z as z22 } from "zod";
1422
1435
 
@@ -1981,6 +1994,11 @@ var insecureRandomness = {
1981
1994
  content: () => "We use the `RandomNumberGenerator` class from the `System.Security.Cryptography` package. Does this class exist for the .NET version you use?",
1982
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.",
1983
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: () => ""
1984
2002
  }
1985
2003
  };
1986
2004
 
@@ -4526,9 +4544,9 @@ async function brokerRequestHandler(endpoint, options) {
4526
4544
  }
4527
4545
 
4528
4546
  // src/features/analysis/scm/scmSubmit/index.ts
4529
- import fs from "node:fs/promises";
4547
+ import fs2 from "node:fs/promises";
4530
4548
  import parseDiff from "parse-diff";
4531
- import path3 from "path";
4549
+ import path4 from "path";
4532
4550
  import { simpleGit } from "simple-git";
4533
4551
  import tmp from "tmp";
4534
4552
  import { z as z15 } from "zod";
@@ -4540,6 +4558,7 @@ var BaseSubmitToScmMessageZ = z14.object({
4540
4558
  fixes: z14.array(
4541
4559
  z14.object({
4542
4560
  fixId: z14.string().uuid(),
4561
+ patchesOriginalEncodingBase64: z14.array(z14.string()),
4543
4562
  patches: z14.array(z14.string())
4544
4563
  })
4545
4564
  ),
@@ -4642,7 +4661,7 @@ var isValidBranchName = async (branchName) => {
4642
4661
  var FixesZ = z15.array(
4643
4662
  z15.object({
4644
4663
  fixId: z15.string(),
4645
- patches: z15.array(z15.string())
4664
+ patchesOriginalEncodingBase64: z15.array(z15.string())
4646
4665
  })
4647
4666
  ).nonempty();
4648
4667
 
@@ -7257,8 +7276,8 @@ var GQLClient = class {
7257
7276
  };
7258
7277
 
7259
7278
  // src/features/analysis/pack.ts
7260
- import fs2 from "node:fs";
7261
- import path4 from "node:path";
7279
+ import fs3 from "node:fs";
7280
+ import path5 from "node:path";
7262
7281
  import AdmZip from "adm-zip";
7263
7282
  import Debug11 from "debug";
7264
7283
  import { globby } from "globby";
@@ -7310,20 +7329,20 @@ async function pack(srcDirPath, vulnFiles) {
7310
7329
  const zip = new AdmZip();
7311
7330
  debug11("compressing files");
7312
7331
  for (const filepath of filepaths) {
7313
- const absFilepath = path4.join(srcDirPath, filepath.toString());
7332
+ const absFilepath = path5.join(srcDirPath, filepath.toString());
7314
7333
  vulnFiles = vulnFiles.concat(_get_manifest_files_suffixes());
7315
7334
  if (!endsWithAny(
7316
- absFilepath.toString().replaceAll(path4.win32.sep, path4.posix.sep),
7335
+ absFilepath.toString().replaceAll(path5.win32.sep, path5.posix.sep),
7317
7336
  vulnFiles
7318
7337
  )) {
7319
7338
  debug11("ignoring %s because it is not a vulnerability file", filepath);
7320
7339
  continue;
7321
7340
  }
7322
- if (fs2.lstatSync(absFilepath).size > MAX_FILE_SIZE) {
7341
+ if (fs3.lstatSync(absFilepath).size > MAX_FILE_SIZE) {
7323
7342
  debug11("ignoring %s because the size is > 5MB", filepath);
7324
7343
  continue;
7325
7344
  }
7326
- const data = git ? await git.showBuffer([`HEAD:./${filepath}`]) : fs2.readFileSync(absFilepath);
7345
+ const data = git ? await git.showBuffer([`HEAD:./${filepath}`]) : fs3.readFileSync(absFilepath);
7327
7346
  if (isBinary(null, data)) {
7328
7347
  debug11("ignoring %s because is seems to be a binary file", filepath);
7329
7348
  continue;
@@ -7460,7 +7479,7 @@ import Debug13 from "debug";
7460
7479
  import { existsSync } from "fs";
7461
7480
  import { createSpinner as createSpinner2 } from "nanospinner";
7462
7481
  import { type } from "os";
7463
- import path5 from "path";
7482
+ import path6 from "path";
7464
7483
  var debug12 = Debug13("mobbdev:checkmarx");
7465
7484
  var require2 = createRequire(import.meta.url);
7466
7485
  var getCheckmarxPath = () => {
@@ -7520,9 +7539,9 @@ async function getCheckmarxReport({ reportPath, repositoryRoot, branch, projectN
7520
7539
  await startCheckmarxConfigationPrompt();
7521
7540
  await validateCheckamxCredentials();
7522
7541
  }
7523
- const extension = path5.extname(reportPath);
7524
- const filePath = path5.dirname(reportPath);
7525
- const fileName = path5.basename(reportPath, extension);
7542
+ const extension = path6.extname(reportPath);
7543
+ const filePath = path6.dirname(reportPath);
7544
+ const fileName = path6.basename(reportPath, extension);
7526
7545
  const checkmarxCommandArgs = getCheckmarxCommandArgs({
7527
7546
  repoPath: repositoryRoot,
7528
7547
  branch,
@@ -7689,7 +7708,7 @@ async function downloadRepo({
7689
7708
  const { createSpinner: createSpinner4 } = Spinner2({ ci });
7690
7709
  const repoSpinner = createSpinner4("\u{1F4BE} Downloading Repo").start();
7691
7710
  debug15("download repo %s %s %s", repoUrl, dirname);
7692
- const zipFilePath = path6.join(dirname, "repo.zip");
7711
+ const zipFilePath = path7.join(dirname, "repo.zip");
7693
7712
  debug15("download URL: %s auth headers: %o", downloadUrl, authHeaders);
7694
7713
  const response = await fetch4(downloadUrl, {
7695
7714
  method: "GET",
@@ -7702,19 +7721,19 @@ async function downloadRepo({
7702
7721
  repoSpinner.error({ text: "\u{1F4BE} Repo download failed" });
7703
7722
  throw new Error(`Can't access ${chalk4.bold(repoUrl)}`);
7704
7723
  }
7705
- const fileWriterStream = fs3.createWriteStream(zipFilePath);
7724
+ const fileWriterStream = fs4.createWriteStream(zipFilePath);
7706
7725
  if (!response.body) {
7707
7726
  throw new Error("Response body is empty");
7708
7727
  }
7709
7728
  await pipeline(response.body, fileWriterStream);
7710
7729
  await extract(zipFilePath, { dir: dirname });
7711
- const repoRoot = fs3.readdirSync(dirname, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name)[0];
7730
+ const repoRoot = fs4.readdirSync(dirname, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name)[0];
7712
7731
  if (!repoRoot) {
7713
7732
  throw new Error("Repo root not found");
7714
7733
  }
7715
7734
  debug15("repo root %s", repoRoot);
7716
7735
  repoSpinner.success({ text: "\u{1F4BE} Repo downloaded successfully" });
7717
- return path6.join(dirname, repoRoot);
7736
+ return path7.join(dirname, repoRoot);
7718
7737
  }
7719
7738
  var LOGIN_MAX_WAIT = 10 * 60 * 1e3;
7720
7739
  var LOGIN_CHECK_DELAY = 5 * 1e3;
@@ -7727,14 +7746,6 @@ var getReportUrl = ({
7727
7746
  fixReportId
7728
7747
  }) => `${WEB_APP_URL}/organization/${organizationId}/project/${projectId}/report/${fixReportId}`;
7729
7748
  var debug15 = Debug16("mobbdev:index");
7730
- var packageJson = JSON.parse(
7731
- fs3.readFileSync(path6.join(getDirName(), "../package.json"), "utf8")
7732
- );
7733
- if (!semver.satisfies(process.version, packageJson.engines.node)) {
7734
- throw new CliError2(
7735
- `${packageJson.name} requires node version ${packageJson.engines.node}, but running ${process.version}.`
7736
- );
7737
- }
7738
7749
  var config2 = new Configstore(packageJson.name, { apiToken: "" });
7739
7750
  debug15("config %o", config2);
7740
7751
  async function runAnalysis(params, options) {
@@ -7837,7 +7848,7 @@ async function getReport(params, { skipPrompts }) {
7837
7848
  authHeaders: scm.getAuthHeaders(),
7838
7849
  downloadUrl
7839
7850
  });
7840
- const reportPath = path6.join(dirname, "report.json");
7851
+ const reportPath = path7.join(dirname, "report.json");
7841
7852
  switch (scanner) {
7842
7853
  case "snyk":
7843
7854
  await getSnykReport(reportPath, repositoryRoot, { skipPrompts });
@@ -8337,10 +8348,7 @@ async function analyze({
8337
8348
  { skipPrompts }
8338
8349
  );
8339
8350
  }
8340
- var packageJson2 = JSON.parse(
8341
- fs4.readFileSync(path7.join(getDirName(), "../package.json"), "utf8")
8342
- );
8343
- var config3 = new Configstore2(packageJson2.name, { apiToken: "" });
8351
+ var config3 = new Configstore2(packageJson.name, { apiToken: "" });
8344
8352
  async function addScmToken(addScmTokenOptions) {
8345
8353
  const { apiKey, token, organization, scmType, url, refreshToken } = addScmTokenOptions;
8346
8354
  const gqlClient = new GQLClient({
@@ -8738,7 +8746,7 @@ var parseArgs = async (args) => {
8738
8746
  handler() {
8739
8747
  yargsInstance.showHelp();
8740
8748
  }
8741
- }).strictOptions().help("h").alias("h", "help").epilog(chalk9.bgBlue("Made with \u2764\uFE0F by Mobb")).showHelpOnFail(true).wrap(Math.min(120, yargsInstance.terminalWidth())).parse();
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();
8742
8750
  };
8743
8751
 
8744
8752
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "0.0.187",
3
+ "version": "0.0.189",
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.1.1",
32
- "@gitbeaker/requester-utils": "41.1.1",
33
- "@gitbeaker/rest": "41.1.1",
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.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.3.7",
47
- "dotenv": "16.4.5",
46
+ "debug": "4.4.0",
47
+ "dotenv": "16.4.7",
48
48
  "extract-zip": "2.0.1",
49
- "globby": "13.2.2",
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.0",
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.1",
77
+ "@graphql-codegen/typescript": "4.1.2",
78
78
  "@graphql-codegen/typescript-graphql-request": "6.2.0",
79
- "@graphql-codegen/typescript-operations": "4.3.1",
79
+ "@graphql-codegen/typescript-operations": "4.4.0",
80
80
  "@octokit/request-error": "3.0.3",
81
- "@octokit/types": "13.6.1",
82
- "@types/adm-zip": "0.5.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.4",
96
- "@vitest/ui": "^2.1.2",
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.3.3",
101
+ "prettier": "3.4.2",
102
102
  "tsup": "7.2.0",
103
103
  "typescript": "4.9.5",
104
- "vitest": "2.1.4"
104
+ "vitest": "2.1.8"
105
105
  },
106
106
  "engines": {
107
- "node": ">=18.18.0"
107
+ "node": ">=18.20.4"
108
108
  },
109
109
  "files": [
110
110
  "bin/cli.mjs",