mobbdev 1.0.8 → 1.0.10

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 +65 -26
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -110,7 +110,9 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
110
110
  IssueType_Enum2["ClientDomStoredCodeInjection"] = "CLIENT_DOM_STORED_CODE_INJECTION";
111
111
  IssueType_Enum2["CmDi"] = "CMDi";
112
112
  IssueType_Enum2["CmDiRelativePathCommand"] = "CMDi_relative_path_command";
113
+ IssueType_Enum2["CodeInComment"] = "CODE_IN_COMMENT";
113
114
  IssueType_Enum2["ConfusingNaming"] = "CONFUSING_NAMING";
115
+ IssueType_Enum2["Csrf"] = "CSRF";
114
116
  IssueType_Enum2["DangerousFunctionOverflow"] = "DANGEROUS_FUNCTION_OVERFLOW";
115
117
  IssueType_Enum2["DeadCodeUnusedField"] = "DEAD_CODE_UNUSED_FIELD";
116
118
  IssueType_Enum2["DebugEnabled"] = "DEBUG_ENABLED";
@@ -162,6 +164,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
162
164
  IssueType_Enum2["Pt"] = "PT";
163
165
  IssueType_Enum2["RaceConditionFormatFlaw"] = "RACE_CONDITION_FORMAT_FLAW";
164
166
  IssueType_Enum2["RegexInjection"] = "REGEX_INJECTION";
167
+ IssueType_Enum2["RegexMissingTimeout"] = "REGEX_MISSING_TIMEOUT";
165
168
  IssueType_Enum2["SqlInjection"] = "SQL_Injection";
166
169
  IssueType_Enum2["Ssrf"] = "SSRF";
167
170
  IssueType_Enum2["StringFormatMisuse"] = "STRING_FORMAT_MISUSE";
@@ -179,6 +182,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
179
182
  IssueType_Enum2["ValueShadowing"] = "VALUE_SHADOWING";
180
183
  IssueType_Enum2["WcfMisconfigurationInsufficientLogging"] = "WCF_MISCONFIGURATION_INSUFFICIENT_LOGGING";
181
184
  IssueType_Enum2["WcfMisconfigurationThrottlingNotEnabled"] = "WCF_MISCONFIGURATION_THROTTLING_NOT_ENABLED";
185
+ IssueType_Enum2["WeakEncryption"] = "WEAK_ENCRYPTION";
182
186
  IssueType_Enum2["WeakXmlSchemaUnboundedOccurrences"] = "WEAK_XML_SCHEMA_UNBOUNDED_OCCURRENCES";
183
187
  IssueType_Enum2["Xss"] = "XSS";
184
188
  IssueType_Enum2["Xxe"] = "XXE";
@@ -201,12 +205,12 @@ var Vulnerability_Report_Vendor_Enum = /* @__PURE__ */ ((Vulnerability_Report_Ve
201
205
  Vulnerability_Report_Vendor_Enum3["Sonarqube"] = "sonarqube";
202
206
  return Vulnerability_Report_Vendor_Enum3;
203
207
  })(Vulnerability_Report_Vendor_Enum || {});
