mobbdev 1.4.21 → 1.4.22

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.
@@ -417,6 +417,7 @@ var init_client_generates = __esm({
417
417
  return Vulnerability_Report_Issue_State_Enum2;
418
418
  })(Vulnerability_Report_Issue_State_Enum || {});
419
419
  Vulnerability_Report_Issue_Tag_Enum = /* @__PURE__ */ ((Vulnerability_Report_Issue_Tag_Enum3) => {
420
+ Vulnerability_Report_Issue_Tag_Enum3["AgenticRemediationInProgress"] = "AGENTIC_REMEDIATION_IN_PROGRESS";
420
421
  Vulnerability_Report_Issue_Tag_Enum3["AutogeneratedCode"] = "AUTOGENERATED_CODE";
421
422
  Vulnerability_Report_Issue_Tag_Enum3["AuxiliaryCode"] = "AUXILIARY_CODE";
422
423
  Vulnerability_Report_Issue_Tag_Enum3["FalsePositive"] = "FALSE_POSITIVE";
@@ -1926,7 +1927,8 @@ var init_getIssueType = __esm({
1926
1927
  ["TEST_CODE" /* TestCode */]: "The flagged code resides in a test-specific path or context. This categorization indicates that **it supports testing scenarios and is isolated from production use**.",
1927
1928
  ["UNFIXABLE" /* Unfixable */]: "The flagged code cannot be fixed",
1928
1929
  ["VENDOR_CODE" /* VendorCode */]: "The flagged code originates from a third-party library or dependency maintained externally. This categorization suggests that **the issue lies outside the application's direct control** and should be addressed by the vendor if necessary.",
1929
- ["SUPPRESSED" /* Suppressed */]: "Suppressed in the scan report."
1930
+ ["SUPPRESSED" /* Suppressed */]: "Suppressed in the scan report.",
1931
+ ["AGENTIC_REMEDIATION_IN_PROGRESS" /* AgenticRemediationInProgress */]: "Mobb is currently retrying remediation on this issue. The state will refresh automatically once the run finishes."
1930
1932
  };
1931
1933
  }
1932
1934
  });
@@ -4352,7 +4354,7 @@ import z27 from "zod";
4352
4354
 
4353
4355
  // src/commands/handleMobbLogin.ts
4354
4356
  import chalk2 from "chalk";
4355
- import Debug10 from "debug";
4357
+ import Debug11 from "debug";
4356
4358
 
4357
4359
  // src/utils/dirname.ts
4358
4360
  import fs from "fs";
