@socketsecurity/cli-with-sentry 1.0.21 → 1.0.23

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 (71) hide show
  1. package/dist/cli.js +435 -403
  2. package/dist/cli.js.map +1 -1
  3. package/dist/constants.js +14 -8
  4. package/dist/constants.js.map +1 -1
  5. package/dist/shadow-npm-inject.js +63 -4
  6. package/dist/shadow-npm-inject.js.map +1 -1
  7. package/dist/types/commands/audit-log/output-audit-log.d.mts.map +1 -1
  8. package/dist/types/commands/fix/agent-fix.d.mts +3 -5
  9. package/dist/types/commands/fix/agent-fix.d.mts.map +1 -1
  10. package/dist/types/commands/fix/fix-branch-helpers.d.mts +3 -4
  11. package/dist/types/commands/fix/fix-branch-helpers.d.mts.map +1 -1
  12. package/dist/types/commands/fix/fix-env-helpers.d.mts +9 -9
  13. package/dist/types/commands/fix/fix-env-helpers.d.mts.map +1 -1
  14. package/dist/types/commands/fix/git.d.mts +1 -0
  15. package/dist/types/commands/fix/git.d.mts.map +1 -1
  16. package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
  17. package/dist/types/commands/fix/npm-fix.d.mts.map +1 -1
  18. package/dist/types/commands/fix/pnpm-fix.d.mts.map +1 -1
  19. package/dist/types/commands/fix/{open-pr.d.mts → pull-request.d.mts} +11 -6
  20. package/dist/types/commands/fix/pull-request.d.mts.map +1 -0
  21. package/dist/types/commands/fix/shared.d.mts +1 -2
  22. package/dist/types/commands/fix/shared.d.mts.map +1 -1
  23. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +1 -1
  24. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +1 -1
  25. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +1 -1
  26. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +1 -1
  27. package/dist/types/commands/manifest/detect-manifest-actions.d.mts.map +1 -1
  28. package/dist/types/commands/optimize/update-lockfile.d.mts.map +1 -1
  29. package/dist/types/commands/repository/fetch-list-all-repos.d.mts.map +1 -1
  30. package/dist/types/commands/scan/fetch-report-data.d.mts.map +1 -1
  31. package/dist/types/commands/scan/fetch-scan.d.mts.map +1 -1
  32. package/dist/types/commands/scan/setup-scan-config.d.mts.map +1 -1
  33. package/dist/types/commands/wrapper/postinstall-wrapper.d.mts.map +1 -1
  34. package/dist/types/constants.d.mts +2 -0
  35. package/dist/types/constants.d.mts.map +1 -1
  36. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
  37. package/dist/types/utils/alerts-map.d.mts +0 -1
  38. package/dist/types/utils/alerts-map.d.mts.map +1 -1
  39. package/dist/types/utils/api.d.mts.map +1 -1
  40. package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
  41. package/dist/types/utils/npm-config.d.mts +14 -0
  42. package/dist/types/utils/npm-config.d.mts.map +1 -0
  43. package/dist/types/utils/npm-paths.d.mts +2 -2
  44. package/dist/types/utils/npm-paths.d.mts.map +1 -1
  45. package/dist/types/utils/output-formatting.d.mts +3 -2
  46. package/dist/types/utils/output-formatting.d.mts.map +1 -1
  47. package/dist/types/utils/package-environment.d.mts.map +1 -1
  48. package/dist/types/utils/path-resolve.d.mts.map +1 -1
  49. package/dist/types/utils/socket-package-alert.d.mts +1 -2
  50. package/dist/types/utils/socket-package-alert.d.mts.map +1 -1
  51. package/dist/types/utils/socketjson.d.mts.map +1 -1
  52. package/dist/utils.js +172 -86
  53. package/dist/utils.js.map +1 -1
  54. package/dist/vendor.js +66974 -66974
  55. package/external/@coana-tech/cli/cli.mjs +60278 -55993
  56. package/external/@socketsecurity/registry/external/@inquirer/confirm.js +1 -1
  57. package/external/@socketsecurity/registry/external/@inquirer/input.js +10 -2
  58. package/external/@socketsecurity/registry/external/@inquirer/password.js +1 -1
  59. package/external/@socketsecurity/registry/external/@inquirer/search.js +1 -1
  60. package/external/@socketsecurity/registry/external/@inquirer/select.js +1 -1
  61. package/external/@socketsecurity/registry/external/browserslist.js +572 -570
  62. package/external/@socketsecurity/registry/external/debug.js +1163 -0
  63. package/external/@socketsecurity/registry/lib/constants/env.js +9 -4
  64. package/external/@socketsecurity/registry/lib/debug.js +139 -47
  65. package/external/@socketsecurity/registry/lib/logger.js +2 -2
  66. package/external/@socketsecurity/registry/lib/packages.js +1 -2
  67. package/external/@socketsecurity/registry/lib/prompts.js +1 -1
  68. package/package.json +22 -22
  69. package/dist/types/commands/fix/open-pr.d.mts.map +0 -1
  70. package/dist/types/shadow/npm/proc-log/index.d.mts +0 -3
  71. package/dist/types/shadow/npm/proc-log/index.d.mts.map +0 -1
