mobbdev 1.0.59 → 1.0.61

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 +19 -29
  2. package/package.json +20 -19
package/dist/index.mjs CHANGED
@@ -4,10 +4,7 @@ var __export = (target, all) => {
4
4
  for (var name in all)
5
5
  __defProp(target, name, { get: all[name], enumerable: true });
6
6
  };
7
- var __publicField = (obj, key, value) => {
8
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
9
- return value;
10
- };
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
8
 
12
9
  // src/index.ts
13
10
  import { hideBin } from "yargs/helpers";
@@ -414,7 +411,7 @@ var GetVulByNodesMetadataDocument = `
414
411
  path
415
412
  startLine
416
413
  vulnerabilityReportIssue {
417
- parsedIssueType
414
+ safeIssueType
418
415
  fixId
419
416
  category
420
417
  vulnerabilityReportIssueTags {
@@ -450,7 +447,7 @@ var GetVulByNodesMetadataDocument = `
450
447
  where: {fixId: {_is_null: true}, _or: [{category: {_eq: "Irrelevant"}}, {category: {_eq: "FalsePositive"}}]}
451
448
  ) {
452
449
  id
453
- parsedIssueType
450
+ safeIssueType
454
451
  fixId
455
452
  category
456
453
  vulnerabilityReportIssueTags {
@@ -1717,8 +1714,7 @@ import {
1717
1714
  createSpinner as _createSpinner
1718
1715
  } from "nanospinner";
1719
1716
  function printToStdError(opts) {
1720
- if (opts?.text)
1721
- console.error(opts.text);
1717
+ if (opts?.text) console.error(opts.text);
1722
1718
  }
1723
1719
  var mockSpinner = {
1724
1720
  success: (opts) => {
@@ -2090,8 +2086,7 @@ function capitalizeFirstLetter(str) {
2090
2086
  return str?.length ? str[0].toUpperCase() + str.slice(1) : "";
2091
2087
  }
2092
2088
  function lowercaseFirstLetter(str) {
2093
- if (!str)
2094
- return str;
2089
+ if (!str) return str;
2095
2090
  return `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
2096
2091
  }
2097
2092
  var severityToEmoji = {
@@ -3839,11 +3834,9 @@ var parseScmURL = (scmURL, scmType) => {
3839
3834
  hostname,
3840
3835
  scmType
3841
3836
  });
3842
- if (!repo)
3843
- return null;
3837
+ if (!repo) return null;
3844
3838
  const { organization, repoName } = repo;
3845
- if (!organization || !repoName)
3846
- return null;
3839
+ if (!organization || !repoName) return null;
3847
3840
  if (!organization.match(NAME_REGEX) || !repoName.match(NAME_REGEX))
3848
3841
  return null;
3849
3842
  const res = {
@@ -5659,6 +5652,7 @@ import {
5659
5652
  createRequesterFn
5660
5653
  } from "@gitbeaker/requester-utils";
5661
5654
  import {
5655
+ AccessLevel,
5662
5656
  Gitlab
5663
5657
  } from "@gitbeaker/rest";
5664
5658
  import Debug4 from "debug";
@@ -5745,7 +5739,6 @@ async function getGitlabUsername(url, accessToken) {
5745
5739
  return res.username;
5746
5740
  }
5747
5741
  async function getGitlabIsUserCollaborator({
5748
- username,
5749
5742
  accessToken,
5750
5743
  repoUrl
5751
5744
  }) {
@@ -5753,13 +5746,12 @@ async function getGitlabIsUserCollaborator({
5753
5746
  const { projectPath } = parseGitlabOwnerAndRepo(repoUrl);
5754
5747
  const api2 = getGitBeaker({ url: repoUrl, gitlabAuthToken: accessToken });
5755
5748
  const res = await api2.Projects.show(projectPath);
5756
- const members = await api2.ProjectMembers.all(res.id, {
5757
- includeInherited: true
5758
- });
5759
- if (!username) {
5749
+ const groupAccess = res.permissions?.group_access?.access_level || 0;
5750
+ const projectAccess = res.permissions?.project_access?.access_level || 0;
5751
+ if (groupAccess >= AccessLevel.DEVELOPER || projectAccess >= AccessLevel.DEVELOPER) {
5760
5752
  return true;
5761
5753
  }
5762
- return !!members.find((member) => member.username === username);
5754
+ return false;
5763
5755
  } catch (e) {
5764
5756
  return false;
5765
5757
  }
@@ -6004,8 +5996,7 @@ async function processBody(response) {
6004
5996
  async function brokerRequestHandler(endpoint, options) {
6005
5997
  const { prefixUrl, searchParams } = options || {};
6006
5998
  let baseUrl;
6007
- if (prefixUrl)
6008
- baseUrl = prefixUrl.endsWith("/") ? prefixUrl : `${prefixUrl}/`;
5999
+ if (prefixUrl) baseUrl = prefixUrl.endsWith("/") ? prefixUrl : `${prefixUrl}/`;
6009
6000
  const url = new URL(endpoint, baseUrl);
6010
6001
  url.search = searchParams || "";
6011
6002
  const dispatcher = url && isBrokerUrl(url.href) ? new ProxyAgent({
@@ -7332,7 +7323,7 @@ async function postIssueComment(params) {
7332
7323
  vulnerabilityReportIssue: {
7333
7324
  vulnerabilityReportIssueTags,
7334
7325
  category,
7335
- parsedIssueType
7326
+ safeIssueType
7336
7327
  },
7337
7328
  vulnerabilityReportIssueId
7338
7329
  } = vulnerabilityReportIssueCodeNode;
@@ -7348,7 +7339,7 @@ Refresh the page in order to see the changes.`,
7348
7339
  const commentId = commentRes.data.id;
7349
7340
  const commentBody = buildIssueCommentBody({
7350
7341
  issueId: vulnerabilityReportIssueId,
7351
- issueType: parsedIssueType,
7342
+ issueType: safeIssueType,
7352
7343
  irrelevantIssueWithTags,
7353
7344
  commentId,
7354
7345
  commentUrl: commentRes.data.html_url,
@@ -7617,7 +7608,7 @@ async function addFixCommentsForPr({
7617
7608
  startLine: vulnerabilityReportIssueCodeNode.startLine,
7618
7609
  vulnerabilityReportIssue: {
7619
7610
  fixId: "",
7620
- parsedIssueType: vulnerabilityReportIssue.parsedIssueType,
7611
+ safeIssueType: vulnerabilityReportIssue.safeIssueType,
7621
7612
  vulnerabilityReportIssueTags: vulnerabilityReportIssue.vulnerabilityReportIssueTags,
7622
7613
  category: vulnerabilityReportIssue.category
7623
7614
  },
@@ -7841,7 +7832,7 @@ var VulnerabilityReportIssueCodeNodeZ = z27.object({
7841
7832
  vulnerabilityReportIssue: z27.object({
7842
7833
  fixId: z27.string(),
7843
7834
  category: ValidCategoriesZ,
7844
- parsedIssueType: z27.string(),
7835
+ safeIssueType: z27.string(),
7845
7836
  vulnerabilityReportIssueTags: z27.array(
7846
7837
  z27.object({
7847
7838
  tag: z27.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
@@ -7855,7 +7846,7 @@ var VulnerabilityReportIssueNoFixCodeNodeZ = z27.object({
7855
7846
  id: z27.string(),
7856
7847
  fixId: z27.string().nullable(),
7857
7848
  category: ValidCategoriesZ,
7858
- parsedIssueType: z27.string(),
7849
+ safeIssueType: z27.string(),
7859
7850
  codeNodes: z27.array(
7860
7851
  z27.object({
7861
7852
  path: z27.string(),
@@ -8630,8 +8621,7 @@ async function uploadFile({
8630
8621
  // src/features/analysis/index.ts
8631
8622
  var { CliError: CliError2, Spinner: Spinner2 } = utils_exports;
8632
8623
  function _getScanSource(command, ci) {
8633
- if (command === "review")
8634
- return "AUTO_FIXER" /* AutoFixer */;
8624
+ if (command === "review") return "AUTO_FIXER" /* AutoFixer */;
8635
8625
  const envToCi = [
8636
8626
  ["GITLAB_CI", "CI_GITLAB" /* CiGitlab */],
8637
8627
  ["GITHUB_ACTIONS", "CI_GITHUB" /* CiGithub */],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
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",
@@ -16,6 +16,7 @@
16
16
  "test:github": "GIT_PROXY_HOST=http://tinyproxy:8888 TOKEN=$(../../scripts/login_auth0.sh) vitest run github.test",
17
17
  "test:coverage": "GIT_PROXY_HOST=http://tinyproxy:8888 TOKEN=$(../../scripts/login_auth0.sh) vitest run --coverage",
18
18
  "test:watch": "TOKEN=$(../../scripts/login_auth0.sh) vitest",
19
+ "test:integration": "GIT_PROXY_HOST=http://tinyproxy:8888 TOKEN=$(../../scripts/login_auth0.sh) vitest watch integration.test",
19
20
  "lint": "eslint --cache --max-warnings 0 --ignore-path .eslintignore --ext .ts,.tsx,.jsx .",
20
21
  "lint:fix": "eslint --fix --cache --max-warnings 0 --ignore-path .eslintignore --ext .js,.ts,.tsx,.jsx .",
21
22
  "lint:fix:files": "eslint --fix --cache --max-warnings 0 --ignore-path .eslintignore --ext .js,.ts,.tsx,.jsx",
@@ -29,16 +30,16 @@
29
30
  "author": "",
30
31
  "license": "MIT",
31
32
  "dependencies": {
32
- "@gitbeaker/core": "42.1.0",
33
- "@gitbeaker/requester-utils": "42.1.0",
34
- "@gitbeaker/rest": "42.1.0",
33
+ "@gitbeaker/core": "42.2.0",
34
+ "@gitbeaker/requester-utils": "42.2.0",
35
+ "@gitbeaker/rest": "42.2.0",
35
36
  "@octokit/core": "5.2.0",
36
37
  "@octokit/graphql": "5.0.6",
37
38
  "@octokit/plugin-rest-endpoint-methods": "7.2.3",
38
39
  "@octokit/request-error": "5.1.1",
39
40
  "@types/libsodium-wrappers": "0.7.14",
40
41
  "adm-zip": "0.5.16",
41
- "axios": "1.8.2",
42
+ "axios": "1.8.4",
42
43
  "azure-devops-node-api": "12.1.0",
43
44
  "bitbucket": "2.11.0",
44
45
  "chalk": "5.4.1",
@@ -63,48 +64,48 @@
63
64
  "parse-diff": "0.11.1",
64
65
  "semver": "7.7.1",
65
66
  "simple-git": "3.27.0",
66
- "snyk": "1.1295.3",
67
+ "snyk": "1.1296.1",
67
68
  "supports-color": "10.0.0",
68
69
  "tar": "6.2.1",
69
70
  "tmp": "0.2.3",
70
71
  "undici": "6.21.1",
71
72
  "uuid": "11.1.0",
72
- "ws": "8.18.0",
73
+ "ws": "8.18.1",
73
74
  "xml2js": "0.6.2",
74
75
  "yargs": "17.7.2",
75
76
  "zod": "3.24.2"
76
77
  },
77
78
  "devDependencies": {
78
79
  "@graphql-codegen/cli": "5.0.5",
79
- "@graphql-codegen/typescript": "4.1.4",
80
+ "@graphql-codegen/typescript": "4.1.6",
80
81
  "@graphql-codegen/typescript-graphql-request": "6.2.0",
81
- "@graphql-codegen/typescript-operations": "4.5.0",
82
- "@octokit/types": "13.8.0",
82
+ "@graphql-codegen/typescript-operations": "4.6.0",
83
+ "@octokit/types": "13.10.0",
83
84
  "@types/adm-zip": "0.5.7",
84
85
  "@types/chalk-animation": "1.6.3",
85
86
  "@types/configstore": "6.0.2",
86
87
  "@types/debug": "4.1.12",
87
88
  "@types/inquirer": "9.0.7",
88
- "@types/semver": "7.5.8",
89
+ "@types/semver": "7.7.0",
89
90
  "@types/tar": "6.1.13",
90
91
  "@types/tmp": "0.2.6",
91
92
  "@types/uuid": "10.0.0",
92
- "@types/ws": "8.5.14",
93
+ "@types/ws": "8.18.1",
93
94
  "@types/xml2js": "0.4.14",
94
95
  "@types/yargs": "17.0.33",
95
96
  "@typescript-eslint/eslint-plugin": "7.17.0",
96
97
  "@typescript-eslint/parser": "7.17.0",
97
- "@vitest/coverage-istanbul": "3.0.6",
98
- "@vitest/ui": "3.0.6",
98
+ "@vitest/coverage-istanbul": "3.1.1",
99
+ "@vitest/ui": "3.1.1",
99
100
  "eslint": "8.57.0",
100
101
  "eslint-plugin-import": "2.31.0",
101
- "eslint-plugin-prettier": "5.2.3",
102
+ "eslint-plugin-prettier": "5.2.6",
102
103
  "eslint-plugin-simple-import-sort": "10.0.0",
103
- "nock": "14.0.1",
104
- "prettier": "3.5.1",
105
- "tsup": "7.2.0",
104
+ "nock": "14.0.3",
105
+ "prettier": "3.5.3",
106
+ "tsup": "8.4.0",
106
107
  "typescript": "4.9.5",
107
- "vitest": "3.0.6"
108
+ "vitest": "3.1.1"
108
109
  },
109
110
  "engines": {
110
111
  "node": ">=18.20.4"