mobbdev 1.0.13 → 1.0.15

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 +100 -21
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -592,8 +592,8 @@ var GitReferenceDocument = `
592
592
  }
593
593
  `;
594
594
  var AutoPrAnalysisDocument = `
595
- mutation autoPrAnalysis($analysisId: String!) {
596
- autoPrAnalysis(analysisId: $analysisId) {
595
+ mutation autoPrAnalysis($analysisId: String!, $commitDirectly: Boolean) {
596
+ autoPrAnalysis(analysisId: $analysisId, sameBranchCommit: $commitDirectly) {
597
597
  __typename
598
598
  ... on AutoPrSuccess {
599
599
  status
@@ -1742,7 +1742,10 @@ var fixDetailsData = {
1742
1742
  },
1743
1743
  ["STRING_FORMAT_MISUSE" /* StringFormatMisuse */]: void 0,
1744
1744
  ["NON_READONLY_FIELD" /* NonReadonlyField */]: void 0,
1745
- ["CSRF" /* Csrf */]: void 0,
1745
+ ["CSRF" /* Csrf */]: {
1746
+ issueDescription: "Cross Site Request Forgery is an attack that forces an end user to execute unwanted actions on a web application in which they\u2019re currently authenticated.",
1747
+ fixInstructions: "Configure a CSRF protection mechanism, such as a CSRF token, in your application."
1748
+ },
1746
1749
  ["WEAK_ENCRYPTION" /* WeakEncryption */]: void 0,
1747
1750
  ["CODE_IN_COMMENT" /* CodeInComment */]: void 0,
1748
1751
  ["REGEX_MISSING_TIMEOUT" /* RegexMissingTimeout */]: void 0
@@ -1873,6 +1876,17 @@ var vulnerabilities2 = {
1873
1876
  };
1874
1877
  var java_default = vulnerabilities2;
1875
1878
 
1879
+ // src/features/analysis/scm/shared/src/storedFixData/python/csrf.ts
1880
+ var csrf = {
1881
+ guidance: () => `Please make sure the CSRF middleware is activated by default in the MIDDLEWARE setting. If you override that setting, remember that \`django.middleware.csrf.CsrfViewMiddleware\` should come before any view middleware that assume that CSRF attacks have been dealt with.
1882
+
1883
+
1884
+ If you disabled it, which is not recommended, you can use [\`csrf_protect()\`](https://docs.djangoproject.com/en/5.1/ref/csrf/#django.views.decorators.csrf.csrf_protect) annotation on this particular view.
1885
+
1886
+
1887
+ See more information [here](https://docs.djangoproject.com/en/5.1/howto/csrf/).`
1888
+ };
1889
+
1876
1890
  // src/features/analysis/scm/shared/src/storedFixData/javascript/hardcodedSecrets.ts
