mobbdev 0.0.186 → 0.0.187

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 +40 -32
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -107,6 +107,7 @@ var IssueLanguage_Enum = /* @__PURE__ */ ((IssueLanguage_Enum2) => {
107
107
  })(IssueLanguage_Enum || {});
108
108
  var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
109
109
  IssueType_Enum2["AutoEscapeFalse"] = "AUTO_ESCAPE_FALSE";
110
+ IssueType_Enum2["ClientDomStoredCodeInjection"] = "CLIENT_DOM_STORED_CODE_INJECTION";
110
111
  IssueType_Enum2["CmDi"] = "CMDi";
111
112
  IssueType_Enum2["CmDiRelativePathCommand"] = "CMDi_relative_path_command";
112
113
  IssueType_Enum2["ConfusingNaming"] = "CONFUSING_NAMING";
@@ -732,7 +733,8 @@ var issueTypeMap = {
732
733
  ["AUTO_ESCAPE_FALSE" /* AutoEscapeFalse */]: "Auto-escape False",
733
734
  ["MISSING_CSP_HEADER" /* MissingCspHeader */]: "Missing CSP Header",
734
735
  ["HARDCODED_DOMAIN_IN_HTML" /* HardcodedDomainInHtml */]: "Hardcoded Domain in HTML",
735
- ["HEAP_INSPECTION" /* HeapInspection */]: "Heap Inspection"
736
+ ["HEAP_INSPECTION" /* HeapInspection */]: "Heap Inspection",
737
+ ["CLIENT_DOM_STORED_CODE_INJECTION" /* ClientDomStoredCodeInjection */]: "Client Code Injection"
736
738
  };
737
739
  var issueTypeZ = z.nativeEnum(IssueType_Enum);
738
740
  var getIssueTypeFriendlyString = (issueType) => {
@@ -1679,6 +1681,10 @@ var fixDetailsData = {
1679
1681
  ["HEAP_INSPECTION" /* HeapInspection */]: {
1680
1682
  issueDescription: "All variables stored by the application in unencrypted memory can be read by an attacker. This can lead to the exposure of sensitive information, such as passwords, credit card numbers, and personal data.",
1681
1683
  fixInstructions: "Use secure storage methods to store secrets in memory."
1684
+ },
1685
+ ["CLIENT_DOM_STORED_CODE_INJECTION" /* ClientDomStoredCodeInjection */]: {
1686
+ issueDescription: "Client DOM Stored Code Injection is a client-side security vulnerability where malicious JavaScript code gets stored in the DOM and later executed when retrieved by legitimate scripts.",
1687
+ fixInstructions: "Update the code to avoid the possibility for malicious JavaScript code to get stored in the DOM."
1682
1688
  }
1683
1689
  };
1684
1690
 
@@ -3359,22 +3365,6 @@ var isUrlHasPath = (url) => {
3359
3365
  function shouldValidateUrl(repoUrl) {
3360
3366
  return repoUrl && isUrlHasPath(repoUrl);
3361
3367
  }
3362
- var sanityRepoURL = (scmURL) => {
3363
- try {
3364
- const url = new URL(scmURL);
3365
- const projectPath = url.pathname.substring(1).replace(/.git$/i, "");
3366
- const pathParts = projectPath.split("/");
3367
- if (pathParts.length < 2)
3368
- return false;
3369
- if (pathParts.length > 4 && pathParts.at(0) !== ADO_PREFIX_PATH)
3370
- return false;
3371
- if (pathParts.some((part) => !part.match(NAME_REGEX)))
3372
- return false;
3373
- return true;
3374
- } catch (e) {
3375
- return null;
3376
- }
3377
- };
3378
3368
 
3379
3369
  // src/features/analysis/scm/bitbucket/validation.ts
3380
3370
  import { z as z11 } from "zod";
@@ -4963,16 +4953,33 @@ var AdoSCMLib = class extends SCMLib {
4963
4953
  }
4964
4954
  async createSubmitRequest(params) {
4965
4955
  this._validateAccessTokenAndUrl();
4966
- const { targetBranchName, sourceBranchName, title, body } = params;
4967
- const adoSdk = await this.getAdoSdk();
4968
- const pullRequestId = await adoSdk.createAdoPullRequest({
4969
- title,
4970
- body,
4971
- targetBranchName,
4972
- sourceBranchName,
4973
- repoUrl: this.url
4974
- });
4975
- return String(pullRequestId);
4956
+ for (let i = 0; i < 5; i++) {
4957
+ try {
4958
+ const { targetBranchName, sourceBranchName, title, body } = params;
4959
+ const adoSdk = await this.getAdoSdk();
4960
+ const pullRequestId = await adoSdk.createAdoPullRequest({
4961
+ title,
4962
+ body,
4963
+ targetBranchName,
4964
+ sourceBranchName,
4965
+ repoUrl: this.url
4966
+ });
4967
+ return String(pullRequestId);
4968
+ } catch (e) {
4969
+ console.warn(
4970
+ `error creating pull request for ADO. Try number ${i + 1}`,
4971
+ e
4972
+ );
4973
+ await setTimeout3(1e3);
4974
+ if (4 === i) {
4975
+ console.error("error creating pull request for ADO", e);
4976
+ throw e;
4977
+ }
4978
+ }
4979
+ }
4980
+ throw new Error(
4981
+ "error creating pull request for ADO, should not reach here"
4982
+ );
4976
4983
  }
4977
4984
  async validateParams() {
4978
4985
  return adoValidateParams({
@@ -5600,15 +5607,18 @@ var BitbucketSCMLib = class extends SCMLib {
5600
5607
  });
5601
5608
  return String(z16.number().parse(pullRequestRes.id));
5602
5609
  } catch (e) {
5603
- console.warn(`error creating pull request. Try number ${i + 1}`, e);
5610
+ console.warn(
5611
+ `error creating pull request for BB. Try number ${i + 1}`,
5612
+ e
5613
+ );
5604
5614
  await setTimeout3(1e3);
5605
5615
  if (4 === i) {
5606
- console.error("error creating pull request", e);
5616
+ console.error("error creating pull request for BB", e);
5607
5617
  throw e;
5608
5618
  }
5609
5619
  }
5610
5620
  }
5611
- throw new Error("error creating pull request, should not reach here");
5621
+ throw new Error("error creating pull request for BB, should not reach here");
5612
5622
  }
5613
5623
  async validateParams() {
5614
5624
  return validateBitbucketParams({
@@ -8483,8 +8493,6 @@ Example:
8483
8493
  }
8484
8494
  var UrlZ = z23.string({
8485
8495
  invalid_type_error: `is not a valid ${Object.values(ScmType).join("/ ")} URL`
8486
- }).refine((data) => !!sanityRepoURL(data), {
8487
- message: `is not a valid ${Object.values(ScmType).join(" / ")} URL`
8488
8496
  });
8489
8497
  function validateOrganizationId(organizationId) {
8490
8498
  const orgIdValidation = z23.string().uuid().nullish().safeParse(organizationId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "0.0.186",
3
+ "version": "0.0.187",
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",