@@ -4493,7 +4495,7 @@ var CliError = class extends Error {
4493
4495
  // src/commands/AuthManager.ts
4494
4496
  import crypto from "crypto";
4495
4497
  import os from "os";
4496
- import Debug9 from "debug";
4498
+ import Debug10 from "debug";
4497
4499
  import open from "open";
4498
4500
 
4499
4501
  // src/constants.ts
@@ -7562,7 +7564,7 @@ var GQLClient = class {
7562
7564
  };
7563
7565
 
7564
7566
  // src/features/analysis/graphql/tracy-batch-upload.ts
7565
- import Debug8 from "debug";
7567
+ import Debug9 from "debug";
7566
7568
 
7567
7569
  // src/utils/sanitize-sensitive-data.ts
7568
7570
  import { OpenRedaction } from "@openredaction/openredaction";
@@ -7738,16 +7740,36 @@ async function sanitizeDataWithCounts(obj, options) {
7738
7740
  // src/utils/with-timeout.ts
7739
7741
  import { setTimeout as delay } from "timers/promises";
7740
7742
 
7743
+ // src/features/analysis/graphql/s3-raw-data-upload.ts
7744
+ import { setTimeout as sleep2 } from "timers/promises";
7745
+ import Debug8 from "debug";
7746
+
7741
7747
  // src/features/analysis/upload-file.ts
7742
7748
  import Debug7 from "debug";
7743
7749
  import fetch3, { File, fileFrom, FormData } from "node-fetch";
7744
7750
  var debug8 = Debug7("mobbdev:upload-file");
7751
+ var S3UploadError = class extends Error {
7752
+ constructor(status, s3Code, s3Message) {
7753
+ super(`Failed to upload the file: ${status}`);
7754
+ this.status = status;
7755
+ this.s3Code = s3Code;
7756
+ this.s3Message = s3Message;
7757
+ this.name = "S3UploadError";
7758
+ }
7759
+ };
7760
+ function parseS3ErrorBody(body) {
7761
+ return {
7762
+ code: body.match(/<Code>([^<]+)<\/Code>/)?.[1],
7763
+ message: body.match(/<Message>([^<]+)<\/Message>/)?.[1]
7764
+ };
7765
+ }
7745
7766
  async function uploadFile({
7746
7767
  file,
7747
7768
  url,
7748
7769
  uploadKey,
7749
7770
  uploadFields,
7750
- logger
7771
+ logger,
7772
+ signal
7751
7773
  }) {
7752
7774
  const logInfo = logger || ((_message, _data) => {
7753
7775
  });
@@ -7769,25 +7791,55 @@ async function uploadFile({
7769
7791
  } else {
7770
7792
  debug8("upload file from buffer");
7771
7793
  logInfo(`FileUpload: upload file from buffer`);
7772
- form.append("file", new File([new Uint8Array(file)], "file"));
7794
+ form.append(
7795
+ "file",
7796
+ new File(
7797
+ [
7798
+ new Uint8Array(
7799
+ file.buffer,
7800
+ file.byteOffset,
7801
+ file.byteLength
7802
+ )
7803
+ ],
7804
+ "file"
7805
+ )
7806
+ );
7773
7807
  }
7774
7808
  const agent = getProxyAgent(url);
7775
7809
  const response = await fetch3(url, {
7776
7810
  method: "POST",
7777
7811
  body: form,
7778
- agent
7812
+ agent,
7813
+ signal
7779
7814
  });
7780
7815
  if (!response.ok) {
7781
- debug8("error from S3 %s %s", response.body, response.status);
7782
- logInfo(`FileUpload: error from S3 ${response.body} ${response.status}`);
7783
- throw new Error(`Failed to upload the file: ${response.status}`);
7816
+ let bodyText = "";
7817
+ try {
7818
+ bodyText = await response.text();
7819
+ } catch {
7820
+ }
7821
+ const { code, message } = parseS3ErrorBody(bodyText);
7822
+ debug8(
7823
+ "error from S3 status=%d code=%s message=%s",
7824
+ response.status,
7825
+ code,
7826
+ message
7827
+ );
7828
+ logInfo(
7829
+ `FileUpload: error from S3 status=${response.status} code=${code ?? "unknown"}`
7830
+ );
7831
+ throw new S3UploadError(response.status, code, message);
7784
7832
  }
7785
7833
  debug8("upload file done");
7786
7834
  logInfo(`FileUpload: upload file done`);
7787
7835
  }
7788
7836
 
7837
+ // src/features/analysis/graphql/s3-raw-data-upload.ts
7838
+ var debug9 = Debug8("mobbdev:tracy-s3-upload");
7839
+ var URL_REFRESH_MS = 20 * 60 * 1e3;
7840
+
7789
7841
  // src/features/analysis/graphql/tracy-batch-upload.ts
7790
- var debug9 = Debug8("mobbdev:tracy-batch-upload");
7842
+ var debug10 = Debug9("mobbdev:tracy-batch-upload");
7791
7843
 
7792
7844
  // src/mcp/services/types.ts
7793
7845
  function buildLoginUrl(baseUrl, loginId, hostname, context) {
@@ -7820,7 +7872,7 @@ function createConfigStore(defaultValues = { apiToken: "" }) {
7820
7872
  var configStore = createConfigStore();
7821
7873
 
7822
7874
  // src/commands/AuthManager.ts
7823
- var debug10 = Debug9("mobbdev:auth");
7875
+ var debug11 = Debug10("mobbdev:auth");
7824
7876
  var LOGIN_MAX_WAIT = 2 * 60 * 1e3;
7825
7877
  var LOGIN_CHECK_DELAY = 2 * 1e3;
7826
7878
  var _AuthManager = class _AuthManager {
@@ -7850,7 +7902,7 @@ var _AuthManager = class _AuthManager {
7850
7902
  return false;
7851
7903
  }
7852
7904
  if (_AuthManager.browserCooldownMs > 0 && Date.now() - _AuthManager.lastBrowserOpenTime < _AuthManager.browserCooldownMs) {
7853
- debug10("browser cooldown active, skipping open");
7905
+ debug11("browser cooldown active, skipping open");
7854
7906
  return false;
7855
7907
  }
7856
7908
  open(this.currentBrowserUrl);
@@ -7903,7 +7955,7 @@ var _AuthManager = class _AuthManager {
7903
7955
  const result = await this.checkAuthentication();
7904
7956
  this.authenticated = result.isAuthenticated;
7905
7957
  if (!result.isAuthenticated) {
7906
- debug10("isAuthenticated: false \u2014 %s (%s)", result.message, result.reason);
7958
+ debug11("isAuthenticated: false \u2014 %s (%s)", result.message, result.reason);
7907
7959
  }
7908
7960
  }
7909
7961
  return this.authenticated;
@@ -7991,9 +8043,9 @@ var _AuthManager = class _AuthManager {
7991
8043
  return null;
7992
8044
  } catch (error) {
7993
8045
  if (isTransientError(error)) {
7994
- debug10("getApiToken: transient error, will retry");
8046
+ debug11("getApiToken: transient error, will retry");
7995
8047
  } else {
7996
- debug10("getApiToken: unexpected error: %O", error);
8048
+ debug11("getApiToken: unexpected error: %O", error);
7997
8049
  }
7998
8050
  return null;
7999
8051
  }
@@ -8046,7 +8098,7 @@ __publicField(_AuthManager, "lastBrowserOpenTime", 0);
8046
8098
  var AuthManager = _AuthManager;
8047
8099
 
8048
8100
  // src/commands/handleMobbLogin.ts
8049
- var debug11 = Debug10("mobbdev:commands");
8101
+ var debug12 = Debug11("mobbdev:commands");
8050
8102
  var MOBB_LOGIN_REQUIRED_MSG = `\u{1F513} Login to Mobb is Required, you will be redirected to our login page, once the authorization is complete return to this prompt, ${chalk2.bgBlue(
8051
8103
  "press any key to continue"
8052
8104
  )};`;
@@ -8056,7 +8108,7 @@ async function getAuthenticatedGQLClient({
8056
8108
  apiUrl,
8057
8109
  webAppUrl
8058
8110
  }) {
8059
- debug11(
8111
+ debug12(
8060
8112
  "getAuthenticatedGQLClient called with: apiUrl=%s, webAppUrl=%s",
8061
8113
  apiUrl || "undefined",
8062
8114
  webAppUrl || "undefined"
@@ -8080,7 +8132,7 @@ async function handleMobbLogin({
8080
8132
  loginPath,
8081
8133
  authManager
8082
8134
  }) {
8083
- debug11(
8135
+ debug12(
8084
8136
  "handleMobbLogin: resolved URLs - apiUrl=%s (from param: %s), webAppUrl=%s (from param: %s)",
8085
8137
  apiUrl || "fallback",
8086
8138
  apiUrl || "fallback",
@@ -8096,7 +8148,7 @@ async function handleMobbLogin({
8096
8148
  return authManager.getGQLClient();
8097
8149
  }
8098
8150
  if (authResult.reason === "unknown") {
8099
- debug11("Auth check returned unknown: %s", authResult.message);
8151
+ debug12("Auth check returned unknown: %s", authResult.message);
8100
8152
  throw new CliError(`Cannot verify authentication: ${authResult.message}`);
8101
8153
  }
8102
8154
  if (apiKey) {