1877
1891
  var hardcodedSecrets = {
1878
1892
  guidance: ({ questions }) => {
@@ -1907,7 +1921,8 @@ var vulnerabilities3 = {
1907
1921
  ["SSRF" /* Ssrf */]: ssrf,
1908
1922
  ["HARDCODED_SECRETS" /* HardcodedSecrets */]: hardcodedSecrets,
1909
1923
  ["PASSWORD_IN_COMMENT" /* PasswordInComment */]: passwordInComment,
1910
- ["NO_LIMITS_OR_THROTTLING" /* NoLimitsOrThrottling */]: noLimitsOrThrottling
1924
+ ["NO_LIMITS_OR_THROTTLING" /* NoLimitsOrThrottling */]: noLimitsOrThrottling,
1925
+ ["CSRF" /* Csrf */]: csrf
1911
1926
  };
1912
1927
  var javascript_default = vulnerabilities3;
1913
1928
 
@@ -1936,7 +1951,8 @@ See more information [here](https://jinja.palletsprojects.com/en/3.1.x/templates
1936
1951
 
1937
1952
  // src/features/analysis/scm/shared/src/storedFixData/python/index.ts
1938
1953
  var vulnerabilities5 = {
1939
- ["AUTO_ESCAPE_FALSE" /* AutoEscapeFalse */]: autoEscapeFalse
1954
+ ["AUTO_ESCAPE_FALSE" /* AutoEscapeFalse */]: autoEscapeFalse,
1955
+ ["CSRF" /* Csrf */]: csrf
1940
1956
  };
1941
1957
  var python_default = vulnerabilities5;
1942
1958
 
@@ -2740,6 +2756,15 @@ var vulnerabilities9 = {
2740
2756
  };
2741
2757
  var java_default2 = vulnerabilities9;
2742
2758
 
2759
+ // src/features/analysis/scm/shared/src/storedQuestionData/python/csrf.ts
2760
+ var csrf2 = {
2761
+ isPythonDjangoTemplate: {
2762
+ content: () => "Is the reported file Python Django template?",
2763
+ description: () => "",
2764
+ guidance: () => ""
2765
+ }
2766
+ };
2767
+
2743
2768
  // src/features/analysis/scm/shared/src/storedQuestionData/js/commandInjection.ts
2744
2769
  var commandInjection2 = {
2745
2770
  isCommandExecutable: {
@@ -3046,10 +3071,44 @@ var vulnerabilities10 = {
3046
3071
  ["UNCHECKED_LOOP_CONDITION" /* UncheckedLoopCondition */]: uncheckedLoopCondition2,
3047
3072
  ["NO_LIMITS_OR_THROTTLING" /* NoLimitsOrThrottling */]: noLimitsOrThrottling2,
3048
3073
  ["MISSING_CSP_HEADER" /* MissingCspHeader */]: cspHeaderValue,
3049
- ["HARDCODED_DOMAIN_IN_HTML" /* HardcodedDomainInHtml */]: hardcodedDomainInHtml
3074
+ ["HARDCODED_DOMAIN_IN_HTML" /* HardcodedDomainInHtml */]: hardcodedDomainInHtml,
3075
+ ["CSRF" /* Csrf */]: csrf2
3050
3076
  };
3051
3077
  var js_default = vulnerabilities10;
3052
3078
 
3079
+ // src/features/analysis/scm/shared/src/storedQuestionData/python/logForging.ts
3080
+ var logForging4 = {
3081
+ isHtmlDisplay: {
3082
+ content: () => "Is the text written to the log going to be displayed as HTML?",
3083
+ description: () => "",
3084
+ guidance: ({ userInputValue }) => {
3085
+ switch (userInputValue) {
3086
+ case "yes":
3087
+ return "We use `html.escape` to decode the HTML";
3088
+ default:
3089
+ return "";
3090
+ }
3091
+ }
3092
+ }
3093
+ };
3094
+
3095
+ // src/features/analysis/scm/shared/src/storedQuestionData/python/openRedirect.ts
3096
+ var openRedirect2 = {
3097
+ allowed_hosts: {
3098
+ content: () => "Allowed domains/paths",
3099
+ description: () => "If external, provide a coma separated list of allowed domains. If internal, provide a coma seperated list of allowed paths",
3100
+ guidance: () => ""
3101
+ }
3102
+ };
3103
+
3104
+ // src/features/analysis/scm/shared/src/storedQuestionData/python/index.ts
3105
+ var vulnerabilities11 = {
3106
+ ["CSRF" /* Csrf */]: csrf2,
3107
+ ["LOG_FORGING" /* LogForging */]: logForging4,
3108
+ ["LOG_FORGING" /* LogForging */]: openRedirect2
3109
+ };
3110
+ var python_default2 = vulnerabilities11;
3111
+
3053
3112
  // src/features/analysis/scm/shared/src/storedQuestionData/xml/unboundedOccurrences.ts
3054
3113
  var unboundedOccurrences = {
3055
3114
  maxOccursLimit: {
@@ -3062,10 +3121,10 @@ A value too high will cause performance issues up to and including denial of ser
3062
3121
  };
3063
3122
 
3064
3123
  // src/features/analysis/scm/shared/src/storedQuestionData/xml/index.ts
3065
- var vulnerabilities11 = {
3124
+ var vulnerabilities12 = {
3066
3125
  ["WEAK_XML_SCHEMA_UNBOUNDED_OCCURRENCES" /* WeakXmlSchemaUnboundedOccurrences */]: unboundedOccurrences
3067
3126
  };
3068
- var xml_default2 = vulnerabilities11;
3127
+ var xml_default2 = vulnerabilities12;
3069
3128
 
3070
3129
  // src/features/analysis/scm/shared/src/storedQuestionData/index.ts
3071
3130
  var StoredQuestionDataItemZ = z7.object({
@@ -3077,7 +3136,8 @@ var languages2 = {
3077
3136
  ["Java" /* Java */]: java_default2,
3078
3137
  ["JavaScript" /* JavaScript */]: js_default,
3079
3138
  ["XML" /* Xml */]: xml_default2,
3080
- ["CSharp" /* CSharp */]: csharp_default2
3139
+ ["CSharp" /* CSharp */]: csharp_default2,
3140
+ ["Python" /* Python */]: python_default2
3081
3141
  };
3082
3142
  var storedQuestionData_default = languages2;
3083
3143
 
@@ -3205,6 +3265,8 @@ function getGuidances(args) {
3205
3265
 
3206
3266
  // src/features/analysis/scm/shared/src/urlParser/urlParser.ts
3207
3267
  import { z as z9 } from "zod";
3268
+ var ADO_PREFIX_PATH = "tfs";
3269
+ var NAME_REGEX = /[a-z0-9\-_.+]+/i;
3208
3270
  function detectAdoUrl(args) {
3209
3271
  const { pathname, hostname, scmType } = args;
3210
3272
  const hostnameParts = hostname.split(".");
@@ -3373,10 +3435,6 @@ function getFixUrl({
3373
3435
  return `${appBaseUrl}/organization/${organizationId}/project/${projectId}/report/${analysisId}/fix/${fixId}`;
3374
3436
  }
3375
3437
 
3376
- // src/features/analysis/scm/shared/src/index.ts
3377
- var NAME_REGEX = /[a-z0-9\-_.+]+/i;
3378
- var ADO_PREFIX_PATH = "tfs";
3379
-
3380
3438
  // src/features/analysis/scm/types.ts
3381
3439
  var ReferenceType = /* @__PURE__ */ ((ReferenceType2) => {
3382
3440
  ReferenceType2["BRANCH"] = "BRANCH";
@@ -6959,7 +7017,7 @@ async function addFixCommentsForPr({
6959
7017
  import Debug8 from "debug";
6960
7018
  var debug8 = Debug8("mobbdev:handleAutoPr");
6961
7019
  async function handleAutoPr(params) {
6962
- const { gqlClient, analysisId, createSpinner: createSpinner5 } = params;
7020
+ const { gqlClient, analysisId, commitDirectly, createSpinner: createSpinner5 } = params;
6963
7021
  const createAutoPrSpinner = createSpinner5(
6964
7022
  "\u{1F504} Waiting for the analysis to finish before initiating automatic pull request creation"
6965
7023
  ).start();
@@ -6968,7 +7026,10 @@ async function handleAutoPr(params) {
6968
7026
  analysisId
6969
7027
  },
6970
7028
  callback: async (analysisId2) => {
6971
- const autoPrAnalysisRes = await gqlClient.autoPrAnalysis(analysisId2);
7029
+ const autoPrAnalysisRes = await gqlClient.autoPrAnalysis(
7030
+ analysisId2,
7031
+ commitDirectly
7032
+ );
6972
7033
  debug8("auto pr analysis res %o", autoPrAnalysisRes);
6973
7034
  if (autoPrAnalysisRes.autoPrAnalysis?.__typename === "AutoPrError") {
6974
7035
  createAutoPrSpinner.error({
@@ -7424,9 +7485,10 @@ var GQLClient = class {
7424
7485
  }
7425
7486
  return res.analysis;
7426
7487
  }
7427
- async autoPrAnalysis(analysisId) {
7488
+ async autoPrAnalysis(analysisId, commitDirectly) {
7428
7489
  return this._clientSdk.autoPrAnalysis({
7429
- analysisId
7490
+ analysisId,
7491
+ commitDirectly
7430
7492
  });
7431
7493
  }
7432
7494
  async getFixes(fixIds) {
@@ -8050,7 +8112,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
8050
8112
  githubToken: githubActionToken,
8051
8113
  command,
8052
8114
  organizationId: userOrganizationId,
8053
- autoPr
8115
+ autoPr,
8116
+ commitDirectly
8054
8117
  } = params;
8055
8118
  debug15("start %s %s", dirname, repo);
8056
8119
  const { createSpinner: createSpinner5 } = Spinner2({ ci });
@@ -8189,6 +8252,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
8189
8252
  await handleAutoPr({
8190
8253
  gqlClient,
8191
8254
  analysisId: reportUploadInfo.fixReportId,
8255
+ commitDirectly,
8192
8256
  createSpinner: createSpinner5
8193
8257
  });
8194
8258
  }
@@ -8354,6 +8418,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
8354
8418
  await handleAutoPr({
8355
8419
  gqlClient,
8356
8420
  analysisId: reportUploadInfo.fixReportId,
8421
+ commitDirectly,
8357
8422
  createSpinner: createSpinner5
8358
8423
  });
8359
8424
  }
@@ -8459,7 +8524,8 @@ async function analyze({
8459
8524
  srcPath,
8460
8525
  mobbProjectName,
8461
8526
  organizationId,
8462
- autoPr
8527
+ autoPr,
8528
+ commitDirectly
8463
8529
  }, { skipPrompts = false } = {}) {
8464
8530
  !ci && await showWelcomeMessage(skipPrompts);
8465
8531
  await runAnalysis(
@@ -8474,7 +8540,8 @@ async function analyze({
8474
8540
  srcPath,
8475
8541
  organizationId,
8476
8542
  command: "analyze",
8477
- autoPr
8543
+ autoPr,
8544
+ commitDirectly
8478
8545
  },
8479
8546
  { skipPrompts }
8480
8547
  );
@@ -8675,6 +8742,13 @@ var autoPrOption = {
8675
8742
  type: "boolean",
8676
8743
  default: false
8677
8744
  };
8745
+ var commitDirectlyOption = {
8746
+ describe: chalk6.bold(
8747
+ "Commit directly to the scanned branch instead of creating a pull request"
8748
+ ),
8749
+ type: "boolean",
8750
+ default: false
8751
+ };
8678
8752
  var scmTypeOption = {
8679
8753
  demandOption: true,
8680
8754
  describe: chalk6.bold("SCM type"),
@@ -8779,7 +8853,7 @@ function analyzeBuilder(yargs2) {
8779
8853
  alias: "commit-hash",
8780
8854
  describe: chalk8.bold("Hash of the commit"),
8781
8855
  type: "string"
8782
- }).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(
8856
+ }).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).example(
8783
8857
  "npx mobbdev@latest analyze -r https://github.com/WebGoat/WebGoat -f <your_vulnerability_report_path>",
8784
8858
  "analyze an existing repository"
8785
8859
  ).help();
@@ -8799,6 +8873,11 @@ Can't access ${chalk8.bold(argv.f)}`);
8799
8873
  if (argv.ci && !argv.apiKey) {
8800
8874
  throw new CliError("--ci flag requires --api-key to be provided as well");
8801
8875
  }
8876
+ if (argv.commitDirectly && !argv["auto-pr"]) {
8877
+ throw new CliError(
8878
+ "--commit-directly flag requires --auto-pr to be provided as well"
8879
+ );
8880
+ }
8802
8881
  validateReportFileFormat(argv.f);
8803
8882
  }
8804
8883
  async function analyzeHandler(args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
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",
@@ -29,9 +29,9 @@
29
29
  "author": "",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@gitbeaker/core": "41.3.0",
33
- "@gitbeaker/requester-utils": "41.3.0",
34
- "@gitbeaker/rest": "41.3.0",
32
+ "@gitbeaker/core": "42.0.2",
33
+ "@gitbeaker/requester-utils": "42.0.2",
34
+ "@gitbeaker/rest": "42.0.2",
35
35
  "@octokit/core": "5.2.0",
36
36
  "@octokit/graphql": "5.0.6",
37
37
  "@octokit/plugin-rest-endpoint-methods": "7.2.3",
@@ -51,7 +51,7 @@
51
51
  "graphql": "16.10.0",
52
52
  "graphql-request": "6.1.0",
53
53
  "graphql-tag": "2.12.6",
54
- "graphql-ws": "5.16.0",
54
+ "graphql-ws": "5.16.2",
55
55
  "inquirer": "9.2.23",
56
56
  "isomorphic-ws": "5.0.0",
57
57
  "istextorbinary": "6.0.0",
@@ -63,7 +63,7 @@
63
63
  "parse-diff": "0.11.1",
64
64
  "semver": "7.6.3",
65
65
  "simple-git": "3.27.0",
66
- "snyk": "1.1294.3",
66
+ "snyk": "1.1295.0",
67
67
  "supports-color": "9.4.0",
68
68
  "tar": "6.2.1",
69
69
  "tmp": "0.2.3",
@@ -79,7 +79,7 @@
79
79
  "@graphql-codegen/typescript-graphql-request": "6.2.0",
80
80
  "@graphql-codegen/typescript-operations": "4.4.0",
81
81
  "@octokit/request-error": "3.0.3",
82
- "@octokit/types": "13.6.2",
82
+ "@octokit/types": "13.7.0",
83
83
  "@types/adm-zip": "0.5.7",
84
84
  "@types/chalk-animation": "1.6.3",
85
85
  "@types/configstore": "6.0.2",
@@ -97,7 +97,7 @@
97
97
  "@vitest/ui": "2.1.8",
98
98
  "eslint": "8.57.0",
99
99
  "eslint-plugin-import": "2.31.0",
100
- "eslint-plugin-prettier": "5.2.1",
100
+ "eslint-plugin-prettier": "5.2.2",
101
101
  "eslint-plugin-simple-import-sort": "10.0.0",
102
102
  "prettier": "3.4.2",
103
103
  "tsup": "7.2.0",