mobbdev 1.0.80 → 1.0.82

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 +52 -13
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -426,6 +426,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
426
426
  IssueType_Enum2["WeakEncryption"] = "WEAK_ENCRYPTION";
427
427
  IssueType_Enum2["WeakXmlSchemaUnboundedOccurrences"] = "WEAK_XML_SCHEMA_UNBOUNDED_OCCURRENCES";
428
428
  IssueType_Enum2["WebsocketMissingOriginCheck"] = "WEBSOCKET_MISSING_ORIGIN_CHECK";
429
+ IssueType_Enum2["WildcardImports"] = "WILDCARD_IMPORTS";
429
430
  IssueType_Enum2["Xss"] = "XSS";
430
431
  IssueType_Enum2["Xxe"] = "XXE";
431
432
  IssueType_Enum2["ZipSlip"] = "ZIP_SLIP";
@@ -890,11 +891,12 @@ var GitReferenceDocument = `
890
891
  }
891
892
  `;
892
893
  var AutoPrAnalysisDocument = `
893
- mutation autoPrAnalysis($analysisId: String!, $commitDirectly: Boolean, $prId: Int) {
894
+ mutation autoPrAnalysis($analysisId: String!, $commitDirectly: Boolean, $prId: Int, $prStrategy: PRStrategy) {
894
895
  autoPrAnalysis(
895
896
  analysisId: $analysisId
896
897
  sameBranchCommit: $commitDirectly
897
898
  prId: $prId
899
+ prStrategy: $prStrategy
898
900
  ) {
899
901
  __typename
900
902
  ... on AutoPrSuccess {
@@ -1398,6 +1400,7 @@ var issueTypeMap = {
1398
1400
  ["RETURN_SHOULD_NOT_BE_INVARIANT" /* ReturnShouldNotBeInvariant */]: "Return Should Not Be Invariant",
1399
1401
  ["SYSTEM_EXIT_SHOULD_RERAISE" /* SystemExitShouldReraise */]: "SystemExit Should Reraise",
1400
1402
  ["NO_RETURN_IN_FINALLY" /* NoReturnInFinally */]: "No Return in Finally Block",
1403
+ ["WILDCARD_IMPORTS" /* WildcardImports */]: "Wildcard Imports should not be used",
1401
1404
  ["AVOID_IDENTITY_COMPARISON_CACHED_TYPES" /* AvoidIdentityComparisonCachedTypes */]: "Avoid Identity Comparison of Cached Types",
1402
1405
  ["AVOID_BUILTIN_SHADOWING" /* AvoidBuiltinShadowing */]: "Avoid Builtin Shadowing",
1403
1406
  ["IMPROPER_STRING_FORMATTING" /* ImproperStringFormatting */]: "Improper String Formatting"
@@ -2131,7 +2134,8 @@ var fixDetailsData = {
2131
2134
  ["NO_RETURN_IN_FINALLY" /* NoReturnInFinally */]: void 0,
2132
2135
  ["AVOID_IDENTITY_COMPARISON_CACHED_TYPES" /* AvoidIdentityComparisonCachedTypes */]: void 0,
2133
2136
  ["AVOID_BUILTIN_SHADOWING" /* AvoidBuiltinShadowing */]: void 0,
2134
- ["IMPROPER_STRING_FORMATTING" /* ImproperStringFormatting */]: void 0
2137
+ ["IMPROPER_STRING_FORMATTING" /* ImproperStringFormatting */]: void 0,
2138
+ ["WILDCARD_IMPORTS" /* WildcardImports */]: void 0
2135
2139
  };
2136
2140
 
2137
2141
  // src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
@@ -7559,6 +7563,13 @@ var autoPrOption = {
7559
7563
  type: "boolean",
7560
7564
  default: false
7561
7565
  };
7566
+ var createOnePrOption = {
7567
+ describe: chalk2.bold(
7568
+ "Create a single unified PR for all fixes (requires --auto-pr)"
7569
+ ),
7570
+ type: "boolean",
7571
+ default: false
7572
+ };
7562
7573
  var commitDirectlyOption = {
7563
7574
  describe: chalk2.bold(
7564
7575
  "Commit directly to the scanned branch instead of creating a pull request"
@@ -8239,7 +8250,14 @@ ${contextString}` : description;
8239
8250
  import Debug9 from "debug";
8240
8251
  var debug9 = Debug9("mobbdev:handleAutoPr");
