mobbdev 1.0.34 → 1.0.37

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 +44 -14
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -182,6 +182,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
182
182
  IssueType_Enum2["UnsafeTargetBlank"] = "UNSAFE_TARGET_BLANK";
183
183
  IssueType_Enum2["UnvalidatedPublicMethodArgument"] = "UNVALIDATED_PUBLIC_METHOD_ARGUMENT";
184
184
  IssueType_Enum2["UselessRegexpCharEscape"] = "USELESS_REGEXP_CHAR_ESCAPE";
185
+ IssueType_Enum2["UseOfHardCodedCryptographicKey"] = "USE_OF_HARD_CODED_CRYPTOGRAPHIC_KEY";
185
186
  IssueType_Enum2["UseOfSystemOutputStream"] = "USE_OF_SYSTEM_OUTPUT_STREAM";
186
187
  IssueType_Enum2["ValueNeverRead"] = "VALUE_NEVER_READ";
187
188
  IssueType_Enum2["ValueShadowing"] = "VALUE_SHADOWING";
@@ -1067,7 +1068,8 @@ var issueTypeMap = {
1067
1068
  ["WEAK_ENCRYPTION" /* WeakEncryption */]: "Weak Encryption Mechanism",
1068
1069
  ["CODE_IN_COMMENT" /* CodeInComment */]: "Code in Comment",
1069
1070
  ["REGEX_MISSING_TIMEOUT" /* RegexMissingTimeout */]: "Regex Missing Timeout",
1070
- ["FRAMEABLE_LOGIN_PAGE" /* FrameableLoginPage */]: "Frameable Login Page"
1071
+ ["FRAMEABLE_LOGIN_PAGE" /* FrameableLoginPage */]: "Frameable Login Page",
1072
+ ["USE_OF_HARD_CODED_CRYPTOGRAPHIC_KEY" /* UseOfHardCodedCryptographicKey */]: "Use of Hardcoded Cryptographic Key"
1071
1073
  };
1072
1074
  var issueTypeZ = z5.nativeEnum(IssueType_Enum);
1073
1075
  var getIssueTypeFriendlyString = (issueType) => {
@@ -1625,13 +1627,35 @@ async function keypress() {
1625
1627
  import {
1626
1628
  createSpinner as _createSpinner
1627
1629
  } from "nanospinner";
1630
+ function printToStdError(opts) {
1631
+ if (opts?.text)
1632
+ console.error(opts.text);
1633
+ }
1628
1634
  var mockSpinner = {
1629
- success: () => mockSpinner,
1630
- error: () => mockSpinner,
1631
- warn: () => mockSpinner,
1632
- stop: () => mockSpinner,
1633
- start: () => mockSpinner,
1634
- update: () => mockSpinner,
1635
+ success: (opts) => {
1636
+ printToStdError(opts);
1637
+ return mockSpinner;
1638
+ },
1639
+ error: (opts) => {
1640
+ printToStdError(opts);
1641
+ return mockSpinner;
1642
+ },
1643
+ warn: (opts) => {
1644
+ printToStdError(opts);
1645
+ return mockSpinner;
1646
+ },
1647
+ stop: (opts) => {
1648
+ printToStdError(opts);
1649
+ return mockSpinner;
1650
+ },
1651
+ start: (opts) => {
1652
+ printToStdError(opts);
1653
+ return mockSpinner;
1654
+ },
1655
+ update: (opts) => {
1656
+ printToStdError(opts);
1657
+ return mockSpinner;
1658
+ },
1635
1659
  reset: () => mockSpinner,
1636
1660
  clear: () => mockSpinner,
1637
1661
  spin: () => mockSpinner
@@ -1953,7 +1977,8 @@ var fixDetailsData = {
1953
1977
  ["WEAK_ENCRYPTION" /* WeakEncryption */]: void 0,
1954
1978
  ["CODE_IN_COMMENT" /* CodeInComment */]: void 0,
1955
1979
  ["REGEX_MISSING_TIMEOUT" /* RegexMissingTimeout */]: void 0,
1956
- ["FRAMEABLE_LOGIN_PAGE" /* FrameableLoginPage */]: void 0
1980
+ ["FRAMEABLE_LOGIN_PAGE" /* FrameableLoginPage */]: void 0,
1981
+ ["USE_OF_HARD_CODED_CRYPTOGRAPHIC_KEY" /* UseOfHardCodedCryptographicKey */]: void 0
1957
1982
  };
1958
1983
 
1959
1984
  // src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
@@ -7517,13 +7542,14 @@ var GQLClient = class {
7517
7542
  }
7518
7543
  async verifyToken() {
7519
7544
  await this.createCommunityUser();
7545
+ let info;
7520
7546
  try {
7521
- await this.getUserInfo();
7547
+ info = await this.getUserInfo();
7522
7548
  } catch (e) {
7523
7549
  debug11("verify token failed %o", e);
7524
7550
  return false;
7525
7551
  }
7526
- return true;
7552
+ return info?.email || true;
7527
7553
  }
7528
7554
  async getOrgAndProjectId(params = {}) {
7529
7555
  const { projectName, userDefinedOrganizationId } = params;
@@ -8866,9 +8892,10 @@ async function handleMobbLogin({
8866
8892
  skipPrompts
8867
8893
  }) {
8868
8894
  const { createSpinner: createSpinner5 } = Spinner({ ci: skipPrompts });
8869
- if (await inGqlClient.verifyToken()) {
8895
+ const userVerify = await inGqlClient.verifyToken();
8896
+ if (userVerify) {
8870
8897
  createSpinner5().start().success({
8871
- text: "\u{1F513} Login to Mobb succeeded"
8898
+ text: `\u{1F513} Login to Mobb succeeded. ${typeof userVerify === "string" ? `Logged in as ${userVerify}` : ""}`
8872
8899
  });
8873
8900
  return inGqlClient;
8874
8901
  } else if (apiKey) {
@@ -8919,10 +8946,13 @@ async function handleMobbLogin({
8919
8946
  throw new CliError();
8920
8947
  }
8921
8948
  const newGqlClient = new GQLClient({ apiKey: newApiToken, type: "apiKey" });
8922
- if (await newGqlClient.verifyToken()) {
8949
+ const loginSuccess = await newGqlClient.verifyToken();
8950
+ if (loginSuccess) {
8923
8951
  debug17("set api token %s", newApiToken);
8924
8952
  config3.set("apiToken", newApiToken);
8925
- loginSpinner.success({ text: "\u{1F513} Login to Mobb successful!" });
8953
+ loginSpinner.success({
8954
+ text: `\u{1F513} Login to Mobb successful! ${typeof loginSpinner === "string" ? `Logged in as ${loginSuccess}` : ""}`
8955
+ });
8926
8956
  } else {
8927
8957
  loginSpinner.error({
8928
8958
  text: "Something went wrong, API token is invalid."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.34",
3
+ "version": "1.0.37",
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",