mobbdev 0.0.53 → 0.0.56

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 (2) hide show
  1. package/dist/index.mjs +51 -45
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -13,7 +13,7 @@ var __publicField = (obj, key, value) => {
13
13
  import { hideBin } from "yargs/helpers";
14
14
 
15
15
  // src/args/yargs.ts
16
- import chalk8 from "chalk";
16
+ import chalk9 from "chalk";
17
17
  import yargs from "yargs/yargs";
18
18
 
19
19
  // src/args/commands/analyze.ts
@@ -22,6 +22,7 @@ import fs4 from "node:fs";
22
22
  // src/constants.ts
23
23
  import path from "node:path";
24
24
  import { fileURLToPath } from "node:url";
25
+ import chalk from "chalk";
25
26
  import Debug from "debug";
26
27
  import * as dotenv from "dotenv";
27
28
  import { z } from "zod";
@@ -70,6 +71,11 @@ var mobbAscii = `
70
71
  `;
71
72
  var WEB_APP_URL = envVariables.WEB_APP_URL;
72
73
  var API_URL = envVariables.API_URL;
74
+ var errorMessages = {
75
+ missingCxProjectName: `project name ${chalk.bold(
76
+ "(--cx-project-name)"
77
+ )} is needed if you're using checkmarx`
78
+ };
73
79
 
74
80
  // src/features/analysis/index.ts
75
81
  import crypto from "node:crypto";
@@ -139,7 +145,7 @@ var CliError = class extends Error {
139
145
  };
140
146
 
141
147
  // src/features/analysis/index.ts
142
- import chalk3 from "chalk";
148
+ import chalk4 from "chalk";
143
149
  import Configstore from "configstore";
144
150
  import Debug9 from "debug";
145
151
  import extract from "extract-zip";
@@ -760,7 +766,7 @@ function createChildProcess({ childProcess, name }, options) {
760
766
  }
761
767
 
762
768
  // src/features/analysis/scanners/checkmarx.ts
763
- import chalk from "chalk";
769
+ import chalk2 from "chalk";
764
770
  import Debug6 from "debug";
765
771
  import { existsSync } from "fs";
766
772
  import { createSpinner as createSpinner2 } from "nanospinner";
@@ -853,7 +859,7 @@ async function throwCheckmarxConfigError() {
853
859
  await createSpinner2("\u{1F513} Checkmarx is not configued correctly").start().error();
854
860
  throw new CliError(
855
861
  `Checkmarx is not configued correctly
856
- you can configure it by using the ${chalk.bold(
862
+ you can configure it by using the ${chalk2.bold(
857
863
  "cx configure"
858
864
  )} command`
859
865
  );
@@ -861,8 +867,8 @@ async function throwCheckmarxConfigError() {
861
867
  async function validateCheckamxCredentials() {
862
868
  console.log(`
863
869
  Here's a suggestion for checkmarx configuation:
864
- ${chalk.bold("AST Base URI:")} https://ast.checkmarx.net
865
- ${chalk.bold("AST Base Auth URI (IAM):")} https://iam.checkmarx.net
870
+ ${chalk2.bold("AST Base URI:")} https://ast.checkmarx.net
871
+ ${chalk2.bold("AST Base Auth URI (IAM):")} https://iam.checkmarx.net
866
872
  `);
867
873
  await forkCheckmarx(CONFIGURE_COMMAND, { display: true });
868
874
  const { code: loginCode } = await forkCheckmarx(VALIDATE_COMMAND, {
@@ -882,7 +888,7 @@ async function validateCheckamxCredentials() {
882
888
 
883
889
  // src/features/analysis/scanners/snyk.ts
884
890
  import { createRequire as createRequire2 } from "node:module";
885
- import chalk2 from "chalk";
891
+ import chalk3 from "chalk";
886
892
  import Debug7 from "debug";
887
893
  import { createSpinner as createSpinner3 } from "nanospinner";
888
894
  import open from "open";
@@ -934,7 +940,7 @@ async function getSnykReport(reportPath, repoRoot, { skipPrompts = false }) {
934
940
  await open(SNYK_ARTICLE_URL);
935
941
  }
936
942
  console.log(
937
- chalk2.bgBlue(
943
+ chalk3.bgBlue(
938
944
  "\nPlease enable Snyk Code in your Snyk account and try again."
939
945
  )
940
946
  );
@@ -2098,7 +2104,7 @@ async function downloadRepo({
2098
2104
  if (!response.ok) {
2099
2105
  debug8("SCM zipball request failed %s %s", response.body, response.status);
2100
2106
  repoSpinner.error({ text: "\u{1F4BE} Repo download failed" });
2101
- throw new Error(`Can't access ${chalk3.bold(repoUrl)}`);
2107
+ throw new Error(`Can't access ${chalk4.bold(repoUrl)}`);
2102
2108
  }
2103
2109
  const fileWriterStream = fs3.createWriteStream(zipFilePath);
2104
2110
  if (!response.body) {
@@ -2116,7 +2122,7 @@ async function downloadRepo({
2116
2122
  }
2117
2123
  var LOGIN_MAX_WAIT = 10 * 60 * 1e3;
2118
2124
  var LOGIN_CHECK_DELAY = 5 * 1e3;
2119
- var MOBB_LOGIN_REQUIRED_MSG = `\u{1F513} Login to Mobb is Required, you will be redirected to our login page, once the authorization is complete return to this prompt, ${chalk3.bgBlue(
2125
+ var MOBB_LOGIN_REQUIRED_MSG = `\u{1F513} Login to Mobb is Required, you will be redirected to our login page, once the authorization is complete return to this prompt, ${chalk4.bgBlue(
2120
2126
  "press any key to continue"
2121
2127
  )};`;
2122
2128
  var tmpObj = tmp.dirSync({
@@ -2292,11 +2298,11 @@ async function _scan({
2292
2298
  fixReportId: reportUploadInfo.fixReportId
2293
2299
  });
2294
2300
  !ci && console.log("You can access the analysis at: \n");
2295
- console.log(chalk3.bold(reportUrl));
2301
+ console.log(chalk4.bold(reportUrl));
2296
2302
  !skipPrompts && await mobbAnalysisPrompt();
2297
2303
  !ci && open2(reportUrl);
2298
2304
  !ci && console.log(
2299
- chalk3.bgBlue("\n\n My work here is done for now, see you soon! \u{1F575}\uFE0F\u200D\u2642\uFE0F ")
2305
+ chalk4.bgBlue("\n\n My work here is done for now, see you soon! \u{1F575}\uFE0F\u200D\u2642\uFE0F ")
2300
2306
  );
2301
2307
  }
2302
2308
  async function handleMobbLogin() {
@@ -2501,7 +2507,7 @@ async function scan(scanOptions, { skipPrompts = false } = {}) {
2501
2507
  }
2502
2508
  selectedScanner === SCANNERS.Checkmarx && validateCheckmarxInstallation();
2503
2509
  if (selectedScanner === SCANNERS.Checkmarx && !scanOptions.cxProjectName) {
2504
- throw new CliError("Project name is needed if you're using checkmarx");
2510
+ throw new CliError(errorMessages.missingCxProjectName);
2505
2511
  }
2506
2512
  await runAnalysis(
2507
2513
  { ...scanOptions, scanner: selectedScanner },
@@ -2516,32 +2522,32 @@ async function showWelcomeMessage(skipPrompts = false) {
2516
2522
  }
2517
2523
 
2518
2524
  // src/args/commands/analyze.ts
2519
- import chalk6 from "chalk";
2525
+ import chalk7 from "chalk";
2520
2526
 
2521
2527
  // src/args/options.ts
2522
- import chalk4 from "chalk";
2528
+ import chalk5 from "chalk";
2523
2529
  var repoOption = {
2524
2530
  alias: "r",
2525
2531
  demandOption: true,
2526
2532
  type: "string",
2527
- describe: chalk4.bold("Github / GitLab repository URL")
2533
+ describe: chalk5.bold("Github / GitLab repository URL")
2528
2534
  };
2529
2535
  var projectNameOption = {
2530
2536
  type: "string",
2531
- describe: chalk4.bold("Checkmarx project name (when scanning with Checkmarx)")
2537
+ describe: chalk5.bold("Checkmarx project name (when scanning with Checkmarx)")
2532
2538
  };
2533
2539
  var yesOption = {
2534
2540
  alias: "yes",
2535
2541
  type: "boolean",
2536
- describe: chalk4.bold("Skip prompts and use default values")
2542
+ describe: chalk5.bold("Skip prompts and use default values")
2537
2543
  };
2538
2544
  var refOption = {
2539
- describe: chalk4.bold("reference of the repository (branch, tag, commit)"),
2545
+ describe: chalk5.bold("reference of the repository (branch, tag, commit)"),
2540
2546
  type: "string",
2541
2547
  demandOption: false
2542
2548
  };
2543
2549
  var ciOption = {
2544
- describe: chalk4.bold(
2550
+ describe: chalk5.bold(
2545
2551
  "Run in CI mode, prompts and browser will not be opened"
2546
2552
  ),
2547
2553
  type: "boolean",
@@ -2549,16 +2555,16 @@ var ciOption = {
2549
2555
  };
2550
2556
  var apiKeyOption = {
2551
2557
  type: "string",
2552
- describe: chalk4.bold("Mobb authentication api-key")
2558
+ describe: chalk5.bold("Mobb authentication api-key")
2553
2559
  };
2554
2560
  var commitHashOption = {
2555
2561
  alias: "ch",
2556
- describe: chalk4.bold("Hash of the commit"),
2562
+ describe: chalk5.bold("Hash of the commit"),
2557
2563
  type: "string"
2558
2564
  };
2559
2565
 
2560
2566
  // src/args/validation.ts
2561
- import chalk5 from "chalk";
2567
+ import chalk6 from "chalk";
2562
2568
  import path7 from "path";
2563
2569
  import { z as z6 } from "zod";
2564
2570
  function throwRepoUrlErrorMessage({
@@ -2568,11 +2574,11 @@ function throwRepoUrlErrorMessage({
2568
2574
  }) {
2569
2575
  const errorMessage = error.issues[error.issues.length - 1]?.message;
2570
2576
  const formattedErrorMessage = `
2571
- Error: ${chalk5.bold(
2577
+ Error: ${chalk6.bold(
2572
2578
  repoUrl
2573
2579
  )} is ${errorMessage}
2574
2580
  Example:
2575
- mobbdev ${command} -r ${chalk5.bold(
2581
+ mobbdev ${command} -r ${chalk6.bold(
2576
2582
  "https://github.com/WebGoat/WebGoat"
2577
2583
  )}`;
2578
2584
  throw new CliError(formattedErrorMessage);
@@ -2603,9 +2609,9 @@ function validateReportFileFormat(reportFile) {
2603
2609
  if (!supportExtensions.includes(path7.extname(reportFile))) {
2604
2610
  throw new CliError(
2605
2611
  `
2606
- ${chalk5.bold(
2612
+ ${chalk6.bold(
2607
2613
  reportFile
2608
- )} is not a supported file extension. Supported extensions are: ${chalk5.bold(
2614
+ )} is not a supported file extension. Supported extensions are: ${chalk6.bold(
2609
2615
  supportExtensions.join(", ")
2610
2616
  )}
2611
2617
  `
@@ -2619,18 +2625,18 @@ function analyzeBuilder(yargs2) {
2619
2625
  alias: "scan-file",
2620
2626
  demandOption: true,
2621
2627
  type: "string",
2622
- describe: chalk6.bold(
2628
+ describe: chalk7.bold(
2623
2629
  "Select the vulnerability report to analyze (Checkmarx, Snyk, Fortify, CodeQL)"
2624
2630
  )
2625
2631
  }).option("repo", repoOption).option("p", {
2626
2632
  alias: "src-path",
2627
- describe: chalk6.bold(
2633
+ describe: chalk7.bold(
2628
2634
  "Path to the repository folder with the source code"
2629
2635
  ),
2630
2636
  type: "string"
2631
2637
  }).option("ref", refOption).option("ch", {
2632
2638
  alias: "commit-hash",
2633
- describe: chalk6.bold("Hash of the commit"),
2639
+ describe: chalk7.bold("Hash of the commit"),
2634
2640
  type: "string"
2635
2641
  }).option("y", yesOption).option("ci", ciOption).option("api-key", apiKeyOption).option("commit-hash", commitHashOption).example(
2636
2642
  "$0 analyze -r https://github.com/WebGoat/WebGoat -f <your_vulirabitliy_report_path>",
@@ -2640,7 +2646,7 @@ function analyzeBuilder(yargs2) {
2640
2646
  function validateAnalyzeOptions(argv) {
2641
2647
  if (!fs4.existsSync(argv.f)) {
2642
2648
  throw new CliError(`
2643
- Can't access ${chalk6.bold(argv.f)}`);
2649
+ Can't access ${chalk7.bold(argv.f)}`);
2644
2650
  }
2645
2651
  if (!argv.srcPath && !argv.repo) {
2646
2652
  throw new CliError("You must supply either --src-path or --repo");
@@ -2659,12 +2665,12 @@ async function analyzeHandler(args) {
2659
2665
  }
2660
2666
 
2661
2667
  // src/args/commands/scan.ts
2662
- import chalk7 from "chalk";
2668
+ import chalk8 from "chalk";
2663
2669
  function scanBuilder(args) {
2664
2670
  return args.coerce("scanner", (arg) => arg.toLowerCase()).option("repo", repoOption).option("ref", refOption).option("s", {
2665
2671
  alias: "scanner",
2666
2672
  choices: Object.values(SCANNERS),
2667
- describe: chalk7.bold("Select the scanner to use")
2673
+ describe: chalk8.bold("Select the scanner to use")
2668
2674
  }).option("y", yesOption).option("ci", ciOption).option("api-key", apiKeyOption).option("cx-project-name", projectNameOption).example(
2669
2675
  "$0 scan -r https://github.com/WebGoat/WebGoat",
2670
2676
  "Scan an existing repository"
@@ -2674,7 +2680,7 @@ function validateScanOptions(argv) {
2674
2680
  validateRepoUrl(argv);
2675
2681
  argv.scanner === SCANNERS.Checkmarx && validateCheckmarxInstallation();
2676
2682
  if (argv.scanner === SCANNERS.Checkmarx && !argv.cxProjectName) {
2677
- throw new CliError("project name is needed if you're using checkmarx");
2683
+ throw new CliError(errorMessages.missingCxProjectName);
2678
2684
  }
2679
2685
  if (argv.ci && !argv.apiKey) {
2680
2686
  throw new CliError(
@@ -2691,28 +2697,28 @@ async function scanHandler(args) {
2691
2697
  var parseArgs = async (args) => {
2692
2698
  const yargsInstance = yargs(args);
2693
2699
  return yargsInstance.updateStrings({
2694
- "Commands:": chalk8.yellow.underline.bold("Commands:"),
2695
- "Options:": chalk8.yellow.underline.bold("Options:"),
2696
- "Examples:": chalk8.yellow.underline.bold("Examples:"),
2697
- "Show help": chalk8.bold("Show help")
2700
+ "Commands:": chalk9.yellow.underline.bold("Commands:"),
2701
+ "Options:": chalk9.yellow.underline.bold("Options:"),
2702
+ "Examples:": chalk9.yellow.underline.bold("Examples:"),
2703
+ "Show help": chalk9.bold("Show help")
2698
2704
  }).usage(
2699
- `${chalk8.bold(
2705
+ `${chalk9.bold(
2700
2706
  "\n Bugsy - Trusted, Automatic Vulnerability Fixer \u{1F575}\uFE0F\u200D\u2642\uFE0F\n\n"
2701
- )} ${chalk8.yellow.underline.bold("Usage:")}
2702
- $0 ${chalk8.green(
2707
+ )} ${chalk9.yellow.underline.bold("Usage:")}
2708
+ $0 ${chalk9.green(
2703
2709
  "<command>"
2704
- )} ${chalk8.dim("[options]")}
2710
+ )} ${chalk9.dim("[options]")}
2705
2711
  `
2706
2712
  ).version(false).command(
2707
2713
  "scan",
2708
- chalk8.bold(
2714
+ chalk9.bold(
2709
2715
  "Scan your code for vulnerabilities, get automated fixes right away."
2710
2716
  ),
2711
2717
  scanBuilder,
2712
2718
  scanHandler
2713
2719
  ).command(
2714
2720
  "analyze",
2715
- chalk8.bold(
2721
+ chalk9.bold(
2716
2722
  "Provide a vulnerability report and relevant code repository, get automated fixes right away."
2717
2723
  ),
2718
2724
  analyzeBuilder,
@@ -2725,7 +2731,7 @@ var parseArgs = async (args) => {
2725
2731
  handler() {
2726
2732
  yargsInstance.showHelp();
2727
2733
  }
2728
- }).strictOptions().help("h").alias("h", "help").epilog(chalk8.bgBlue("Made with \u2764\uFE0F by Mobb")).showHelpOnFail(true).wrap(Math.min(120, yargsInstance.terminalWidth())).parse();
2734
+ }).strictOptions().help("h").alias("h", "help").epilog(chalk9.bgBlue("Made with \u2764\uFE0F by Mobb")).showHelpOnFail(true).wrap(Math.min(120, yargsInstance.terminalWidth())).parse();
2729
2735
  };
2730
2736
 
2731
2737
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "0.0.53",
3
+ "version": "0.0.56",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "https://github.com/mobb-dev/bugsy",
6
6
  "main": "dist/index.js",