@socketsecurity/cli-with-sentry 1.0.96 → 1.0.97

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 (42) hide show
  1. package/dist/cli.js +164 -164
  2. package/dist/cli.js.map +1 -1
  3. package/dist/constants.js +3 -3
  4. package/dist/constants.js.map +1 -1
  5. package/dist/shadow-npm-bin.js +3 -3
  6. package/dist/shadow-npm-bin.js.map +1 -1
  7. package/dist/shadow-npm-inject.js +29 -49
  8. package/dist/shadow-npm-inject.js.map +1 -1
  9. package/dist/tsconfig.dts.tsbuildinfo +1 -1
  10. package/dist/types/commands/fix/shared.d.mts +2 -1
  11. package/dist/types/commands/fix/shared.d.mts.map +1 -1
  12. package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts.map +1 -1
  13. package/dist/types/shadow/npm/arborist-helpers.d.mts +5 -5
  14. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
  15. package/dist/types/utils/alert/severity.d.mts.map +1 -1
  16. package/dist/types/utils/alerts-map.d.mts +4 -3
  17. package/dist/types/utils/alerts-map.d.mts.map +1 -1
  18. package/dist/types/utils/config.d.mts +5 -4
  19. package/dist/types/utils/config.d.mts.map +1 -1
  20. package/dist/types/utils/filter-config.d.mts +5 -0
  21. package/dist/types/utils/filter-config.d.mts.map +1 -0
  22. package/dist/types/utils/sdk.d.mts +3 -3
  23. package/dist/types/utils/sdk.d.mts.map +1 -1
  24. package/dist/types/utils/socket-package-alert.d.mts +7 -5
  25. package/dist/types/utils/socket-package-alert.d.mts.map +1 -1
  26. package/dist/utils.js +207 -207
  27. package/dist/utils.js.map +1 -1
  28. package/dist/vendor.js +38 -36
  29. package/external/@coana-tech/cli/cli-wrapper.mjs +1 -0
  30. package/external/@coana-tech/cli/cli.mjs +281 -172
  31. package/external/@coana-tech/cli/reachability-analyzers-cli.mjs +134 -63
  32. package/external/@coana-tech/cli/repos/coana-tech/alucard/alucard.jar +0 -0
  33. package/external/@coana-tech/cli/repos/coana-tech/class-graph-analysis/dist/bundle/class-graph-analysis-cli.mjs +2337 -2821
  34. package/external/@coana-tech/cli/repos/coana-tech/cocoa/release/Coana.Cocoa.dll +0 -0
  35. package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
  36. package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
  37. package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
  38. package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
  39. package/external/@socketsecurity/registry/lib/objects.js +16 -0
  40. package/package.json +7 -7
  41. package/dist/types/utils/strings.d.mts +0 -2
  42. package/dist/types/utils/strings.d.mts.map +0 -1
package/dist/utils.js CHANGED
@@ -3,8 +3,8 @@
3
3
  var vendor = require('./vendor.js');
4
4
  var logger = require('../external/@socketsecurity/registry/lib/logger');
5
5
  var strings = require('../external/@socketsecurity/registry/lib/strings');
6
- var require$$6 = require('../external/@socketsecurity/registry/lib/debug');
7
- var require$$7 = require('../external/@socketsecurity/registry/lib/objects');
6
+ var require$$8 = require('../external/@socketsecurity/registry/lib/debug');
7
+ var require$$9 = require('../external/@socketsecurity/registry/lib/objects');
8
8
  var arrays = require('../external/@socketsecurity/registry/lib/arrays');
9
9
  var path$1 = require('../external/@socketsecurity/registry/lib/path');
10
10
  var sorts = require('../external/@socketsecurity/registry/lib/sorts');
@@ -94,14 +94,17 @@ function findSocketYmlSync(dir = process.cwd()) {
94
94
  path: ymlPath,
95
95
  parsed: vendor.configExports.parseSocketConfig(yml)
96
96
  };
97
- } catch {
97
+ } catch (e) {
98
+ require$$8.debugDir('inspect', {
99
+ error: e
100
+ });
98
101
  throw new Error(`Found file but was unable to parse ${ymlPath}`);
99
102
  }
100
103
  }
101
104
  prevDir = dir;
102
105
  dir = path.join(dir, '..');
103
106
  }
104
- return null;
107
+ return undefined;
105
108
  }