8241
8252
  async function handleAutoPr(params) {
8242
- const { gqlClient, analysisId, commitDirectly, prId, createSpinner: createSpinner5 } = params;
8253
+ const {
8254
+ gqlClient,
8255
+ analysisId,
8256
+ commitDirectly,
8257
+ prId,
8258
+ createSpinner: createSpinner5,
8259
+ createOnePr
8260
+ } = params;
8243
8261
  const createAutoPrSpinner = createSpinner5(
8244
8262
  "\u{1F504} Waiting for the analysis to finish before initiating automatic pull request creation"
8245
8263
  ).start();
@@ -8248,11 +8266,12 @@ async function handleAutoPr(params) {
8248
8266
  analysisId
8249
8267
  },
8250
8268
  callback: async (analysisId2) => {
8251
- const autoPrAnalysisRes = await gqlClient.autoPrAnalysis(
8252
- analysisId2,
8269
+ const autoPrAnalysisRes = await gqlClient.autoPrAnalysis({
8270
+ analysisId: analysisId2,
8253
8271
  commitDirectly,
8254
- prId
8255
- );
8272
+ prId,
8273
+ prStrategy: createOnePr ? "CONDENSE" /* Condense */ : "SPREAD" /* Spread */
8274
+ });
8256
8275
  debug9("auto pr analysis res %o", autoPrAnalysisRes);
8257
8276
  if (autoPrAnalysisRes.autoPrAnalysis?.__typename === "AutoPrError") {
8258
8277
  createAutoPrSpinner.error({
@@ -8801,11 +8820,17 @@ var GQLClient = class {
8801
8820
  }
8802
8821
  return res.analysis;
8803
8822
  }
8804
- async autoPrAnalysis(analysisId, commitDirectly, prId) {
8823
+ async autoPrAnalysis({
8824
+ analysisId,
8825
+ commitDirectly,
8826
+ prId,
8827
+ prStrategy
8828
+ }) {
8805
8829
  return this._clientSdk.autoPrAnalysis({
8806
8830
  analysisId,
8807
8831
  commitDirectly,
8808
- prId
8832
+ prId,
8833
+ prStrategy
8809
8834
  });
8810
8835
  }
8811
8836
  async getFixes(fixIds) {
@@ -9483,6 +9508,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
9483
9508
  command,
9484
9509
  organizationId: userOrganizationId,
9485
9510
  autoPr,
9511
+ createOnePr,
9486
9512
  commitDirectly,
9487
9513
  pullRequest
9488
9514
  } = params;
@@ -9626,7 +9652,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
9626
9652
  analysisId: reportUploadInfo.fixReportId,
9627
9653
  commitDirectly,
9628
9654
  prId: pullRequest,
9629
- createSpinner: createSpinner5
9655
+ createSpinner: createSpinner5,
9656
+ createOnePr
9630
9657
  });
9631
9658
  }
9632
9659
  await askToOpenAnalysis();
@@ -9789,7 +9816,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
9789
9816
  analysisId: reportUploadInfo.fixReportId,
9790
9817
  commitDirectly,
9791
9818
  prId: pullRequest,
9792
- createSpinner: createSpinner5
9819
+ createSpinner: createSpinner5,
9820
+ createOnePr
9793
9821
  });
9794
9822
  }
9795
9823
  await askToOpenAnalysis();
@@ -10189,7 +10217,7 @@ function analyzeBuilder(yargs2) {
10189
10217
  alias: "commit-hash",
10190
10218
  describe: chalk8.bold("Hash of the commit"),
10191
10219
  type: "string"
10192
- }).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("org", organizationIdOptions).option("api-key", apiKeyOption).option("commit-hash", commitHashOption).option("auto-pr", autoPrOption).option("commit-directly", commitDirectlyOption).option("pull-request", {
10220
+ }).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("org", organizationIdOptions).option("api-key", apiKeyOption).option("commit-hash", commitHashOption).option("auto-pr", autoPrOption).option("create-one-pr", createOnePrOption).option("commit-directly", commitDirectlyOption).option("pull-request", {
10193
10221
  alias: ["pr", "pr-number", "pr-id"],
10194
10222
  describe: chalk8.bold("Number of the pull request"),
10195
10223
  type: "number",
@@ -10200,6 +10228,7 @@ function analyzeBuilder(yargs2) {
10200
10228
  ).help();
10201
10229
  }
10202
10230
  function validateAnalyzeOptions(argv) {
10231
+ console.log("argv", argv);
10203
10232
  if (!fs7.existsSync(argv.f)) {
10204
10233
  throw new CliError(`
10205
10234
  Can't access ${chalk8.bold(argv.f)}`);
@@ -10219,7 +10248,17 @@ Can't access ${chalk8.bold(argv.f)}`);
10219
10248
  "--commit-directly flag requires --auto-pr to be provided as well"
10220
10249
  );
10221
10250
  }
10222
- if (argv.pullRequest && !argv["commit-directly"]) {
10251
+ if (argv["create-one-pr"] && !argv["auto-pr"]) {
10252
+ throw new CliError(
10253
+ "--create-one-pr flag requires --auto-pr to be provided as well"
10254
+ );
10255
+ }
10256
+ if (argv["create-one-pr"] && argv.commitDirectly) {
10257
+ throw new CliError(
10258
+ "--create-one-pr and --commit-directly cannot be provided at the same time"
10259
+ );
10260
+ }
10261
+ if (argv.pullRequest && !argv.commitDirectly) {
10223
10262
  throw new CliError(
10224
10263
  "--pull-request flag requires --commit-directly to be provided as well"
10225
10264
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
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",