package/dist/utils.js CHANGED
@@ -391,7 +391,7 @@ let _cachedConfig;
391
391
  // When using --config or SOCKET_CLI_CONFIG, do not persist the config.
392
392
  let _readOnlyConfig = false;
393
393
  function overrideCachedConfig(jsonConfig) {
394
- debug.debugFn('override: full config (not stored)');
394
+ debug.debugFn('notice', 'override: full config (not stored)');
395
395
  let config;
396
396
  try {
397
397
  config = JSON.parse(String(jsonConfig));
@@ -432,7 +432,7 @@ function overrideCachedConfig(jsonConfig) {
432
432
  };
433
433
  }
434
434
  function overrideConfigApiToken(apiToken) {
435
- debug.debugFn('override: API token (not stored)');
435
+ debug.debugFn('notice', 'override: API token (not stored)');
436
436
 
437
437
  // Set token to the local cached config and mark it read-only so it doesn't persist
438
438
  _cachedConfig = {
@@ -516,7 +516,7 @@ function captureExceptionSync(exception, hint) {
516
516
  if (!Sentry) {
517
517
  return '';
518
518
  }
519
- debug.debugFn('send: exception to Sentry');
519
+ debug.debugFn('notice', 'send: exception to Sentry');
520
520
  return Sentry.captureException(exception, hint);
521
521
  }
522
522
 
@@ -639,7 +639,10 @@ async function handleApiCall(value, fetchingDesc) {
639
639
  spinner.failAndStop(`An error was thrown while requesting ${fetchingDesc}`);
640
640
  const message = `${e || 'No error message returned'}`;
641
641
  const reason = `${e || 'No error message returned'}`;
642
- debug.debugFn(`catch: ${fetchingDesc} error:\n`, e);
642
+ debug.debugFn('error', `caught: ${fetchingDesc} error`);
643
+ debug.debugDir('inspect', {
644
+ error: e
645
+ });
643
646
  return {
644
647
  ok: false,
645
648
  message: 'Socket API returned an error',
@@ -651,12 +654,15 @@ async function handleApiCall(value, fetchingDesc) {
651
654
 
652
655
  // Note: TS can't narrow down the type of result due to generics
653
656
  if (result.success === false) {
654
- const err = result;
655
- const message = `${err.error || 'No error message returned'}`;
657
+ const error = result;
658
+ const message = `${error.error || 'No error message returned'}`;
656
659
  const {
657
660
  cause: reason
658
- } = err;
659
- debug.debugFn(`fail: ${fetchingDesc} bad response:\n`, err);
661
+ } = error;
662
+ debug.debugFn('error', `fail: ${fetchingDesc} bad response`);
663
+ debug.debugDir('inspect', {
664
+ error
665
+ });
660
666
  return {
661
667
  ok: false,
662
668
  message: 'Socket API returned an error',
@@ -680,7 +686,10 @@ async function handleApiCallNoSpinner(value, description) {
680
686
  } catch (e) {
681
687
  const message = `${e || 'No error message returned'}`;
682
688
  const reason = `${e || 'No error message returned'}`;
683
- debug.debugFn(`catch: ${description} error:\n`, e);
689
+ debug.debugFn('error', `caught: ${description} error`);
690
+ debug.debugDir('inspect', {
691
+ error: e
692
+ });
684
693
  return {
685
694
  ok: false,
686
695
  message: 'Socket API returned an error',
@@ -690,13 +699,16 @@ async function handleApiCallNoSpinner(value, description) {
690
699
 
691
700
  // Note: TS can't narrow down the type of result due to generics
692
701
  if (result.success === false) {
693
- const err = result;
694
- const message = `${err.error || 'No error message returned'}`;
695
- debug.debugFn(`fail: ${description} bad response:\n`, err);
702
+ const error = result;
703
+ const message = `${error.error || 'No error message returned'}`;
704
+ debug.debugFn('error', `fail: ${description} bad response`);
705
+ debug.debugDir('inspect', {
706
+ error
707
+ });
696
708
  return {
697
709
  ok: false,
698
710
  message: 'Socket API returned an error',
699
- cause: `${message}${err.cause ? ` ( Reason: ${err.cause} )` : ''}`,
711
+ cause: `${message}${error.cause ? ` ( Reason: ${error.cause} )` : ''}`,
700
712
  data: {
701
713
  code: result.status
702
714
  }
@@ -777,7 +789,10 @@ async function queryApiSafeText(path, fetchSpinnerDesc) {
777
789
  spinner.failAndStop(`An error was thrown while requesting ${fetchSpinnerDesc}.`);
778
790
  }
779
791
  const cause = e?.message;
780
- debug.debugFn('catch: queryApi() error\n', e);
792
+ debug.debugFn('error', 'caught: queryApi() error');
793
+ debug.debugDir('inspect', {
794
+ error: e
795
+ });
781
796
  return {
782
797
  ok: false,
783
798
  message: 'API Request failed to complete',
@@ -801,7 +816,10 @@ async function queryApiSafeText(path, fetchSpinnerDesc) {
801
816
  data
802
817
  };
803
818
  } catch (e) {
804
- debug.debugFn('catch: await result.text() error\n', e);
819
+ debug.debugFn('error', 'caught: await result.text() error');
820
+ debug.debugDir('inspect', {
821
+ error: e
822
+ });
805
823
  return {
806
824
  ok: false,
807
825
  message: 'API Request failed to complete',
@@ -885,7 +903,7 @@ cols, titles = cols) {
885
903
  }
886
904
  body += '\n';
887
905
  }
888
- return [div, header, div, body.trim(), div].filter(s => !!s.trim()).join('\n');
906
+ return [div, header, div, body.trim(), div].filter(s => s.trim()).join('\n');
889
907
  }
890
908
  function mdTableOfPairs(arr,
891
909
  // This is saying "an array of strings and the strings are a valid key of elements of T"
@@ -914,7 +932,7 @@ cols) {
914
932
  body += ' ' + String(val ?? '').padEnd(cws[1] ?? 0, ' ') + ' |';
915
933
  body += '\n';
916
934
  }
917
- return [div, header, div, body.trim(), div].filter(s => !!s.trim()).join('\n');
935
+ return [div, header, div, body.trim(), div].filter(s => s.trim()).join('\n');
918
936
  }
919
937
 
920
938
  // Serialize the final result object before printing it
@@ -922,9 +940,9 @@ cols) {
922
940
  function serializeResultJson(data) {
923
941
  if (typeof data !== 'object' || !data) {
924
942
  process.exitCode = 1;
925
- debug.debugFn('typeof data=', typeof data);
943
+ debug.debugFn('inspect', 'typeof data=', typeof data);
926
944
  if (typeof data !== 'object' && data) {
927
- debug.debugFn('data:\n', data);
945
+ debug.debugFn('inspect', 'data:\n', data);
928
946
  }
929
947
 
930
948
  // We should not allow the json value to be "null", or a boolean/number/string,
@@ -939,12 +957,14 @@ function serializeResultJson(data) {
939
957
  try {
940
958
  return JSON.stringify(data, null, 2).trim() + '\n';
941
959
  } catch (e) {
942
- debug.debugFn('catch: unexpected\n', e);
943
960
  process.exitCode = 1;
944
961
 
945
962
  // This could be caused by circular references, which is an "us" problem
946
963
  const message = 'There was a problem converting the data set to JSON. Please try again without --json';
947
964
  logger.logger.fail(message);
965
+ debug.debugDir('inspect', {
966
+ error: e
967
+ });
948
968
  return JSON.stringify({
949
969
  ok: false,
950
970
  message: 'Unable to serialize JSON',
@@ -1059,21 +1079,29 @@ function getOutputKind(json, markdown) {
1059
1079
  return 'text';
1060
1080
  }
1061
1081
 
1062
- function getFlagListOutput(list, indent, {
1063
- keyPrefix = '--',
1064
- padName
1065
- } = {}) {
1082
+ function getFlagListOutput(list, options) {
1083
+ const {
1084
+ keyPrefix = '--'
1085
+ } = {
1086
+ __proto__: null,
1087
+ ...options
1088
+ };
1066
1089
  return getHelpListOutput({
1067
1090
  ...list
1068
- }, indent, {
1069
- keyPrefix,
1070
- padName
1091
+ }, {
1092
+ ...options,
1093
+ keyPrefix
1071
1094
  });
1072
1095
  }
1073
- function getHelpListOutput(list, indent, {
1074
- keyPrefix = '',
1075
- padName = 18
1076
- } = {}) {
1096
+ function getHelpListOutput(list, options) {
1097
+ const {
1098
+ indent = 6,
1099
+ keyPrefix = '',
1100
+ padName = 18
1101
+ } = {
1102
+ __proto__: null,
1103
+ ...options
1104
+ };
1077
1105
  let result = '';
1078
1106
  const names = Object.keys(list).sort(sorts.naturalCompare);
1079
1107
  for (const name of names) {
@@ -1081,7 +1109,7 @@ function getHelpListOutput(list, indent, {
1081
1109
  if (entry && 'hidden' in entry && entry?.hidden) {
1082
1110
  continue;
1083
1111
  }
1084
- const description = (typeof entry === 'object' ? entry.description : entry) || '';
1112
+ const description = (objects.isObject(entry) ? entry.description : entry) || '';
1085
1113
  result += ''.padEnd(indent) + (keyPrefix + name).padEnd(padName) + description + '\n';
1086
1114
  }
1087
1115
  return result.trim() || '(none)';
@@ -1251,7 +1279,7 @@ async function meowWithSubcommands(subcommands, options) {
1251
1279
  const subcommand = cmdName ? subcommands[cmdName] : undefined;
1252
1280
  return subcommand && !subcommand.hidden;
1253
1281
  })))
1254
- }, 6);
1282
+ });
1255
1283
  }
1256
1284
 
1257
1285
  // "Bucket" some commands for easier usage.
@@ -1320,7 +1348,7 @@ ${isRootCommand ? '' : '\n Commands'}
1320
1348
  ${formatCommandsForHelp(isRootCommand)}
1321
1349
 
1322
1350
  ${isRootCommand ? ' Options' : ' Options'}${isRootCommand ? ' (Note: all CLI commands have these flags even when not displayed in their help)\n' : ''}
1323
- ${getFlagListOutput(flags, 6, {
1351
+ ${getFlagListOutput(flags, {
1324
1352
  padName: 25
1325
1353
  })}
1326
1354
 
@@ -1720,7 +1748,7 @@ function findNpmPathSync(npmBinPath) {
1720
1748
  }
1721
1749
  }
1722
1750
  async function getPackageFilesForScan(cwd, inputPaths, supportedFiles, config) {
1723
- debug.debugFn(`resolve: ${inputPaths.length} paths`, inputPaths);
1751
+ debug.debugFn('notice', `resolve: ${inputPaths.length} paths`, inputPaths);
1724
1752
 
1725
1753
  // Lazily access constants.spinner.
1726
1754
  const {
@@ -1732,16 +1760,16 @@ async function getPackageFilesForScan(cwd, inputPaths, supportedFiles, config) {
1732
1760
  cwd,
1733
1761
  socketConfig: config
1734
1762
  });
1735
- if (debug.isDebug()) {
1763
+ if (debug.isDebug('notice')) {
1736
1764
  spinner.stop();
1737
- debug.debugFn(`Resolved ${inputPaths.length} paths to ${entries.length} local paths:\n`, entries);
1765
+ debug.debugFn('notice', `Resolved ${inputPaths.length} paths to ${entries.length} local paths:\n`, entries);
1738
1766
  spinner.start('Searching for files now...');
1739
1767
  } else {
1740
1768
  spinner.start(`Resolved ${inputPaths.length} paths to ${entries.length} local paths, searching for files now...`);
1741
1769
  }
1742
1770
  const packageFiles = await filterGlobResultToSupportedFiles(entries, supportedFiles);
1743
1771
  spinner.successAndStop(`Found ${packageFiles.length} local ${words.pluralize('file', packageFiles.length)}`);
1744
- debug.debugFn('paths: absolute', packageFiles);
1772
+ debug.debugFn('inspect', 'paths: absolute', packageFiles);
1745
1773
  return packageFiles;
1746
1774
  }
1747
1775
 
@@ -1765,7 +1793,7 @@ function getDefaultSocketJson() {
1765
1793
  async function readSocketJson(cwd, defaultOnError = false) {
1766
1794
  const sockJsonPath = path.join(cwd, 'socket.json');
1767
1795
  if (!fs.existsSync(sockJsonPath)) {
1768
- debug.debugFn(`miss: file not found ${sockJsonPath}`);
1796
+ debug.debugFn('notice', `miss: file not found ${sockJsonPath}`);
1769
1797
  return {
1770
1798
  ok: true,
1771
1799
  data: getDefaultSocketJson()
@@ -1775,8 +1803,9 @@ async function readSocketJson(cwd, defaultOnError = false) {
1775
1803
  try {
1776
1804
  json = await fs.promises.readFile(sockJsonPath, 'utf8');
1777
1805
  } catch (e) {
1778
- debug.debugLog('[DEBUG] Raw error:');
1779
- debug.debugLog(e);
1806
+ debug.debugDir('inspect', {
1807
+ error: e
1808
+ });
1780
1809
  if (defaultOnError) {
1781
1810
  logger.logger.warn('Warning: failed to read file, using default');
1782
1811
  return {
@@ -1795,7 +1824,10 @@ async function readSocketJson(cwd, defaultOnError = false) {
1795
1824
  try {
1796
1825
  obj = JSON.parse(json);
1797
1826
  } catch {
1798
- debug.debugFn('fail: parse JSON\n', json);
1827
+ debug.debugFn('error', 'fail: parse JSON');
1828
+ debug.debugDir('inspect', {
1829
+ json
1830
+ });
1799
1831
  if (defaultOnError) {
1800
1832
  logger.logger.warn('Warning: failed to parse file, using default');
1801
1833
  return {
@@ -1830,8 +1862,13 @@ async function writeSocketJson(cwd, sockJson) {
1830
1862
  try {
1831
1863
  json = JSON.stringify(sockJson, null, 2);
1832
1864
  } catch (e) {
1833
- debug.debugFn('fail: stringify JSON\n', e);
1834
- debug.debugLog('[DEBUG] Object:\n', sockJson);
1865
+ debug.debugFn('error', 'fail: stringify JSON');
1866
+ debug.debugDir('inspect', {
1867
+ error: e
1868
+ });
1869
+ debug.debugDir('inspect', {
1870
+ sockJson
1871
+ });
1835
1872
  return {
1836
1873
  ok: false,
1837
1874
  message: 'Failed to serialize to JSON',
@@ -1859,26 +1896,6 @@ function exitWithBinPathError(binName) {
1859
1896
  // eslint-disable-next-line n/no-process-exit
1860
1897
  process.exit(127);
1861
1898
  }
1862
- let _npmBinPathDetails;
1863
- function getNpmBinPathDetails() {
1864
- if (_npmBinPathDetails === undefined) {
1865
- _npmBinPathDetails = findBinPathDetailsSync(NPM$3);
1866
- }
1867
- return _npmBinPathDetails;
1868
- }
1869
- let _npxBinPathDetails;
1870
- function getNpxBinPathDetails() {
1871
- if (_npxBinPathDetails === undefined) {
1872
- _npxBinPathDetails = findBinPathDetailsSync(NPX);
1873
- }
1874
- return _npxBinPathDetails;
1875
- }
1876
- function isNpmBinPathShadowed() {
1877
- return getNpmBinPathDetails().shadowed;
1878
- }
1879
- function isNpxBinPathShadowed() {
1880
- return getNpxBinPathDetails().shadowed;
1881
- }
1882
1899
  let _npmBinPath;
1883
1900
  function getNpmBinPath() {
1884
1901
  if (_npmBinPath === undefined) {
@@ -1889,6 +1906,13 @@ function getNpmBinPath() {
1889
1906
  }
1890
1907
  return _npmBinPath;
1891
1908
  }
1909
+ let _npmBinPathDetails;
1910
+ function getNpmBinPathDetails() {
1911
+ if (_npmBinPathDetails === undefined) {
1912
+ _npmBinPathDetails = findBinPathDetailsSync(NPM$3);
1913
+ }
1914
+ return _npmBinPathDetails;
1915
+ }
1892
1916
  let _npmPath;
1893
1917
  function getNpmPath() {
1894
1918
  if (_npmPath === undefined) {
@@ -1928,6 +1952,19 @@ function getNpxBinPath() {
1928
1952
  }
1929
1953
  return _npxBinPath;
1930
1954
  }
1955
+ let _npxBinPathDetails;
1956
+ function getNpxBinPathDetails() {
1957
+ if (_npxBinPathDetails === undefined) {
1958
+ _npxBinPathDetails = findBinPathDetailsSync(NPX);
1959
+ }
1960
+ return _npxBinPathDetails;
1961
+ }
1962
+ function isNpmBinPathShadowed() {
1963
+ return getNpmBinPathDetails().shadowed;
1964
+ }
1965
+ function isNpxBinPathShadowed() {
1966
+ return getNpxBinPathDetails().shadowed;
1967
+ }
1931
1968
 
1932
1969
  const {
1933
1970
  ALERT_TYPE_CRITICAL_CVE,
@@ -2262,20 +2299,20 @@ function getAlertSeverityOrder(alert) {
2262
2299
  function getAlertsSeverityOrder(alerts) {
2263
2300
  return alertsHaveBlocked(alerts) || alertsHaveSeverity(alerts, ALERT_SEVERITY.critical) ? 0 : alertsHaveSeverity(alerts, ALERT_SEVERITY.high) ? 1 : alertsHaveSeverity(alerts, ALERT_SEVERITY.middle) ? 2 : alertsHaveSeverity(alerts, ALERT_SEVERITY.low) ? 3 : 4;
2264
2301
  }
2265
- function getCveInfoFromAlertsMap(alertsMap, options_) {
2266
- const options = {
2302
+ function getCveInfoFromAlertsMap(alertsMap, options) {
2303
+ const {
2304
+ exclude: exclude_
2305
+ } = {
2267
2306
  __proto__: null,
2268
- exclude: undefined,
2269
- limit: Infinity,
2270
- ...options_
2307
+ ...options
2271
2308
  };
2272
- options.exclude = {
2309
+ const exclude = {
2273
2310
  __proto__: null,
2274
- ...options.exclude
2311
+ ...exclude_
2275
2312
  };
2276
- let count = 0;
2277
2313
  let infoByPartialPurl = null;
2278
- alertsMapLoop: for (const {
2314
+ // eslint-disable-next-line no-unused-labels
2315
+ for (const {
2279
2316
  0: purl,
2280
2317
  1: sockPkgAlerts
2281
2318
  } of alertsMap) {
@@ -2284,7 +2321,7 @@ function getCveInfoFromAlertsMap(alertsMap, options_) {
2284
2321
  const name = packages.resolvePackageName(purlObj);
2285
2322
  sockPkgAlertsLoop: for (const sockPkgAlert of sockPkgAlerts) {
2286
2323
  const alert = sockPkgAlert.raw;
2287
- if (alert.fix?.type !== ALERT_FIX_TYPE.cve || options.exclude.upgradable && registry.getManifestData(sockPkgAlert.ecosystem, name)) {
2324
+ if (alert.fix?.type !== ALERT_FIX_TYPE.cve || exclude.upgradable && registry.getManifestData(sockPkgAlert.ecosystem, name)) {
2288
2325
  continue sockPkgAlertsLoop;
2289
2326
  }
2290
2327
  if (!infoByPartialPurl) {
@@ -2314,18 +2351,19 @@ function getCveInfoFromAlertsMap(alertsMap, options_) {
2314
2351
  // semver.Range will parse it without erroring.
2315
2352
  vulnerableVersionRange.replace(/, +/g, ' ').replace(/; +/g, ' || ')).format()
2316
2353
  });
2317
- if (++count >= options.limit) {
2318
- break alertsMapLoop;
2319
- }
2320
2354
  continue sockPkgAlertsLoop;
2321
2355
  } catch (e) {
2322
2356
  error = e;
2323
2357
  }
2324
2358
  }
2325
- debug.debugFn('fail: invalid SocketPackageAlert\n', alert);
2359
+ debug.debugFn('error', 'fail: invalid SocketPackageAlert');
2360
+ debug.debugDir('inspect', {
2361
+ alert
2362
+ });
2326
2363
  if (error) {
2327
- // Explicitly use debugLog here.
2328
- debug.debugLog(error.message ?? error);
2364
+ debug.debugDir('inspect', {
2365
+ error: error.message ?? error
2366
+ });
2329
2367
  }
2330
2368
  }
2331
2369
  }
@@ -2583,7 +2621,7 @@ async function getAlertsMapFromPurls(purls, options_) {
2583
2621
  spinner
2584
2622
  } = options;
2585
2623
  const uniqPurls = arrays.arrayUnique(purls);
2586
- debug.debugFn('inspect:', {
2624
+ debug.debugDir('inspect', {
2587
2625
  purls: uniqPurls
2588
2626
  });
2589
2627
  let {
@@ -2630,7 +2668,7 @@ async function getAlertsMapFromPurls(purls, options_) {
2630
2668
  } else {
2631
2669
  spinner?.stop();
2632
2670
  logger.logger.fail(`Received a ${batchResult.status} response from Socket API which we consider a permanent failure:`, batchResult.error, batchResult.cause ? `( ${batchResult.cause} )` : '');
2633
- debug.debugFn('inspect:', {
2671
+ debug.debugDir('inspect', {
2634
2672
  batchResult
2635
2673
  });
2636
2674
  break;
@@ -2815,9 +2853,53 @@ function runAgentInstall(pkgEnvDetails, options) {
2815
2853
  });
2816
2854
  }
2817
2855
 
2856
+ async function getNpmConfig(options) {
2857
+ const {
2858
+ cwd = process.cwd(),
2859
+ env = process.env,
2860
+ execPath = process.execPath,
2861
+ nodeVersion = process.version,
2862
+ npmCommand = 'install',
2863
+ npmPath = getNpmPath(),
2864
+ npmVersion,
2865
+ platform = process.platform
2866
+ } = {
2867
+ __proto__: null,
2868
+ ...options
2869
+ };
2870
+ const config = new vendor.libExports$2({
2871
+ argv: [],
2872
+ cwd,
2873
+ definitions: vendor.definitionsExports.definitions,
2874
+ execPath,
2875
+ env: {
2876
+ ...env
2877
+ },
2878
+ flatten: vendor.definitionsExports.flatten,
2879
+ npmPath,
2880
+ platform,
2881
+ shorthands: vendor.definitionsExports.shorthands
2882
+ });
2883
+ await config.load();
2884
+ const flatConfig = {
2885
+ __proto__: null,
2886
+ ...config.flat
2887
+ };
2888
+ if (nodeVersion) {
2889
+ flatConfig.nodeVersion = nodeVersion;
2890
+ }
2891
+ if (npmCommand) {
2892
+ flatConfig.npmCommand = npmCommand;
2893
+ }
2894
+ if (npmVersion) {
2895
+ flatConfig.npmVersion = npmVersion.toString();
2896
+ }
2897
+ return flatConfig;
2898
+ }
2899
+
2818
2900
  async function spawnCoana(args, options, extra) {
2819
2901
  const {
2820
- env: optionsEnv
2902
+ env: spawnEnv
2821
2903
  } = {
2822
2904
  __proto__: null,
2823
2905
  ...options
@@ -2831,7 +2913,7 @@ async function spawnCoana(args, options, extra) {
2831
2913
  ...options,
2832
2914
  env: {
2833
2915
  ...process.env,
2834
- ...optionsEnv,
2916
+ ...spawnEnv,
2835
2917
  SOCKET_CLI_API_BASE_URL: constants.ENV.SOCKET_CLI_API_BASE_URL || undefined,
2836
2918
  SOCKET_CLI_API_TOKEN: getDefaultToken()
2837
2919
  }
@@ -2950,7 +3032,10 @@ async function getAgentVersion(agentExecPath, cwd) {
2950
3032
  shell: constants.WIN32
2951
3033
  })).stdout) ?? undefined;
2952
3034
  } catch (e) {
2953
- debug.debugFn('catch: unexpected\n', e);
3035
+ debug.debugFn('error', 'caught: unexpected error');
3036
+ debug.debugDir('inspect', {
3037
+ error: e
3038
+ });
2954
3039
  }
2955
3040
  return result;
2956
3041
  }
@@ -3269,6 +3354,7 @@ exports.getFlagListOutput = getFlagListOutput;
3269
3354
  exports.getMajor = getMajor;
3270
3355
  exports.getMinVersion = getMinVersion;
3271
3356
  exports.getNpmBinPath = getNpmBinPath;
3357
+ exports.getNpmConfig = getNpmConfig;
3272
3358
  exports.getNpmRequire = getNpmRequire;
3273
3359
  exports.getNpxBinPath = getNpxBinPath;
3274
3360
  exports.getOutputKind = getOutputKind;
@@ -3319,5 +3405,5 @@ exports.tildify = tildify;
3319
3405
  exports.updateConfigValue = updateConfigValue;
3320
3406
  exports.walkNestedMap = walkNestedMap;
3321
3407
  exports.writeSocketJson = writeSocketJson;
3322
- //# debugId=738e476d-5a8a-49d7-a6be-c50b9907d6f1
3408
+ //# debugId=eb6ded0e-8a00-491a-8cc2-3f17e694bc2c
3323
3409
  //# sourceMappingURL=utils.js.map