204
- var Vulnerability_Severity_Enum = /* @__PURE__ */ ((Vulnerability_Severity_Enum2) => {
205
- Vulnerability_Severity_Enum2["Critical"] = "critical";
206
- Vulnerability_Severity_Enum2["High"] = "high";
207
- Vulnerability_Severity_Enum2["Low"] = "low";
208
- Vulnerability_Severity_Enum2["Medium"] = "medium";
209
- return Vulnerability_Severity_Enum2;
208
+ var Vulnerability_Severity_Enum = /* @__PURE__ */ ((Vulnerability_Severity_Enum3) => {
209
+ Vulnerability_Severity_Enum3["Critical"] = "critical";
210
+ Vulnerability_Severity_Enum3["High"] = "high";
211
+ Vulnerability_Severity_Enum3["Low"] = "low";
212
+ Vulnerability_Severity_Enum3["Medium"] = "medium";
213
+ return Vulnerability_Severity_Enum3;
210
214
  })(Vulnerability_Severity_Enum || {});
211
215
  var MeDocument = `
212
216
  query Me {
@@ -314,7 +318,9 @@ var GetFixesDocument = `
314
318
  fixes: fix(where: $filters) {
315
319
  safeIssueType
316
320
  id
317
- vulnerabilitySeverity
321
+ vulnerabilityReportIssues(limit: 1) {
322
+ parsedSeverity
323
+ }
318
324
  safeIssueLanguage
319
325
  patchAndQuestions {
320
326
  __typename
@@ -743,7 +749,11 @@ var issueTypeMap = {
743
749
  ["HEAP_INSPECTION" /* HeapInspection */]: "Heap Inspection",
744
750
  ["CLIENT_DOM_STORED_CODE_INJECTION" /* ClientDomStoredCodeInjection */]: "Client Code Injection",
745
751
  ["STRING_FORMAT_MISUSE" /* StringFormatMisuse */]: "String Format Misuse",
746
- ["NON_READONLY_FIELD" /* NonReadonlyField */]: "Non Readonly Field"
752
+ ["NON_READONLY_FIELD" /* NonReadonlyField */]: "Non Readonly Field",
753
+ ["CSRF" /* Csrf */]: "Cross-Site Request Forgery (CSRF)",
754
+ ["WEAK_ENCRYPTION" /* WeakEncryption */]: "Weak Encryption Mechanism",
755
+ ["CODE_IN_COMMENT" /* CodeInComment */]: "Code in Comment",
756
+ ["REGEX_MISSING_TIMEOUT" /* RegexMissingTimeout */]: "Regex Missing Timeout"
747
757
  };
748
758
  var issueTypeZ = z.nativeEnum(IssueType_Enum);
749
759
  var getIssueTypeFriendlyString = (issueType) => {
@@ -784,6 +794,7 @@ var IssueTypeSettingsZ = z2.array(IssueTypeSettingZ).transform((issueTypeSetting
784
794
  var OrganizationScreenQueryParamsZ = z3.object({
785
795
  organizationId: z3.string().uuid()
786
796
  });
797
+ var ParsedSeverityZ = z3.nativeEnum(Vulnerability_Severity_Enum).nullish().transform((i) => i ?? "low" /* Low */);
787
798
  var ProjectPageQueryParamsZ = z3.object({
788
799
  organizationId: z3.string().uuid(),
789
800
  projectId: z3.string().uuid()
@@ -876,7 +887,6 @@ var ReportQueryResultZ = z3.object({
876
887
  modifiedBy: z3.string().nullable(),
877
888
  gitBlameLogin: z3.string().nullable(),
878
889
  fixReportId: z3.string().uuid(),
879
- vulnerabilitySeverity: z3.nativeEnum(Vulnerability_Severity_Enum).nullable().transform((i) => i ?? "low" /* Low */),
880
890
  filePaths: z3.array(
881
891
  z3.object({
882
892
  fileRepoRelativePath: z3.string()
@@ -887,7 +897,8 @@ var ReportQueryResultZ = z3.object({
887
897
  vulnerabilityReportIssues: z3.array(
888
898
  z3.object({
889
899
  issueType: z3.string(),
890
- issueLanguage: z3.string()
900
+ issueLanguage: z3.string(),
901
+ parsedSeverity: ParsedSeverityZ
891
902
  })
892
903
  ),
893
904
  scmSubmitFixRequests: ScmSubmitFixRequestsZ,
@@ -966,7 +977,6 @@ var ReportFixesQueryZ = z3.array(
966
977
  effortToApplyFix: z3.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
967
978
  safeIssueLanguage: z3.string(),
968
979
  safeIssueType: z3.string(),
969
- vulnerabilitySeverity: z3.nativeEnum(Vulnerability_Severity_Enum).nullable().transform((i) => i ?? "low" /* Low */),
970
980
  fixReportId: z3.string().uuid(),
971
981
  filePaths: z3.array(
972
982
  z3.object({
@@ -977,9 +987,10 @@ var ReportFixesQueryZ = z3.array(
977
987
  vulnerabilityReportIssues: z3.array(
978
988
  z3.object({
979
989
  issueType: z3.string(),
980
- issueLanguage: z3.string()
990
+ issueLanguage: z3.string(),
991
+ parsedSeverity: ParsedSeverityZ
981
992
  })
982
- ),
993
+ ).min(1),
983
994
  scmSubmitFixRequests: ScmSubmitFixRequestsZ,
984
995
  fixRatings: z3.array(FixRatingZ).default([])
985
996
  })
@@ -1041,8 +1052,6 @@ var FixQueryZ = z3.object({
1041
1052
  fixReportId: z3.string().uuid(),
1042
1053
  isExpired: z3.boolean().default(false),
1043
1054
  isArchived: z3.boolean().nullable(),
1044
- // TODO: remove nullish once the data on the backend is ready
1045
- vulnerabilitySeverity: z3.nativeEnum(Vulnerability_Severity_Enum).nullable().transform((i) => i ?? "low" /* Low */),
1046
1055
  fixFiles: z3.array(
1047
1056
  z3.object({
1048
1057
  fileRepoRelativePath: z3.string()
@@ -1052,7 +1061,8 @@ var FixQueryZ = z3.object({
1052
1061
  vulnerabilityReportIssues: z3.array(
1053
1062
  z3.object({
1054
1063
  vendorIssueId: z3.string(),
1055
- issueLanguage: z3.string()
1064
+ issueLanguage: z3.string(),
1065
+ parsedSeverity: ParsedSeverityZ
1056
1066
  })
1057
1067
  ),
1058
1068
  patchAndQuestions: PatchAndQuestionsZ,
@@ -1128,7 +1138,8 @@ var FixScreenQueryResultZ = z3.object({
1128
1138
  z3.object({
1129
1139
  vendorIssueId: z3.string(),
1130
1140
  issueType: z3.string(),
1131
- issueLanguage: z3.string()
1141
+ issueLanguage: z3.string(),
1142
+ parsedSeverity: ParsedSeverityZ
1132
1143
  })
1133
1144
  )
1134
1145
  })
@@ -1716,7 +1727,11 @@ var fixDetailsData = {
1716
1727
  fixInstructions: "Update the code to avoid the possibility for malicious JavaScript code to get stored in the DOM."
1717
1728
  },
1718
1729
  ["STRING_FORMAT_MISUSE" /* StringFormatMisuse */]: void 0,
1719
- ["NON_READONLY_FIELD" /* NonReadonlyField */]: void 0
1730
+ ["NON_READONLY_FIELD" /* NonReadonlyField */]: void 0,
1731
+ ["CSRF" /* Csrf */]: void 0,
1732
+ ["WEAK_ENCRYPTION" /* WeakEncryption */]: void 0,
1733
+ ["CODE_IN_COMMENT" /* CodeInComment */]: void 0,
1734
+ ["REGEX_MISSING_TIMEOUT" /* RegexMissingTimeout */]: void 0
1720
1735
  };
1721
1736
 
1722
1737
  // src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
@@ -2068,6 +2083,25 @@ var pt = {
2068
2083
  }
2069
2084
  };
2070
2085
 
2086
+ // src/features/analysis/scm/shared/src/storedQuestionData/csharp/regexMissingTimeout.ts
2087
+ var regexMissingTimeout = {
2088
+ netVersionGreaterOrEqual7: {
2089
+ content: () => "Is your target framework .NET 7 or greater?",
2090
+ description: () => "",
2091
+ guidance: () => ""
2092
+ },
2093
+ timeout: {
2094
+ content: () => "Enter the timeout in milliseconds",
2095
+ description: () => "If the limit is reached a RegexTimeoutException is thrown, this could be caused by excessive backtracking",
2096
+ guidance: () => ""
2097
+ },
2098
+ useBacktrackingOption: {
2099
+ content: () => "Use non backtracking option",
2100
+ description: () => "If the regex does not need to use backtracking we can disable it using regex options",
2101
+ guidance: () => ""
2102
+ }
2103
+ };
2104
+
2071
2105
  // src/features/analysis/scm/shared/src/storedQuestionData/csharp/sqlInjection.ts
2072
2106
  var sqlInjection2 = {
2073
2107
  databaseProvider: {
@@ -2215,6 +2249,7 @@ var vulnerabilities7 = {
2215
2249
  ["OVERLY_BROAD_CATCH" /* OverlyBroadCatch */]: overlyBroadCatch,
2216
2250
  ["TRUST_BOUNDARY_VIOLATION" /* TrustBoundaryViolation */]: trustBoundaryViolation,
2217
2251
  ["PT" /* Pt */]: pt,
2252
+ ["REGEX_MISSING_TIMEOUT" /* RegexMissingTimeout */]: regexMissingTimeout,
2218
2253
  ["HTTP_ONLY_COOKIE" /* HttpOnlyCookie */]: httpOnlyCookie,
2219
2254
  ["INSECURE_COOKIE" /* InsecureCookie */]: insecureCookie,
2220
2255
  ["WCF_MISCONFIGURATION_THROTTLING_NOT_ENABLED" /* WcfMisconfigurationThrottlingNotEnabled */]: wcfMisconfigurationThrottlingNotEnabled,
@@ -6477,7 +6512,11 @@ function buildCommentBody({
6477
6512
  const title = `# ${MobbIconMarkdown} ${issueType} fix is ready`;
6478
6513
  const validFixParseRes = z19.object({
6479
6514
  patchAndQuestions: PatchAndQuestionsZ,
6480
- vulnerabilitySeverity: z19.nativeEnum(Vulnerability_Severity_Enum),
6515
+ vulnerabilityReportIssues: z19.array(
6516
+ z19.object({
6517
+ parsedSeverity: ParsedSeverityZ
6518
+ })
6519
+ ).min(1),
6481
6520
  safeIssueLanguage: z19.nativeEnum(IssueLanguage_Enum),
6482
6521
  safeIssueType: z19.nativeEnum(IssueType_Enum)
6483
6522
  }).safeParse(fix);
@@ -6490,7 +6529,7 @@ function buildCommentBody({
6490
6529
  const subTitle = validFixParseRes.success ? getCommitDescription({
6491
6530
  issueType: validFixParseRes.data.safeIssueType,
6492
6531
  vendor: scannerToVulnerability_Report_Vendor_Enum[scanner],
6493
- severity: validFixParseRes.data.vulnerabilitySeverity,
6532
+ severity: validFixParseRes.data.vulnerabilityReportIssues[0]?.parsedSeverity,
6494
6533
  guidances: getGuidances({
6495
6534
  questions: validFixParseRes.data.patchAndQuestions.questions.map(toQuestion),
6496
6535
  issueType: validFixParseRes.data.safeIssueType,
@@ -8500,7 +8539,7 @@ var yesOption = {
8500
8539
  describe: chalk6.bold("Skip prompts and use default values")
8501
8540
  };
8502
8541
  var refOption = {
8503
- describe: chalk6.bold("reference of the repository (branch, tag, commit)"),
8542
+ describe: chalk6.bold("Reference of the repository (branch, tag, commit)"),
8504
8543
  type: "string",
8505
8544
  demandOption: false
8506
8545
  };
@@ -8646,7 +8685,7 @@ function analyzeBuilder(yargs2) {
8646
8685
  describe: chalk8.bold("Hash of the commit"),
8647
8686
  type: "string"
8648
8687
  }).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).example(
8649
- "$0 analyze -r https://github.com/WebGoat/WebGoat -f <your_vulirabitliy_report_path>",
8688
+ "npx mobbdev@latest analyze -r https://github.com/WebGoat/WebGoat -f <your_vulnerability_report_path>",
8650
8689
  "analyze an existing repository"
8651
8690
  ).help();
8652
8691
  }
@@ -8705,7 +8744,7 @@ function reviewBuilder(yargs2) {
8705
8744
  type: "string",
8706
8745
  demandOption: true
8707
8746
  }).example(
8708
- "$0 review -r https://github.com/WebGoat/WebGoat -f <your_vulirabitliy_report_path> --ch <pr_last_commit> --pr <pr_number> --ref <pr_branch_name> --api-key <api_key> --src-path <your_repo_path>",
8747
+ "npx mobbdev@latest review -r https://github.com/WebGoat/WebGoat -f <your_vulnerability_report_path> --ch <pr_last_commit> --pr <pr_number> --ref <pr_branch_name> --api-key <api_key> --src-path <your_repo_path>",
8709
8748
  "add fixes to your pr"
8710
8749
  ).help();
8711
8750
  }
@@ -8725,7 +8764,7 @@ async function reviewHandler(args) {
8725
8764
  // src/args/commands/scan.ts
8726
8765
  function scanBuilder(args) {
8727
8766
  return args.coerce("scanner", (arg) => arg.toLowerCase()).option("repo", repoOption).option("ref", refOption).option("scanner", scannerOptions).option("org", organizationIdOptions).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("api-key", apiKeyOption).option("cx-project-name", projectNameOption).option("auto-pr", autoPrOption).example(
8728
- "$0 scan -r https://github.com/WebGoat/WebGoat",
8767
+ "npx mobbdev@latest scan -r https://github.com/WebGoat/WebGoat",
8729
8768
  "Scan an existing repository"
8730
8769
  ).help();
8731
8770
  }
@@ -8750,7 +8789,7 @@ async function scanHandler(args) {
8750
8789
  // src/args/commands/token.ts
8751
8790
  function addScmTokenBuilder(args) {
8752
8791
  return args.option("scm-type", scmTypeOption).option("url", urlOption).option("token", scmTokenOption).option("organization", scmOrgOption).option("refresh-token", scmRefreshTokenOption).option("api-key", apiKeyOption).option("ci", ciOption).example(
8753
- "$0 add-scm-token --scm-type Ado --url https://dev.azure.com/adoorg/test/_git/repo --token abcdef0123456 --organization myOrg",
8792
+ "npx mobbdev@latest add-scm-token --scm-type Ado --url https://dev.azure.com/adoorg/test/_git/repo --token abcdef0123456 --organization myOrg",
8754
8793
  `Add your SCM (${Object.values(scmFriendlyText).join(", ")}) token to Mobb to enable automated fixes.`
8755
8794
  ).help().demandOption(["url", "token"]);
8756
8795
  }
@@ -8827,7 +8866,7 @@ var parseArgs = async (args) => {
8827
8866
  addScmTokenBuilder,
8828
8867
  addScmTokenHandler
8829
8868
  ).example(
8830
- "$0 scan -r https://github.com/WebGoat/WebGoat",
8869
+ "npx mobbdev@latest scan -r https://github.com/WebGoat/WebGoat",
8831
8870
  "Scan an existing repository"
8832
8871
  ).command({
8833
8872
  command: "*",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
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",
@@ -40,7 +40,7 @@
40
40
  "axios": "1.7.9",
41
41
  "azure-devops-node-api": "12.1.0",
42
42
  "bitbucket": "2.11.0",
43
- "chalk": "5.3.0",
43
+ "chalk": "5.4.1",
44
44
  "chalk-animation": "2.0.3",
45
45
  "configstore": "6.0.0",
46
46
  "debug": "4.4.0",