mobbdev 1.1.19 → 1.1.21

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.
@@ -2203,6 +2203,7 @@ function getDirName() {
2203
2203
  var debug = Debug("mobbdev:constants");
2204
2204
  dotenv.config({ path: path2.join(getModuleRootDir(), ".env") });
2205
2205
  var DEFAULT_API_URL = "https://api.mobb.ai/v1/graphql";
2206
+ var DEFAULT_WEB_APP_URL = "https://app.mobb.ai";
2206
2207
  var scmFriendlyText = {
2207
2208
  ["Ado" /* Ado */]: "Azure DevOps",
2208
2209
  ["Bitbucket" /* Bitbucket */]: "Bitbucket",
@@ -2229,13 +2230,16 @@ var scannerToVulnerabilityReportVendorEnum = {
2229
2230
  };
2230
2231
  var SupportedScannersZ = z8.enum([SCANNERS.Checkmarx, SCANNERS.Snyk]);
2231
2232
  var envVariablesSchema = z8.object({
2232
- WEB_APP_URL: z8.string(),
2233
- API_URL: z8.string(),
2234
- HASURA_ACCESS_KEY: z8.string(),
2235
- LOCAL_GRAPHQL_ENDPOINT: z8.string(),
2233
+ // These have safe defaults for production - the VS Code extension passes explicit URLs
2234
+ WEB_APP_URL: z8.string().optional().default(DEFAULT_WEB_APP_URL),
2235
+ API_URL: z8.string().optional().default(DEFAULT_API_URL),
2236
+ // These are only needed for local development with Hasura
2237
+ HASURA_ACCESS_KEY: z8.string().optional().default(""),
2238
+ LOCAL_GRAPHQL_ENDPOINT: z8.string().optional().default(""),
2239
+ // Proxy settings
2236
2240
  HTTP_PROXY: z8.string().optional().default(""),
2237
2241
  HTTPS_PROXY: z8.string().optional().default("")
2238
- }).required();
2242
+ });
2239
2243
  var envVariables = envVariablesSchema.parse(process.env);
2240
2244
  debug("config %o", envVariables);
2241
2245
  var WEB_APP_URL = envVariables.WEB_APP_URL;