106
109
  function getConfigValue(key) {
107
110
  const localConfig = getConfigValues();
@@ -148,7 +151,7 @@ let _cachedConfig;
148
151
  // When using --config or SOCKET_CLI_CONFIG, do not persist the config.
149
152
  let _readOnlyConfig = false;
150
153
  function overrideCachedConfig(jsonConfig) {
151
- require$$6.debugFn('notice', 'override: full config (not stored)');
154
+ require$$8.debugFn('notice', 'override: full config (not stored)');
152
155
  let config;
153
156
  try {
154
157
  config = JSON.parse(String(jsonConfig));
@@ -190,7 +193,7 @@ function overrideCachedConfig(jsonConfig) {
190
193
  };
191
194
  }
192
195
  function overrideConfigApiToken(apiToken) {
193
- require$$6.debugFn('notice', 'override: Socket API token (not stored)');
196
+ require$$8.debugFn('notice', 'override: Socket API token (not stored)');
194
197
  // Set token to the local cached config and mark it read-only so it doesn't persist.
195
198
  _cachedConfig = {
196
199
  ...vendor.configExports,
@@ -282,39 +285,39 @@ function isUrl(value) {
282
285
 
283
286
  // This Socket API token should be stored globally for the duration of the CLI execution.
284
287
  let _defaultToken;
285
- function getDefaultToken() {
288
+ function getDefaultApiToken() {
286
289
  // Lazily access constants.ENV.SOCKET_CLI_NO_API_TOKEN.
287
290
  if (constants.ENV.SOCKET_CLI_NO_API_TOKEN) {
288
291
  _defaultToken = undefined;
289
- } else {
290
- const key =
291
- // Lazily access constants.ENV.SOCKET_CLI_API_TOKEN.
292
- constants.ENV.SOCKET_CLI_API_TOKEN || getConfigValueOrUndef('apiToken') || _defaultToken;
293
- _defaultToken = strings.isNonEmptyString(key) ? key : undefined;
292
+ return _defaultToken;
294
293
  }
294
+ const key =
295
+ // Lazily access constants.ENV.SOCKET_CLI_API_TOKEN.
296
+ constants.ENV.SOCKET_CLI_API_TOKEN || getConfigValueOrUndef('apiToken') || _defaultToken;
297
+ _defaultToken = strings.isNonEmptyString(key) ? key : undefined;
295
298
  return _defaultToken;
296
299
  }
297
- function getVisibleTokenPrefix() {
298
- const apiToken = getDefaultToken();
299
- return apiToken ? apiToken.slice(TOKEN_PREFIX_LENGTH, TOKEN_PREFIX_LENGTH + TOKEN_VISIBLE_LENGTH) : '';
300
- }
301
- function hasDefaultToken() {
302
- return !!getDefaultToken();
303
- }
304
- function getPublicToken() {
305
- return getDefaultToken() ||
300
+ function getPublicApiToken() {
301
+ return getDefaultApiToken() ||
306
302
  // Lazily access constants.ENV.SOCKET_CLI_API_TOKEN.
307
303
  constants.ENV.SOCKET_CLI_API_TOKEN ||
308
304
  // Lazily access constants.SOCKET_PUBLIC_API_TOKEN.
309
305
  constants.SOCKET_PUBLIC_API_TOKEN;
310
306
  }
307
+ function getVisibleTokenPrefix() {
308
+ const apiToken = getDefaultApiToken();
309
+ return apiToken ? apiToken.slice(TOKEN_PREFIX_LENGTH, TOKEN_PREFIX_LENGTH + TOKEN_VISIBLE_LENGTH) : '';
310
+ }
311
+ function hasDefaultApiToken() {
312
+ return !!getDefaultApiToken();
313
+ }
311
314
  async function setupSdk(options) {
312
315
  const opts = {
313
316
  __proto__: null,
314
317
  ...options
315
318
  };
316
319
  let {
317
- apiToken = getDefaultToken()
320
+ apiToken = getDefaultApiToken()
318
321
  } = opts;
319
322
  if (typeof apiToken !== 'string' && vendor.isInteractiveExports()) {
320
323
  apiToken = await prompts.password({
@@ -423,11 +426,11 @@ async function handleApiCall(value, options) {
423
426
  };
424
427
  if (desc) {
425
428
  logger.logger.fail(`An error was thrown while requesting ${desc}`);
426
- require$$6.debugFn('error', `caught: ${desc} error`);
429
+ require$$8.debugFn('error', `caught: ${desc} error`);
427
430
  } else {
428
- require$$6.debugFn('error', `caught: Socket API request error`);
431
+ require$$8.debugFn('error', `caught: Socket API request error`);
429
432
  }
430
- require$$6.debugDir('inspect', {
433
+ require$$8.debugDir('inspect', {
431
434
  error: e,
432
435
  socketSdkErrorResult
433
436
  });
@@ -449,8 +452,8 @@ async function handleApiCall(value, options) {
449
452
  code: sdkResult.status
450
453
  }
451
454
  };
452
- require$$6.debugFn('error', `fail:${desc ? ` ${desc}` : ''} bad response`);
453
- require$$6.debugDir('inspect', {
455
+ require$$8.debugFn('error', `fail:${desc ? ` ${desc}` : ''} bad response`);
456
+ require$$8.debugDir('inspect', {
454
457
  sdkResult
455
458
  });
456
459
  return socketSdkErrorResult;
@@ -468,8 +471,8 @@ async function handleApiCallNoSpinner(value, description) {
468
471
  } catch (e) {
469
472
  const message = `${e || NO_ERROR_MESSAGE}`;
470
473
  const reason = `${e || NO_ERROR_MESSAGE}`;
471
- require$$6.debugFn('error', `caught: ${description} error`);
472
- require$$6.debugDir('inspect', {
474
+ require$$8.debugFn('error', `caught: ${description} error`);
475
+ require$$8.debugDir('inspect', {
473
476
  error: e
474
477
  });
475
478
  return {
@@ -483,8 +486,8 @@ async function handleApiCallNoSpinner(value, description) {
483
486
  if (result.success === false) {
484
487
  const error = result;
485
488
  const message = `${error.error || NO_ERROR_MESSAGE}`;
486
- require$$6.debugFn('error', `fail: ${description} bad response`);
487
- require$$6.debugDir('inspect', {
489
+ require$$8.debugFn('error', `fail: ${description} bad response`);
490
+ require$$8.debugDir('inspect', {
488
491
  error
489
492
  });
490
493
  return {
@@ -516,7 +519,7 @@ async function queryApi(path, apiToken) {
516
519
  });
517
520
  }
518
521
  async function queryApiSafeText(path, fetchSpinnerDesc) {
519
- const apiToken = getDefaultToken();
522
+ const apiToken = getDefaultApiToken();
520
523
  if (!apiToken) {
521
524
  return {
522
525
  ok: false,
@@ -543,8 +546,8 @@ async function queryApiSafeText(path, fetchSpinnerDesc) {
543
546
  spinner.failAndStop(`An error was thrown while requesting ${fetchSpinnerDesc}.`);
544
547
  }
545
548
  const cause = e?.message;
546
- require$$6.debugFn('error', 'caught: await queryApi() error');
547
- require$$6.debugDir('inspect', {
549
+ require$$8.debugFn('error', 'caught: await queryApi() error');
550
+ require$$8.debugDir('inspect', {
548
551
  error: e
549
552
  });
550
553
  return {
@@ -570,8 +573,8 @@ async function queryApiSafeText(path, fetchSpinnerDesc) {
570
573
  data
571
574
  };
572
575
  } catch (e) {
573
- require$$6.debugFn('error', 'caught: await result.text() error');
574
- require$$6.debugDir('inspect', {
576
+ require$$8.debugFn('error', 'caught: await result.text() error');
577
+ require$$8.debugDir('inspect', {
575
578
  error: e
576
579
  });
577
580
  return {
@@ -600,7 +603,7 @@ async function queryApiSafeJson(path, fetchSpinnerDesc = '') {
600
603
  }
601
604
  }
602
605
  async function sendApiRequest(path, options) {
603
- const apiToken = getDefaultToken();
606
+ const apiToken = getDefaultApiToken();
604
607
  if (!apiToken) {
605
608
  return {
606
609
  ok: false,
@@ -641,8 +644,8 @@ async function sendApiRequest(path, options) {
641
644
  spinner.failAndStop(`An error was thrown while requesting ${options.fetchSpinnerDesc}.`);
642
645
  }
643
646
  const cause = e?.message;
644
- require$$6.debugFn('error', `caught: await fetch() ${options.method} error`);
645
- require$$6.debugDir('inspect', {
647
+ require$$8.debugFn('error', `caught: await fetch() ${options.method} error`);
648
+ require$$8.debugDir('inspect', {
646
649
  error: e
647
650
  });
648
651
  return {
@@ -671,8 +674,8 @@ async function sendApiRequest(path, options) {
671
674
  data: data
672
675
  };
673
676
  } catch (e) {
674
- require$$6.debugFn('error', 'caught: await result.json() error');
675
- require$$6.debugDir('inspect', {
677
+ require$$8.debugFn('error', 'caught: await result.json() error');
678
+ require$$8.debugDir('inspect', {
676
679
  error: e
677
680
  });
678
681
  return {
@@ -781,9 +784,9 @@ cols) {
781
784
  // Serialize the final result object before printing it
782
785
  // All commands that support the --json flag should call this before printing
783
786
  function serializeResultJson(data) {
784
- if (!require$$7.isObject(data)) {
787
+ if (!require$$9.isObject(data)) {
785
788
  process.exitCode = 1;
786
- require$$6.debugFn('inspect', {
789
+ require$$8.debugFn('inspect', {
787
790
  data
788
791
  });
789
792
 
@@ -801,7 +804,7 @@ function serializeResultJson(data) {
801
804
  process.exitCode = 1;
802
805
  const message = 'There was a problem converting the data set to JSON. Please try again without --json';
803
806
  logger.logger.fail(message);
804
- require$$6.debugDir('inspect', {
807
+ require$$8.debugDir('inspect', {
805
808
  error: e
806
809
  });
807
810
 
@@ -939,7 +942,7 @@ function getHelpListOutput(list, options) {
939
942
  const names = Object.keys(list).sort(sorts.naturalCompare);
940
943
  for (const name of names) {
941
944
  const entry = list[name];
942
- const entryIsObj = require$$7.isObject(entry);
945
+ const entryIsObj = require$$9.isObject(entry);
943
946
  if (entryIsObj && 'hidden' in entry && entry?.hidden) {
944
947
  continue;
945
948
  }
@@ -1210,10 +1213,10 @@ async function meowWithSubcommands(subcommands, options) {
1210
1213
  } else {
1211
1214
  lines.push('Commands');
1212
1215
  lines.push(` ${getHelpListOutput({
1213
- ...require$$7.toSortedObject(Object.fromEntries(Object.entries(subcommands).filter(({
1216
+ ...require$$9.toSortedObject(Object.fromEntries(Object.entries(subcommands).filter(({
1214
1217
  1: subcommand
1215
1218
  }) => !subcommand.hidden))),
1216
- ...require$$7.toSortedObject(Object.fromEntries(Object.entries(aliases).filter(({
1219
+ ...require$$9.toSortedObject(Object.fromEntries(Object.entries(aliases).filter(({
1217
1220
  1: alias
1218
1221
  }) => {
1219
1222
  const {
@@ -1333,7 +1336,7 @@ function meowOrExit({
1333
1336
  }
1334
1337
 
1335
1338
  // meow doesn't detect 'version' as an unknown flag, so we do the leg work here.
1336
- if (!require$$7.hasOwn(config.flags, 'version') && cli.flags['version']) {
1339
+ if (!require$$9.hasOwn(config.flags, 'version') && cli.flags['version']) {
1337
1340
  // Use `console.error` here instead of `logger.error` to match meow behavior.
1338
1341
  console.error('Unknown flag\n--version');
1339
1342
  // eslint-disable-next-line n/no-process-exit
@@ -1567,7 +1570,7 @@ async function determineOrgSlug(orgFlag, interactive, dryRun) {
1567
1570
  async function getDefaultOrgSlug() {
1568
1571
  const defaultOrgResult = getConfigValueOrUndef('defaultOrg');
1569
1572
  if (defaultOrgResult) {
1570
- require$$6.debugFn('notice', 'use: org from "defaultOrg" value of socket/settings local app data', defaultOrgResult);
1573
+ require$$8.debugFn('notice', 'use: org from "defaultOrg" value of socket/settings local app data', defaultOrgResult);
1571
1574
  return {
1572
1575
  ok: true,
1573
1576
  data: defaultOrgResult
@@ -1577,7 +1580,7 @@ async function getDefaultOrgSlug() {
1577
1580
  // Lazily access constants.ENV.SOCKET_CLI_ORG_SLUG.
1578
1581
  const envOrgSlug = constants.ENV.SOCKET_CLI_ORG_SLUG;
1579
1582
  if (envOrgSlug) {
1580
- require$$6.debugFn('notice', 'use: org from SOCKET_CLI_ORG_SLUG environment variable', envOrgSlug);
1583
+ require$$8.debugFn('notice', 'use: org from SOCKET_CLI_ORG_SLUG environment variable', envOrgSlug);
1581
1584
  return {
1582
1585
  ok: true,
1583
1586
  data: envOrgSlug
@@ -1606,7 +1609,7 @@ async function getDefaultOrgSlug() {
1606
1609
  data: `Cannot determine the default organization for the API token. Unable to continue.`
1607
1610
  };
1608
1611
  }
1609
- require$$6.debugFn('notice', 'resolve: org from Socket API', slug);
1612
+ require$$8.debugFn('notice', 'resolve: org from Socket API', slug);
1610
1613
  return {
1611
1614
  ok: true,
1612
1615
  message: 'Retrieved default org from server',
@@ -1659,21 +1662,21 @@ async function getBaseBranch(cwd = process.cwd()) {
1659
1662
  async function getRepoInfo(cwd = process.cwd()) {
1660
1663
  let info = null;
1661
1664
  const quotedCmd = '`git remote get-url origin`';
1662
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1665
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1663
1666
  try {
1664
1667
  const remoteUrl = (await spawn.spawn('git', ['remote', 'get-url', 'origin'], {
1665
1668
  cwd
1666
1669
  })).stdout;
1667
1670
  info = parseGitRemoteUrl(remoteUrl);
1668
1671
  if (!info) {
1669
- require$$6.debugFn('error', 'git: unmatched git remote URL format');
1670
- require$$6.debugDir('inspect', {
1672
+ require$$8.debugFn('error', 'git: unmatched git remote URL format');
1673
+ require$$8.debugDir('inspect', {
1671
1674
  remoteUrl
1672
1675
  });
1673
1676
  }
1674
1677
  } catch (e) {
1675
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1676
- require$$6.debugDir('inspect', {
1678
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1679
+ require$$8.debugDir('inspect', {
1677
1680
  error: e
1678
1681
  });
1679
1682
  }
@@ -1689,19 +1692,19 @@ async function gitBranch(cwd = process.cwd()) {
1689
1692
  cwd
1690
1693
  };
1691
1694
  let quotedCmd = '`git symbolic-ref --short HEAD`';
1692
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1695
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1693
1696
  // Try symbolic-ref first which returns the branch name or fails in a
1694
1697
  // detached HEAD state.
1695
1698
  try {
1696
1699
  const gitSymbolicRefResult = await spawn.spawn('git', ['symbolic-ref', '--short', 'HEAD'], stdioPipeOptions);
1697
- require$$6.debugDir('stdio', {
1700
+ require$$8.debugDir('stdio', {
1698
1701
  gitSymbolicRefResult
1699
1702
  });
1700
1703
  return gitSymbolicRefResult.stdout;
1701
1704
  } catch (e) {
1702
- if (require$$6.isDebug('stdio')) {
1703
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1704
- require$$6.debugDir('inspect', {
1705
+ if (require$$8.isDebug('stdio')) {
1706
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1707
+ require$$8.debugDir('inspect', {
1705
1708
  error: e
1706
1709
  });
1707
1710
  }
@@ -1709,17 +1712,17 @@ async function gitBranch(cwd = process.cwd()) {
1709
1712
  // Fallback to using rev-parse to get the short commit hash in a
1710
1713
  // detached HEAD state.
1711
1714
  quotedCmd = '`git rev-parse --short HEAD`';
1712
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1715
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1713
1716
  try {
1714
1717
  const gitRevParseResult = await spawn.spawn('git', ['rev-parse', '--short', 'HEAD'], stdioPipeOptions);
1715
- require$$6.debugDir('stdio', {
1718
+ require$$8.debugDir('stdio', {
1716
1719
  gitRevParseResult
1717
1720
  });
1718
1721
  return gitRevParseResult.stdout;
1719
1722
  } catch (e) {
1720
- if (require$$6.isDebug('stdio')) {
1721
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1722
- require$$6.debugDir('inspect', {
1723
+ if (require$$8.isDebug('stdio')) {
1724
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1725
+ require$$8.debugDir('inspect', {
1723
1726
  error: e
1724
1727
  });
1725
1728
  }
@@ -1752,16 +1755,16 @@ async function detectDefaultBranch(cwd = process.cwd()) {
1752
1755
  async function gitCleanFdx(cwd = process.cwd()) {
1753
1756
  const stdioIgnoreOptions = {
1754
1757
  cwd,
1755
- stdio: require$$6.isDebug('stdio') ? 'inherit' : 'ignore'
1758
+ stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
1756
1759
  };
1757
1760
  const quotedCmd = '`git clean -fdx`';
1758
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1761
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1759
1762
  try {
1760
1763
  await spawn.spawn('git', ['clean', '-fdx'], stdioIgnoreOptions);
1761
1764
  return true;
1762
1765
  } catch (e) {
1763
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1764
- require$$6.debugDir('inspect', {
1766
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1767
+ require$$8.debugDir('inspect', {
1765
1768
  error: e
1766
1769
  });
1767
1770
  }
@@ -1770,16 +1773,16 @@ async function gitCleanFdx(cwd = process.cwd()) {
1770
1773
  async function gitCheckoutBranch(branch, cwd = process.cwd()) {
1771
1774
  const stdioIgnoreOptions = {
1772
1775
  cwd,
1773
- stdio: require$$6.isDebug('stdio') ? 'inherit' : 'ignore'
1776
+ stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
1774
1777
  };
1775
1778
  const quotedCmd = `\`git checkout ${branch}\``;
1776
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1779
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1777
1780
  try {
1778
1781
  await spawn.spawn('git', ['checkout', branch], stdioIgnoreOptions);
1779
1782
  return true;
1780
1783
  } catch (e) {
1781
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1782
- require$$6.debugDir('inspect', {
1784
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1785
+ require$$8.debugDir('inspect', {
1783
1786
  error: e
1784
1787
  });
1785
1788
  }
@@ -1791,16 +1794,16 @@ async function gitCreateBranch(branch, cwd = process.cwd()) {
1791
1794
  }
1792
1795
  const stdioIgnoreOptions = {
1793
1796
  cwd,
1794
- stdio: require$$6.isDebug('stdio') ? 'inherit' : 'ignore'
1797
+ stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
1795
1798
  };
1796
1799
  const quotedCmd = `\`git branch ${branch}\``;
1797
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1800
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1798
1801
  try {
1799
1802
  await spawn.spawn('git', ['branch', branch], stdioIgnoreOptions);
1800
1803
  return true;
1801
1804
  } catch (e) {
1802
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1803
- require$$6.debugDir('inspect', {
1805
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1806
+ require$$8.debugDir('inspect', {
1804
1807
  error: e
1805
1808
  });
1806
1809
  }
@@ -1809,19 +1812,19 @@ async function gitCreateBranch(branch, cwd = process.cwd()) {
1809
1812
  async function gitPushBranch(branch, cwd = process.cwd()) {
1810
1813
  const stdioIgnoreOptions = {
1811
1814
  cwd,
1812
- stdio: require$$6.isDebug('stdio') ? 'inherit' : 'ignore'
1815
+ stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
1813
1816
  };
1814
1817
  const quotedCmd = `\`git push --force --set-upstream origin ${branch}\``;
1815
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1818
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1816
1819
  try {
1817
1820
  await spawn.spawn('git', ['push', '--force', '--set-upstream', 'origin', branch], stdioIgnoreOptions);
1818
1821
  return true;
1819
1822
  } catch (e) {
1820
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1823
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1821
1824
  if (spawn.isSpawnError(e) && e.code === 128) {
1822
- require$$6.debugFn('error', "denied: token requires write permissions for 'contents' and 'pull-requests'");
1825
+ require$$8.debugFn('error', "denied: token requires write permissions for 'contents' and 'pull-requests'");
1823
1826
  }
1824
- require$$6.debugDir('inspect', {
1827
+ require$$8.debugDir('inspect', {
1825
1828
  error: e
1826
1829
  });
1827
1830
  }
@@ -1829,7 +1832,7 @@ async function gitPushBranch(branch, cwd = process.cwd()) {
1829
1832
  }
1830
1833
  async function gitCommit(commitMsg, filepaths, options) {
1831
1834
  if (!filepaths.length) {
1832
- require$$6.debugFn('notice', `miss: no filepaths to add`);
1835
+ require$$8.debugFn('notice', `miss: no filepaths to add`);
1833
1836
  return false;
1834
1837
  }
1835
1838
  const {
@@ -1845,26 +1848,26 @@ async function gitCommit(commitMsg, filepaths, options) {
1845
1848
  await gitEnsureIdentity(user, email, cwd);
1846
1849
  const stdioIgnoreOptions = {
1847
1850
  cwd,
1848
- stdio: require$$6.isDebug('stdio') ? 'inherit' : 'ignore'
1851
+ stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
1849
1852
  };
1850
1853
  const quotedAddCmd = `\`git add ${filepaths.join(' ')}\``;
1851
- require$$6.debugFn('stdio', `spawn: ${quotedAddCmd}`);
1854
+ require$$8.debugFn('stdio', `spawn: ${quotedAddCmd}`);
1852
1855
  try {
1853
1856
  await spawn.spawn('git', ['add', ...filepaths], stdioIgnoreOptions);
1854
1857
  } catch (e) {
1855
- require$$6.debugFn('error', `caught: ${quotedAddCmd} failed`);
1856
- require$$6.debugDir('inspect', {
1858
+ require$$8.debugFn('error', `caught: ${quotedAddCmd} failed`);
1859
+ require$$8.debugDir('inspect', {
1857
1860
  error: e
1858
1861
  });
1859
1862
  }
1860
1863
  const quotedCommitCmd = `\`git commit -m ${commitMsg}\``;
1861
- require$$6.debugFn('stdio', `spawn: ${quotedCommitCmd}`);
1864
+ require$$8.debugFn('stdio', `spawn: ${quotedCommitCmd}`);
1862
1865
  try {
1863
1866
  await spawn.spawn('git', ['commit', '-m', commitMsg], stdioIgnoreOptions);
1864
1867
  return true;
1865
1868
  } catch (e) {
1866
- require$$6.debugFn('error', `caught: ${quotedCommitCmd} failed`);
1867
- require$$6.debugDir('inspect', {
1869
+ require$$8.debugFn('error', `caught: ${quotedCommitCmd} failed`);
1870
+ require$$8.debugDir('inspect', {
1868
1871
  error: e
1869
1872
  });
1870
1873
  }
@@ -1873,18 +1876,18 @@ async function gitCommit(commitMsg, filepaths, options) {
1873
1876
  async function gitDeleteBranch(branch, cwd = process.cwd()) {
1874
1877
  const stdioIgnoreOptions = {
1875
1878
  cwd,
1876
- stdio: require$$6.isDebug('stdio') ? 'inherit' : 'ignore'
1879
+ stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
1877
1880
  };
1878
1881
  const quotedCmd = `\`git branch -D ${branch}\``;
1879
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1882
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1880
1883
  try {
1881
1884
  // Will throw with exit code 1 if branch does not exist.
1882
1885
  await spawn.spawn('git', ['branch', '-D', branch], stdioIgnoreOptions);
1883
1886
  return true;
1884
1887
  } catch (e) {
1885
- if (require$$6.isDebug('stdio')) {
1886
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1887
- require$$6.debugDir('inspect', {
1888
+ if (require$$8.isDebug('stdio')) {
1889
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1890
+ require$$8.debugDir('inspect', {
1888
1891
  error: e
1889
1892
  });
1890
1893
  }
@@ -1903,18 +1906,18 @@ async function gitEnsureIdentity(name, email, cwd = process.cwd()) {
1903
1906
  let configValue;
1904
1907
  {
1905
1908
  const quotedCmd = `\`git config --get ${prop}\``;
1906
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1909
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1907
1910
  try {
1908
1911
  // Will throw with exit code 1 if the config property is not set.
1909
1912
  const gitConfigResult = await spawn.spawn('git', ['config', '--get', prop], stdioPipeOptions);
1910
- require$$6.debugDir('stdio', {
1913
+ require$$8.debugDir('stdio', {
1911
1914
  gitConfigResult
1912
1915
  });
1913
1916
  configValue = gitConfigResult.stdout;
1914
1917
  } catch (e) {
1915
- if (require$$6.isDebug('stdio')) {
1916
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1917
- require$$6.debugDir('inspect', {
1918
+ if (require$$8.isDebug('stdio')) {
1919
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1920
+ require$$8.debugDir('inspect', {
1918
1921
  error: e
1919
1922
  });
1920
1923
  }
@@ -1923,16 +1926,16 @@ async function gitEnsureIdentity(name, email, cwd = process.cwd()) {
1923
1926
  if (configValue !== value) {
1924
1927
  const stdioIgnoreOptions = {
1925
1928
  cwd,
1926
- stdio: require$$6.isDebug('stdio') ? 'inherit' : 'ignore'
1929
+ stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
1927
1930
  };
1928
1931
  const quotedCmd = `\`git config ${prop} ${value}\``;
1929
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1932
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1930
1933
  try {
1931
1934
  await spawn.spawn('git', ['config', prop, value], stdioIgnoreOptions);
1932
1935
  } catch (e) {
1933
- if (require$$6.isDebug('stdio')) {
1934
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1935
- require$$6.debugDir('inspect', {
1936
+ if (require$$8.isDebug('stdio')) {
1937
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1938
+ require$$8.debugDir('inspect', {
1936
1939
  error: e
1937
1940
  });
1938
1941
  }
@@ -1943,18 +1946,18 @@ async function gitEnsureIdentity(name, email, cwd = process.cwd()) {
1943
1946
  async function gitLocalBranchExists(branch, cwd = process.cwd()) {
1944
1947
  const stdioIgnoreOptions = {
1945
1948
  cwd,
1946
- stdio: require$$6.isDebug('stdio') ? 'inherit' : 'ignore'
1949
+ stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
1947
1950
  };
1948
1951
  const quotedCmd = `\`git show-ref --quiet refs/heads/${branch}\``;
1949
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1952
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1950
1953
  try {
1951
1954
  // Will throw with exit code 1 if the branch does not exist.
1952
1955
  await spawn.spawn('git', ['show-ref', '--quiet', `refs/heads/${branch}`], stdioIgnoreOptions);
1953
1956
  return true;
1954
1957
  } catch (e) {
1955
- if (require$$6.isDebug('stdio')) {
1956
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1957
- require$$6.debugDir('inspect', {
1958
+ if (require$$8.isDebug('stdio')) {
1959
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1960
+ require$$8.debugDir('inspect', {
1958
1961
  error: e
1959
1962
  });
1960
1963
  }
@@ -1966,17 +1969,17 @@ async function gitRemoteBranchExists(branch, cwd = process.cwd()) {
1966
1969
  cwd
1967
1970
  };
1968
1971
  const quotedCmd = `\`git ls-remote --heads origin ${branch}\``;
1969
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
1972
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1970
1973
  try {
1971
1974
  const lsRemoteResult = await spawn.spawn('git', ['ls-remote', '--heads', 'origin', branch], stdioPipeOptions);
1972
- require$$6.debugDir('stdio', {
1975
+ require$$8.debugDir('stdio', {
1973
1976
  lsRemoteResult
1974
1977
  });
1975
1978
  return lsRemoteResult.stdout.length > 0;
1976
1979
  } catch (e) {
1977
- if (require$$6.isDebug('stdio')) {
1978
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
1979
- require$$6.debugDir('inspect', {
1980
+ if (require$$8.isDebug('stdio')) {
1981
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
1982
+ require$$8.debugDir('inspect', {
1980
1983
  error: e
1981
1984
  });
1982
1985
  }
@@ -1992,16 +1995,16 @@ async function gitResetAndClean(branch = 'HEAD', cwd = process.cwd()) {
1992
1995
  async function gitResetHard(branch = 'HEAD', cwd = process.cwd()) {
1993
1996
  const stdioIgnoreOptions = {
1994
1997
  cwd,
1995
- stdio: require$$6.isDebug('stdio') ? 'inherit' : 'ignore'
1998
+ stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
1996
1999
  };
1997
2000
  const quotedCmd = `\`git reset --hard ${branch}\``;
1998
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
2001
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
1999
2002
  try {
2000
2003
  await spawn.spawn('git', ['reset', '--hard', branch], stdioIgnoreOptions);
2001
2004
  return true;
2002
2005
  } catch (e) {
2003
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
2004
- require$$6.debugDir('inspect', {
2006
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
2007
+ require$$8.debugDir('inspect', {
2005
2008
  error: e
2006
2009
  });
2007
2010
  }
@@ -2012,10 +2015,10 @@ async function gitUnstagedModifiedFiles(cwd = process.cwd()) {
2012
2015
  cwd
2013
2016
  };
2014
2017
  const quotedCmd = `\`git diff --name-only\``;
2015
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
2018
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
2016
2019
  try {
2017
2020
  const gitDiffResult = await spawn.spawn('git', ['diff', '--name-only'], stdioPipeOptions);
2018
- require$$6.debugDir('stdio', {
2021
+ require$$8.debugDir('stdio', {
2019
2022
  gitDiffResult
2020
2023
  });
2021
2024
  const changedFilesDetails = gitDiffResult.stdout;
@@ -2025,8 +2028,8 @@ async function gitUnstagedModifiedFiles(cwd = process.cwd()) {
2025
2028
  data: relPaths.map(p => path$1.normalizePath(p))
2026
2029
  };
2027
2030
  } catch (e) {
2028
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
2029
- require$$6.debugDir('inspect', {
2031
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
2032
+ require$$8.debugDir('inspect', {
2030
2033
  error: e
2031
2034
  });
2032
2035
  return {
@@ -2112,10 +2115,10 @@ function mapToObject(map) {
2112
2115
  function* walkNestedMap(map, keys = []) {
2113
2116
  for (const [key, value] of map.entries()) {
2114
2117
  if (value instanceof Map) {
2115
- yield* walkNestedMap(value, keys.concat(key));
2118
+ yield* walkNestedMap(value, [...keys, key]);
2116
2119
  } else {
2117
2120
  yield {
2118
- keys: keys.concat(key),
2121
+ keys: [...keys, key],
2119
2122
  value: value
2120
2123
  };
2121
2124
  }
@@ -2140,7 +2143,7 @@ async function spawnCoana(args, orgSlug, options, extra) {
2140
2143
  // Lazily access constants.ENV.INLINED_SOCKET_CLI_VERSION.
2141
2144
  SOCKET_CLI_VERSION: constants.ENV.INLINED_SOCKET_CLI_VERSION
2142
2145
  };
2143
- const defaultApiToken = getDefaultToken();
2146
+ const defaultApiToken = getDefaultApiToken();
2144
2147
  if (defaultApiToken) {
2145
2148
  mixinsEnv['SOCKET_CLI_API_TOKEN'] = defaultApiToken;
2146
2149
  }
@@ -2512,7 +2515,7 @@ function getDefaultSocketJson() {
2512
2515
  function readSocketJsonSync(cwd, defaultOnError = false) {
2513
2516
  const sockJsonPath = path.join(cwd, 'socket.json');
2514
2517
  if (!fs$1.existsSync(sockJsonPath)) {
2515
- require$$6.debugFn('notice', `miss: socket.json not found at ${cwd}`);
2518
+ require$$8.debugFn('notice', `miss: socket.json not found at ${cwd}`);
2516
2519
  return {
2517
2520
  ok: true,
2518
2521
  data: getDefaultSocketJson()
@@ -2524,7 +2527,7 @@ function readSocketJsonSync(cwd, defaultOnError = false) {
2524
2527
  } catch (e) {
2525
2528
  if (defaultOnError) {
2526
2529
  logger.logger.warn('Failed to read socket.json, using default');
2527
- require$$6.debugDir('inspect', {
2530
+ require$$8.debugDir('inspect', {
2528
2531
  error: e
2529
2532
  });
2530
2533
  return {
@@ -2533,7 +2536,7 @@ function readSocketJsonSync(cwd, defaultOnError = false) {
2533
2536
  };
2534
2537
  }
2535
2538
  const msg = e?.message;
2536
- require$$6.debugDir('inspect', {
2539
+ require$$8.debugDir('inspect', {
2537
2540
  error: e
2538
2541
  });
2539
2542
  return {
@@ -2546,8 +2549,8 @@ function readSocketJsonSync(cwd, defaultOnError = false) {
2546
2549
  try {
2547
2550
  obj = JSON.parse(json);
2548
2551
  } catch (e) {
2549
- require$$6.debugFn('error', 'caught: JSON.parse error');
2550
- require$$6.debugDir('inspect', {
2552
+ require$$8.debugFn('error', 'caught: JSON.parse error');
2553
+ require$$8.debugDir('inspect', {
2551
2554
  error: e,
2552
2555
  json
2553
2556
  });
@@ -2584,8 +2587,8 @@ async function writeSocketJson(cwd, sockJson) {
2584
2587
  try {
2585
2588
  json = JSON.stringify(sockJson, null, 2);
2586
2589
  } catch (e) {
2587
- require$$6.debugFn('error', 'caught: JSON.stringify error');
2588
- require$$6.debugDir('inspect', {
2590
+ require$$8.debugFn('error', 'caught: JSON.stringify error');
2591
+ require$$8.debugDir('inspect', {
2589
2592
  error: e,
2590
2593
  sockJson
2591
2594
  });
@@ -2759,6 +2762,20 @@ class ColorOrMarkdown {
2759
2762
  }
2760
2763
  }
2761
2764
 
2765
+ function toFilterConfig(obj) {
2766
+ const normalized = {
2767
+ __proto__: null
2768
+ };
2769
+ const keys = require$$9.isObject(obj) ? Object.keys(obj) : [];
2770
+ for (const key of keys) {
2771
+ const value = obj[key];
2772
+ if (typeof value === 'boolean' || Array.isArray(value)) {
2773
+ normalized[key] = value;
2774
+ }
2775
+ }
2776
+ return normalized;
2777
+ }
2778
+
2762
2779
  const RangeStyles = ['caret', 'gt', 'gte', 'lt', 'lte', 'pin', 'preserve', 'tilde'];
2763
2780
  function applyRange(refRange, version, style = 'preserve') {
2764
2781
  switch (style) {
@@ -2889,33 +2906,28 @@ async function addArtifactToAlertsMap(artifact, alertsByPurl, options) {
2889
2906
  if (!artifact.name || !artifact.version || !artifact.alerts?.length) {
2890
2907
  return alertsByPurl;
2891
2908
  }
2909
+ const {
2910
+ type: ecosystem,
2911
+ version
2912
+ } = artifact;
2892
2913
  const {
2893
2914
  consolidate = false,
2894
- include: _include,
2895
- overrides
2915
+ overrides,
2916
+ socketYml
2896
2917
  } = {
2897
2918
  __proto__: null,
2898
2919
  ...options
2899
2920
  };
2900
- const socketYml = findSocketYmlSync();
2901
- const localRules = socketYml?.parsed.issueRules;
2902
- const include = {
2903
- __proto__: null,
2921
+ const name = packages.resolvePackageName(artifact);
2922
+ const filterConfig = toFilterConfig({
2904
2923
  blocked: true,
2905
2924
  critical: true,
2906
2925
  cve: true,
2907
- unfixable: true,
2908
- upgradable: false,
2909
- ..._include
2910
- };
2911
- const name = packages.resolvePackageName(artifact);
2912
- const {
2913
- type: ecosystem,
2914
- version
2915
- } = artifact;
2926
+ ...require$$9.getOwn(options, 'filter')
2927
+ });
2916
2928
  const enabledState = {
2917
2929
  __proto__: null,
2918
- ...localRules
2930
+ ...socketYml?.issueRules
2919
2931
  };
2920
2932
  let sockPkgAlerts = [];
2921
2933
  for (const alert of artifact.alerts) {
@@ -2931,8 +2943,8 @@ async function addArtifactToAlertsMap(artifact, alertsByPurl, options) {
2931
2943
  const fixableCve = fixType === ALERT_FIX_TYPE.cve;
2932
2944
  const fixableUpgrade = fixType === ALERT_FIX_TYPE.upgrade;
2933
2945
  const fixable = fixableCve || fixableUpgrade;
2934
- const upgradable = fixableUpgrade && !require$$7.hasOwn(overrides, name);
2935
- if (include.blocked && blocked || include.critical && critical || include.cve && cve || include.unfixable && !fixable || include.upgradable && upgradable) {
2946
+ const upgradable = fixableUpgrade && !require$$9.hasOwn(overrides, name);
2947
+ if (filterConfig.blocked && blocked || filterConfig.critical && critical || filterConfig.cve && cve || filterConfig.fixable && fixable || filterConfig.upgradable && upgradable) {
2936
2948
  sockPkgAlerts.push({
2937
2949
  name,
2938
2950
  version,
@@ -3024,16 +3036,7 @@ function getAlertsSeverityOrder(alerts) {
3024
3036
  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;
3025
3037
  }
3026
3038
  function getCveInfoFromAlertsMap(alertsMap, options) {
3027
- const {
3028
- exclude: exclude_
3029
- } = {
3030
- __proto__: null,
3031
- ...options
3032
- };
3033
- const exclude = {
3034
- __proto__: null,
3035
- ...exclude_
3036
- };
3039
+ const filterConfig = toFilterConfig(require$$9.getOwn(options, 'filter'));
3037
3040
  let infoByPartialPurl = null;
3038
3041
  // eslint-disable-next-line no-unused-labels
3039
3042
  for (const {
@@ -3045,7 +3048,7 @@ function getCveInfoFromAlertsMap(alertsMap, options) {
3045
3048
  const name = packages.resolvePackageName(purlObj);
3046
3049
  sockPkgAlertsLoop: for (const sockPkgAlert of sockPkgAlerts) {
3047
3050
  const alert = sockPkgAlert.raw;
3048
- if (alert.fix?.type !== ALERT_FIX_TYPE.cve || exclude.upgradable && registry.getManifestData(sockPkgAlert.ecosystem, name)) {
3051
+ if (alert.fix?.type !== ALERT_FIX_TYPE.cve || filterConfig.upgradable === false && registry.getManifestData(sockPkgAlert.ecosystem, name)) {
3049
3052
  continue sockPkgAlertsLoop;
3050
3053
  }
3051
3054
  if (!infoByPartialPurl) {
@@ -3080,8 +3083,8 @@ function getCveInfoFromAlertsMap(alertsMap, options) {
3080
3083
  error = e;
3081
3084
  }
3082
3085
  }
3083
- require$$6.debugFn('error', 'fail: invalid SocketPackageAlert');
3084
- require$$6.debugDir('inspect', {
3086
+ require$$8.debugFn('error', 'fail: invalid SocketPackageAlert');
3087
+ require$$8.debugDir('inspect', {
3085
3088
  alert,
3086
3089
  error
3087
3090
  });
@@ -3296,7 +3299,7 @@ function parsePnpmLockfile(lockfileContent) {
3296
3299
  result = vendor.jsYaml.load(strings.stripBom(lockfileContent));
3297
3300
  } catch {}
3298
3301
  }
3299
- return require$$7.isObjectObject(result) ? result : null;
3302
+ return require$$9.isObjectObject(result) ? result : null;
3300
3303
  }
3301
3304
  function parsePnpmLockfileVersion(version) {
3302
3305
  try {
@@ -3321,28 +3324,8 @@ async function getAlertsMapFromPnpmLockfile(lockfile, options) {
3321
3324
  });
3322
3325
  }
3323
3326
  async function getAlertsMapFromPurls(purls, options) {
3324
- const opts = {
3325
- __proto__: null,
3326
- consolidate: false,
3327
- include: undefined,
3328
- nothrow: false,
3329
- ...options
3330
- };
3331
- opts.include = {
3332
- __proto__: null,
3333
- // Leave 'actions' unassigned so it can be given a default value in
3334
- // subsequent functions where `options` is passed.
3335
- // actions: undefined,
3336
- blocked: true,
3337
- critical: true,
3338
- cve: true,
3339
- existing: false,
3340
- unfixable: true,
3341
- upgradable: false,
3342
- ...opts.include
3343
- };
3344
3327
  const uniqPurls = arrays.arrayUnique(purls);
3345
- require$$6.debugDir('silly', {
3328
+ require$$8.debugDir('silly', {
3346
3329
  purls: uniqPurls
3347
3330
  });
3348
3331
  let {
@@ -3352,23 +3335,35 @@ async function getAlertsMapFromPurls(purls, options) {
3352
3335
  if (!remaining) {
3353
3336
  return alertsByPurl;
3354
3337
  }
3338
+ const opts = {
3339
+ __proto__: null,
3340
+ consolidate: false,
3341
+ nothrow: false,
3342
+ ...options,
3343
+ filter: toFilterConfig(require$$9.getOwn(options, 'filter'))
3344
+ };
3345
+ if (opts.onlyFixable) {
3346
+ opts.filter.fixable = true;
3347
+ }
3355
3348
  const {
3356
3349
  spinner
3357
3350
  } = opts;
3358
3351
  const getText = () => `Looking up data for ${remaining} packages`;
3359
3352
  spinner?.start(getText());
3360
3353
  const sockSdkCResult = await setupSdk({
3361
- apiToken: getPublicToken()
3354
+ apiToken: getPublicApiToken()
3362
3355
  });
3363
3356
  if (!sockSdkCResult.ok) {
3364
3357
  spinner?.stop();
3365
- throw new Error('Auth error: Try to run `socket login` first');
3358
+ throw new Error('Auth error: Run `socket login` first');
3366
3359
  }
3367
3360
  const sockSdk = sockSdkCResult.data;
3361
+ const socketYml = findSocketYmlSync()?.parsed;
3368
3362
  const alertsMapOptions = {
3369
3363
  overrides: opts.overrides,
3370
3364
  consolidate: opts.consolidate,
3371
- include: opts.include,
3365
+ filter: opts.filter,
3366
+ socketYml,
3372
3367
  spinner
3373
3368
  };
3374
3369
  for await (const batchResult of sockSdk.batchPackageStream({
@@ -3379,24 +3374,28 @@ async function getAlertsMapFromPurls(purls, options) {
3379
3374
  queryParams: {
3380
3375
  alerts: 'true',
3381
3376
  compact: 'true',
3382
- ...(opts.include.actions ? {
3383
- actions: opts.include.actions.join(',')
3377
+ ...(opts.onlyFixable ? {
3378
+ fixable: 'true '
3384
3379
  } : {}),
3385
- ...(opts.include.unfixable ? {} : {
3386
- fixable: 'true'
3387
- })
3380
+ ...(Array.isArray(opts.filter.actions) ? {
3381
+ actions: opts.filter.actions.join(',')
3382
+ } : {})
3388
3383
  }
3389
3384
  })) {
3390
3385
  if (batchResult.success) {
3391
- await addArtifactToAlertsMap(batchResult.data, alertsByPurl, alertsMapOptions);
3386
+ const artifact = batchResult.data;
3387
+ await addArtifactToAlertsMap(artifact, alertsByPurl, alertsMapOptions);
3392
3388
  } else if (!opts.nothrow) {
3389
+ spinner?.stop();
3390
+ if (strings.isNonEmptyString(batchResult.error)) {
3391
+ throw new Error(batchResult.error);
3392
+ }
3393
3393
  const statusCode = batchResult.status ?? 'unknown';
3394
- const statusMessage = batchResult.error ?? 'No status message';
3395
- throw new Error(`Socket API server error (${statusCode}): ${statusMessage}`);
3394
+ throw new Error(`Socket API server error (${statusCode}): No status message`);
3396
3395
  } else {
3397
3396
  spinner?.stop();
3398
3397
  logger.logger.fail(`Received a ${batchResult.status} response from Socket API which we consider a permanent failure:`, batchResult.error, batchResult.cause ? `( ${batchResult.cause} )` : '');
3399
- require$$6.debugDir('inspect', {
3398
+ require$$8.debugDir('inspect', {
3400
3399
  batchResult
3401
3400
  });
3402
3401
  break;
@@ -3508,7 +3507,7 @@ function safeNpmInstall(options) {
3508
3507
  ...options
3509
3508
  };
3510
3509
  let stdio = spawnOptions.stdio;
3511
- const useIpc = require$$7.isObject(ipc);
3510
+ const useIpc = require$$9.isObject(ipc);
3512
3511
  // Include 'ipc' in the spawnOptions.stdio when an options.ipc object is provided.
3513
3512
  // See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166
3514
3513
  // and https://github.com/nodejs/node/blob/v23.6.0/lib/internal/child_process.js#L238.
@@ -3517,7 +3516,7 @@ function safeNpmInstall(options) {
3517
3516
  } else if (useIpc && Array.isArray(stdio) && !stdio.includes('ipc')) {
3518
3517
  stdio = stdio.concat('ipc');
3519
3518
  }
3520
- const useDebug = require$$6.isDebug('stdio');
3519
+ const useDebug = require$$8.isDebug('stdio');
3521
3520
  const terminatorPos = args.indexOf('--');
3522
3521
  const rawBinArgs = terminatorPos === -1 ? args : args.slice(0, terminatorPos);
3523
3522
  const progressArg = rawBinArgs.findLast(npm.isNpmProgressFlag) !== '--no-progress';
@@ -3748,7 +3747,7 @@ async function getAgentExecPath(agent) {
3748
3747
  async function getAgentVersion(agent, agentExecPath, cwd) {
3749
3748
  let result;
3750
3749
  const quotedCmd = `\`${agent} --version\``;
3751
- require$$6.debugFn('stdio', `spawn: ${quotedCmd}`);
3750
+ require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
3752
3751
  try {
3753
3752
  result =
3754
3753
  // Coerce version output into a valid semver version by passing it through
@@ -3762,8 +3761,8 @@ async function getAgentVersion(agent, agentExecPath, cwd) {
3762
3761
  shell: constants.WIN32
3763
3762
  })).stdout) ?? undefined;
3764
3763
  } catch (e) {
3765
- require$$6.debugFn('error', `caught: ${quotedCmd} failed`);
3766
- require$$6.debugDir('inspect', {
3764
+ require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
3765
+ require$$8.debugDir('inspect', {
3767
3766
  error: e
3768
3767
  });
3769
3768
  }
@@ -4086,7 +4085,7 @@ function captureExceptionSync(exception, hint) {
4086
4085
  if (!Sentry) {
4087
4086
  return '';
4088
4087
  }
4089
- require$$6.debugFn('notice', 'send: exception to Sentry');
4088
+ require$$8.debugFn('notice', 'send: exception to Sentry');
4090
4089
  return Sentry.captureException(exception, hint);
4091
4090
  }
4092
4091
 
@@ -4155,7 +4154,7 @@ exports.gitUnstagedModifiedFiles = gitUnstagedModifiedFiles;
4155
4154
  exports.globWorkspace = globWorkspace;
4156
4155
  exports.handleApiCall = handleApiCall;
4157
4156
  exports.handleApiCallNoSpinner = handleApiCallNoSpinner;
4158
- exports.hasDefaultToken = hasDefaultToken;
4157
+ exports.hasDefaultApiToken = hasDefaultApiToken;
4159
4158
  exports.hasEnterpriseOrgPlan = hasEnterpriseOrgPlan;
4160
4159
  exports.idToNpmPurl = idToNpmPurl;
4161
4160
  exports.idToPurl = idToPurl;
@@ -4190,8 +4189,9 @@ exports.setupSdk = setupSdk;
4190
4189
  exports.spawnCoana = spawnCoana;
4191
4190
  exports.suggestOrgSlug = suggestOrgSlug;
4192
4191
  exports.tildify = tildify;
4192
+ exports.toFilterConfig = toFilterConfig;
4193
4193
  exports.updateConfigValue = updateConfigValue;
4194
4194
  exports.walkNestedMap = walkNestedMap;
4195
4195
  exports.writeSocketJson = writeSocketJson;
4196
- //# debugId=5b3d9fc5-fd9d-410c-9fa5-fb1634dc1cb6
4196
+ //# debugId=398299e7-5ebf-41b6-8c6c-e7e2cae9cd1c
4197
4197
  //# sourceMappingURL=utils.js.map