@@ -4722,10 +4726,12 @@ var GQLClient = class {
4722
4726
  constructor(args) {
4723
4727
  __publicField(this, "_client");
4724
4728
  __publicField(this, "_clientSdk");
4729
+ __publicField(this, "_apiUrl");
4725
4730
  __publicField(this, "_auth");
4726
4731
  debug6(`init with ${args}`);
4727
4732
  this._auth = args;
4728
- this._client = new GraphQLClient(API_URL, {
4733
+ this._apiUrl = args.apiUrl || API_URL;
4734
+ this._client = new GraphQLClient(this._apiUrl, {
4729
4735
  headers: args.type === "apiKey" ? { [API_KEY_HEADER_NAME]: args.apiKey || "" } : {
4730
4736
  Authorization: `Bearer ${args.token}`
4731
4737
  },
@@ -5023,12 +5029,12 @@ var GQLClient = class {
5023
5029
  apiKey: this._auth.apiKey,
5024
5030
  type: "apiKey",
5025
5031
  timeoutInMs: params.timeoutInMs,
5026
- proxyAgent: getProxyAgent(API_URL)
5032
+ proxyAgent: getProxyAgent(this._apiUrl)
5027
5033
  } : {
5028
5034
  token: this._auth.token,
5029
5035
  type: "token",
5030
5036
  timeoutInMs: params.timeoutInMs,
5031
- proxyAgent: getProxyAgent(API_URL)
5037
+ proxyAgent: getProxyAgent(this._apiUrl)
5032
5038
  }
5033
5039
  );
5034
5040
  }
@@ -5114,29 +5120,37 @@ var configStore = getConfigStore();
5114
5120
  var debug7 = Debug6("mobbdev:commands");
5115
5121
  var LOGIN_MAX_WAIT = 10 * 60 * 1e3;
5116
5122
  var LOGIN_CHECK_DELAY = 5 * 1e3;
5117
- var webLoginUrl = `${WEB_APP_URL}/cli-login`;
5118
5123
  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(
5119
5124
  "press any key to continue"
5120
5125
  )};`;
5121
5126
  async function getAuthenticatedGQLClient({
5122
5127
  inputApiKey = "",
5123
- isSkipPrompts = true
5128
+ isSkipPrompts = true,
5129
+ apiUrl,
5130
+ webAppUrl
5124
5131
  }) {
5125
5132
  let gqlClient = new GQLClient({
5126
5133
  apiKey: inputApiKey || configStore.get("apiToken") || "",
5127
- type: "apiKey"
5134
+ type: "apiKey",
5135
+ apiUrl
5128
5136
  });
5129
5137
  gqlClient = await handleMobbLogin({
5130
5138
  inGqlClient: gqlClient,
5131
- skipPrompts: isSkipPrompts
5139
+ skipPrompts: isSkipPrompts,
5140
+ apiUrl,
5141
+ webAppUrl
5132
5142
  });
5133
5143
  return gqlClient;
5134
5144
  }
5135
5145
  async function handleMobbLogin({
5136
5146
  inGqlClient,
5137
5147
  apiKey,
5138
- skipPrompts
5148
+ skipPrompts,
5149
+ apiUrl,
5150
+ webAppUrl
5139
5151
  }) {
5152
+ const resolvedWebAppUrl = webAppUrl || WEB_APP_URL;
5153
+ const resolvedApiUrl = apiUrl || API_URL;
5140
5154
  const { createSpinner } = Spinner({ ci: skipPrompts });
5141
5155
  const isConnected = await inGqlClient.verifyApiConnection();
5142
5156
  if (!isConnected) {
@@ -5178,7 +5192,7 @@ async function handleMobbLogin({
5178
5192
  const loginId = await inGqlClient.createCliLogin({
5179
5193
  publicKey: publicKey.export({ format: "pem", type: "pkcs1" }).toString()
5180
5194
  });
5181
- const browserUrl = `${webLoginUrl}/${loginId}?hostname=${os.hostname()}`;
5195
+ const browserUrl = `${resolvedWebAppUrl}/cli-login/${loginId}?hostname=${os.hostname()}`;
5182
5196
  !skipPrompts && console.log(
5183
5197
  `If the page does not open automatically, kindly access it through ${browserUrl}.`
5184
5198
  );
@@ -5203,7 +5217,11 @@ async function handleMobbLogin({
5203
5217
  });
5204
5218
  throw new CliError();
5205
5219
  }
5206
- const newGqlClient = new GQLClient({ apiKey: newApiToken, type: "apiKey" });
5220
+ const newGqlClient = new GQLClient({
5221
+ apiKey: newApiToken,
5222
+ type: "apiKey",
5223
+ apiUrl: resolvedApiUrl
5224
+ });
5207
5225
  const loginSuccess = await newGqlClient.validateUserToken();
5208
5226
  if (loginSuccess) {
5209
5227
  debug7(`set api token ${newApiToken}`);
@@ -5291,42 +5309,36 @@ var openRedaction = new OpenRedaction({
5291
5309
  "VISA_NUMBER",
5292
5310
  "VISA_MRZ",
5293
5311
  "TAX_ID",
5294
- // Financial Data
5312
+ // Financial Data (removed SWIFT_BIC - too broad, matches bank code formats in variables)
5295
5313
  "CREDIT_CARD",
5296
5314
  "IBAN",
5297
5315
  "BANK_ACCOUNT_UK",
5298
5316
  "ROUTING_NUMBER_US",
5299
- "SWIFT_BIC",
5300
5317
  "CARD_TRACK1_DATA",
5301
5318
  "CARD_TRACK2_DATA",
5302
5319
  "CARD_EXPIRY",
5303
5320
  "CARD_AUTH_CODE",
5304
- // Cryptocurrency
5305
- "BITCOIN_ADDRESS",
5321
+ // Cryptocurrency (removed BITCOIN_ADDRESS - too broad, matches hash-like strings)
5306
5322
  "ETHEREUM_ADDRESS",
5307
5323
  "LITECOIN_ADDRESS",
5308
5324
  "CARDANO_ADDRESS",
5309
5325
  "SOLANA_ADDRESS",
5310
5326
  "MONERO_ADDRESS",
5311
5327
  "RIPPLE_ADDRESS",
5312
- // Medical Data
5328
+ // Medical Data (removed PRESCRIPTION_NUMBER - too broad, matches words containing "ription")
5313
5329
  "NHS_NUMBER",
5314
5330
  "MEDICAL_RECORD_NUMBER",
5315
5331
  "AUSTRALIAN_MEDICARE",
5316
5332
  "HEALTH_PLAN_NUMBER",
5317
- "PRESCRIPTION_NUMBER",
5318
5333
  "PATIENT_ID",
5319
- // Communications
5334
+ // Communications (removed EMERGENCY_CONTACT, ADDRESS_PO_BOX, ZIP_CODE_US - too broad)
5320
5335
  "PHONE_US",
5321
5336
  "PHONE_UK",
5322
5337
  "PHONE_UK_MOBILE",
5323
5338
  "PHONE_INTERNATIONAL",
5324
5339
  "PHONE_LINE_NUMBER",
5325
- "EMERGENCY_CONTACT",
5326
5340
  "ADDRESS_STREET",
5327
- "ADDRESS_PO_BOX",
5328
5341
  "POSTCODE_UK",
5329
- "ZIP_CODE_US",
5330
5342
  // Network & Technical
5331
5343
  "IPV4",
5332
5344
  "IPV6",
package/dist/index.mjs CHANGED
@@ -10390,6 +10390,7 @@ import { z as z24 } from "zod";
10390
10390
  var debug5 = Debug4("mobbdev:constants");
10391
10391
  dotenv.config({ path: path6.join(getModuleRootDir(), ".env") });
10392
10392
  var DEFAULT_API_URL = "https://api.mobb.ai/v1/graphql";
10393
+ var DEFAULT_WEB_APP_URL = "https://app.mobb.ai";
10393
10394
  var scmFriendlyText = {
10394
10395
  ["Ado" /* Ado */]: "Azure DevOps",
10395
10396
  ["Bitbucket" /* Bitbucket */]: "Bitbucket",
@@ -10416,13 +10417,16 @@ var scannerToVulnerabilityReportVendorEnum = {
10416
10417
  };
10417
10418
  var SupportedScannersZ = z24.enum([SCANNERS.Checkmarx, SCANNERS.Snyk]);
10418
10419
  var envVariablesSchema = z24.object({
10419
- WEB_APP_URL: z24.string(),
10420
- API_URL: z24.string(),
10421
- HASURA_ACCESS_KEY: z24.string(),
10422
- LOCAL_GRAPHQL_ENDPOINT: z24.string(),
10420
+ // These have safe defaults for production - the VS Code extension passes explicit URLs
10421
+ WEB_APP_URL: z24.string().optional().default(DEFAULT_WEB_APP_URL),
10422
+ API_URL: z24.string().optional().default(DEFAULT_API_URL),
10423
+ // These are only needed for local development with Hasura
10424
+ HASURA_ACCESS_KEY: z24.string().optional().default(""),
10425
+ LOCAL_GRAPHQL_ENDPOINT: z24.string().optional().default(""),
10426
+ // Proxy settings
10423
10427
  HTTP_PROXY: z24.string().optional().default(""),
10424
10428
  HTTPS_PROXY: z24.string().optional().default("")
10425
- }).required();
10429
+ });
10426
10430
  var envVariables = envVariablesSchema.parse(process.env);
10427
10431
  debug5("config %o", envVariables);
10428
10432
  var mobbAscii = `
@@ -10475,9 +10479,9 @@ var errorMessages = {
10475
10479
  )} is needed if you're adding an SCM token`
10476
10480
  };
10477
10481
  var progressMassages = {
10478
- processingVulnerabilityReportSuccess: "\u2699\uFE0F Vulnerability report proccessed successfully",
10479
- processingVulnerabilityReport: "\u2699\uFE0F Proccessing vulnerability report",
10480
- processingVulnerabilityReportFailed: "\u2699\uFE0F Error Proccessing vulnerability report"
10482
+ processingVulnerabilityReportSuccess: "\u2699\uFE0F Vulnerability report processed successfully",
10483
+ processingVulnerabilityReport: "\u2699\uFE0F Processing vulnerability report",
10484
+ processingVulnerabilityReportFailed: "\u2699\uFE0F Error Processing vulnerability report"
10481
10485
  };
10482
10486
  var VUL_REPORT_DIGEST_TIMEOUT_MS = 1e3 * 60 * 30;
10483
10487
 
@@ -10977,10 +10981,12 @@ var GQLClient = class {
10977
10981
  constructor(args) {
10978
10982
  __publicField(this, "_client");
10979
10983
  __publicField(this, "_clientSdk");
10984
+ __publicField(this, "_apiUrl");
10980
10985
  __publicField(this, "_auth");
10981
10986
  debug6(`init with ${args}`);
10982
10987
  this._auth = args;
10983
- this._client = new GraphQLClient(API_URL, {
10988
+ this._apiUrl = args.apiUrl || API_URL;
10989
+ this._client = new GraphQLClient(this._apiUrl, {
10984
10990
  headers: args.type === "apiKey" ? { [API_KEY_HEADER_NAME]: args.apiKey || "" } : {
10985
10991
  Authorization: `Bearer ${args.token}`
10986
10992
  },
@@ -11278,12 +11284,12 @@ var GQLClient = class {
11278
11284
  apiKey: this._auth.apiKey,
11279
11285
  type: "apiKey",
11280
11286
  timeoutInMs: params.timeoutInMs,
11281
- proxyAgent: getProxyAgent(API_URL)
11287
+ proxyAgent: getProxyAgent(this._apiUrl)
11282
11288
  } : {
11283
11289
  token: this._auth.token,
11284
11290
  type: "token",
11285
11291
  timeoutInMs: params.timeoutInMs,
11286
- proxyAgent: getProxyAgent(API_URL)
11292
+ proxyAgent: getProxyAgent(this._apiUrl)
11287
11293
  }
11288
11294
  );
11289
11295
  }
@@ -11369,29 +11375,37 @@ var configStore = getConfigStore();
11369
11375
  var debug7 = Debug6("mobbdev:commands");
11370
11376
  var LOGIN_MAX_WAIT = 10 * 60 * 1e3;
11371
11377
  var LOGIN_CHECK_DELAY = 5 * 1e3;
11372
- var webLoginUrl = `${WEB_APP_URL}/cli-login`;
11373
11378
  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, ${chalk3.bgBlue(
11374
11379
  "press any key to continue"
11375
11380
  )};`;
11376
11381
  async function getAuthenticatedGQLClient({
11377
11382
  inputApiKey = "",
11378
- isSkipPrompts = true
11383
+ isSkipPrompts = true,
11384
+ apiUrl,
11385
+ webAppUrl
11379
11386
  }) {
11380
11387
  let gqlClient = new GQLClient({
11381
11388
  apiKey: inputApiKey || configStore.get("apiToken") || "",
11382
- type: "apiKey"
11389
+ type: "apiKey",
11390
+ apiUrl
11383
11391
  });
11384
11392
  gqlClient = await handleMobbLogin({
11385
11393
  inGqlClient: gqlClient,
11386
- skipPrompts: isSkipPrompts
11394
+ skipPrompts: isSkipPrompts,
11395
+ apiUrl,
11396
+ webAppUrl
11387
11397
  });
11388
11398
  return gqlClient;
11389
11399
  }
11390
11400
  async function handleMobbLogin({
11391
11401
  inGqlClient,
11392
11402
  apiKey,
11393
- skipPrompts
11403
+ skipPrompts,
11404
+ apiUrl,
11405
+ webAppUrl
11394
11406
  }) {
11407
+ const resolvedWebAppUrl = webAppUrl || WEB_APP_URL;
11408
+ const resolvedApiUrl = apiUrl || API_URL;
11395
11409
  const { createSpinner: createSpinner5 } = Spinner({ ci: skipPrompts });
11396
11410
  const isConnected = await inGqlClient.verifyApiConnection();
11397
11411
  if (!isConnected) {
@@ -11433,7 +11447,7 @@ async function handleMobbLogin({
11433
11447
  const loginId = await inGqlClient.createCliLogin({
11434
11448
  publicKey: publicKey.export({ format: "pem", type: "pkcs1" }).toString()
11435
11449
  });
11436
- const browserUrl = `${webLoginUrl}/${loginId}?hostname=${os.hostname()}`;
11450
+ const browserUrl = `${resolvedWebAppUrl}/cli-login/${loginId}?hostname=${os.hostname()}`;
11437
11451
  !skipPrompts && console.log(
11438
11452
  `If the page does not open automatically, kindly access it through ${browserUrl}.`
11439
11453
  );
@@ -11458,7 +11472,11 @@ async function handleMobbLogin({
11458
11472
  });
11459
11473
  throw new CliError();
11460
11474
  }
11461
- const newGqlClient = new GQLClient({ apiKey: newApiToken, type: "apiKey" });
11475
+ const newGqlClient = new GQLClient({
11476
+ apiKey: newApiToken,
11477
+ type: "apiKey",
11478
+ apiUrl: resolvedApiUrl
11479
+ });
11462
11480
  const loginSuccess = await newGqlClient.validateUserToken();
11463
11481
  if (loginSuccess) {
11464
11482
  debug7(`set api token ${newApiToken}`);
@@ -13580,42 +13598,36 @@ var openRedaction = new OpenRedaction({
13580
13598
  "VISA_NUMBER",
13581
13599
  "VISA_MRZ",
13582
13600
  "TAX_ID",
13583
- // Financial Data
13601
+ // Financial Data (removed SWIFT_BIC - too broad, matches bank code formats in variables)
13584
13602
  "CREDIT_CARD",
13585
13603
  "IBAN",
13586
13604
  "BANK_ACCOUNT_UK",
13587
13605
  "ROUTING_NUMBER_US",
13588
- "SWIFT_BIC",
13589
13606
  "CARD_TRACK1_DATA",
13590
13607
  "CARD_TRACK2_DATA",
13591
13608
  "CARD_EXPIRY",
13592
13609
  "CARD_AUTH_CODE",
13593
- // Cryptocurrency
13594
- "BITCOIN_ADDRESS",
13610
+ // Cryptocurrency (removed BITCOIN_ADDRESS - too broad, matches hash-like strings)
13595
13611
  "ETHEREUM_ADDRESS",
13596
13612
  "LITECOIN_ADDRESS",
13597
13613
  "CARDANO_ADDRESS",
13598
13614
  "SOLANA_ADDRESS",
13599
13615
  "MONERO_ADDRESS",
13600
13616
  "RIPPLE_ADDRESS",
13601
- // Medical Data
13617
+ // Medical Data (removed PRESCRIPTION_NUMBER - too broad, matches words containing "ription")
13602
13618
  "NHS_NUMBER",
13603
13619
  "MEDICAL_RECORD_NUMBER",
13604
13620
  "AUSTRALIAN_MEDICARE",
13605
13621
  "HEALTH_PLAN_NUMBER",
13606
- "PRESCRIPTION_NUMBER",
13607
13622
  "PATIENT_ID",
13608
- // Communications
13623
+ // Communications (removed EMERGENCY_CONTACT, ADDRESS_PO_BOX, ZIP_CODE_US - too broad)
13609
13624
  "PHONE_US",
13610
13625
  "PHONE_UK",
13611
13626
  "PHONE_UK_MOBILE",
13612
13627
  "PHONE_INTERNATIONAL",
13613
13628
  "PHONE_LINE_NUMBER",
13614
- "EMERGENCY_CONTACT",
13615
13629
  "ADDRESS_STREET",
13616
- "ADDRESS_PO_BOX",
13617
13630
  "POSTCODE_UK",
13618
- "ZIP_CODE_US",
13619
13631
  // Network & Technical
13620
13632
  "IPV4",
13621
13633
  "IPV6",
@@ -14799,8 +14811,8 @@ var McpAuthService = class {
14799
14811
  throw new CliLoginError("Error: createCliLogin failed");
14800
14812
  }
14801
14813
  logDebug(`cli login created ${loginId}`);
14802
- const webLoginUrl2 = `${WEB_APP_URL}/mvs-login`;
14803
- const browserUrl = `${webLoginUrl2}/${loginId}?hostname=${os4.hostname()}`;
14814
+ const webLoginUrl = `${WEB_APP_URL}/mvs-login`;
14815
+ const browserUrl = `${webLoginUrl}/${loginId}?hostname=${os4.hostname()}`;
14804
14816
  await this.openBrowser(browserUrl, isBackgoundCall);
14805
14817
  logDebug(`waiting for login to complete`);
14806
14818
  let newApiToken = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "git+https://github.com/mobb-dev/bugsy.git",
6
6
  "main": "dist/index.mjs",