@socketsecurity/cli-with-sentry 1.1.38 → 1.1.40

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [1.1.40](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.40) - 2025-12-02
8
+
9
+ ### Fixed
10
+ - Fix a bug where vulnerabilities were not found correctly during `socket fix`.
11
+
12
+ ### Changed
13
+ - Updated the Coana CLI to v `14.12.110`.
14
+
15
+ ## [1.1.39](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.39) - 2025-12-01
16
+
17
+ ### Added
18
+ - Added the `--output <scan-report.json>` flag to `socket scan reach`.
19
+
20
+ ### Changed
21
+ - Updated the Coana CLI to v `14.12.107`.
22
+
7
23
  ## [1.1.38](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.38) - 2025-11-26
8
24
 
9
25
  ### Changed
package/dist/cli.js CHANGED
@@ -1559,6 +1559,7 @@ async function performReachabilityAnalysis(options) {
1559
1559
  branchName,
1560
1560
  cwd = process.cwd(),
1561
1561
  orgSlug,
1562
+ outputPath,
1562
1563
  packagePaths,
1563
1564
  reachabilityOptions,
1564
1565
  repoName,
@@ -1638,9 +1639,9 @@ async function performReachabilityAnalysis(options) {
1638
1639
  }
1639
1640
  spinner?.start();
1640
1641
  spinner?.infoAndStop('Running reachability analysis with Coana...');
1641
-
1642
+ const outputFilePath = outputPath || constants.default.DOT_SOCKET_DOT_FACTS_JSON;
1642
1643
  // Build Coana arguments.
1643
- const coanaArgs = ['run', analysisTarget, '--output-dir', cwd, '--socket-mode', constants.default.DOT_SOCKET_DOT_FACTS_JSON, '--disable-report-submission', ...(reachabilityOptions.reachAnalysisTimeout ? ['--analysis-timeout', `${reachabilityOptions.reachAnalysisTimeout}`] : []), ...(reachabilityOptions.reachAnalysisMemoryLimit ? ['--memory-limit', `${reachabilityOptions.reachAnalysisMemoryLimit}`] : []), ...(reachabilityOptions.reachConcurrency ? ['--concurrency', `${reachabilityOptions.reachConcurrency}`] : []), ...(reachabilityOptions.reachDebug ? ['--debug'] : []), ...(reachabilityOptions.reachDisableAnalytics ? ['--disable-analytics-sharing'] : []), ...(reachabilityOptions.reachDisableAnalysisSplitting ? ['--disable-analysis-splitting'] : []), ...(tarHash ? ['--run-without-docker', '--manifests-tar-hash', tarHash] : []),
1644
+ const coanaArgs = ['run', analysisTarget, '--output-dir', path.dirname(outputFilePath), '--socket-mode', outputFilePath, '--disable-report-submission', ...(reachabilityOptions.reachAnalysisTimeout ? ['--analysis-timeout', `${reachabilityOptions.reachAnalysisTimeout}`] : []), ...(reachabilityOptions.reachAnalysisMemoryLimit ? ['--memory-limit', `${reachabilityOptions.reachAnalysisMemoryLimit}`] : []), ...(reachabilityOptions.reachConcurrency ? ['--concurrency', `${reachabilityOptions.reachConcurrency}`] : []), ...(reachabilityOptions.reachDebug ? ['--debug'] : []), ...(reachabilityOptions.reachDisableAnalytics ? ['--disable-analytics-sharing'] : []), ...(reachabilityOptions.reachDisableAnalysisSplitting ? ['--disable-analysis-splitting'] : []), ...(tarHash ? ['--run-without-docker', '--manifests-tar-hash', tarHash] : []),
1644
1645
  // Empty reachEcosystems implies scanning all ecosystems.
1645
1646
  ...(reachabilityOptions.reachEcosystems.length ? ['--purl-types', ...reachabilityOptions.reachEcosystems] : []), ...(reachabilityOptions.reachExcludePaths.length ? ['--exclude-dirs', ...reachabilityOptions.reachExcludePaths] : []), ...(reachabilityOptions.reachSkipCache ? ['--skip-cache-usage'] : [])];
1646
1647
 
@@ -1668,9 +1669,9 @@ async function performReachabilityAnalysis(options) {
1668
1669
  return coanaResult.ok ? {
1669
1670
  ok: true,
1670
1671
  data: {
1671
- // Use the DOT_SOCKET_DOT_FACTS_JSON file for the scan.
1672
- reachabilityReport: constants.default.DOT_SOCKET_DOT_FACTS_JSON,
1673
- tier1ReachabilityScanId: utils.extractTier1ReachabilityScanId(constants.default.DOT_SOCKET_DOT_FACTS_JSON)
1672
+ // Use the actual output filename for the scan.
1673
+ reachabilityReport: outputFilePath,
1674
+ tier1ReachabilityScanId: utils.extractTier1ReachabilityScanId(outputFilePath)
1674
1675
  }
1675
1676
  } : coanaResult;
1676
1677
  }
@@ -3688,7 +3689,7 @@ async function getFixEnv() {
3688
3689
  * Discovers GHSA IDs by running coana without applying fixes.
3689
3690
  * Returns a list of GHSA IDs, optionally limited.
3690
3691
  */
3691
- async function discoverGhsaIds(orgSlug, tarHash, fixConfig, options) {
3692
+ async function discoverGhsaIds(orgSlug, tarHash, options) {
3692
3693
  const {
3693
3694
  cwd = process.cwd(),
3694
3695
  limit,
@@ -3697,12 +3698,21 @@ async function discoverGhsaIds(orgSlug, tarHash, fixConfig, options) {
3697
3698
  __proto__: null,
3698
3699
  ...options
3699
3700
  };
3700
- const foundCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(fixConfig.minimumReleaseAge ? ['--minimum-release-age', fixConfig.minimumReleaseAge] : []), ...(fixConfig.include.length ? ['--include', ...fixConfig.include] : []), ...(fixConfig.exclude.length ? ['--exclude', ...fixConfig.exclude] : []), ...(fixConfig.disableMajorUpdates ? ['--disable-major-updates'] : []), ...(fixConfig.showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], orgSlug, {
3701
+ const foundCResult = await utils.spawnCoanaDlx(['find-vulnerabilities', cwd, '--manifests-tar-hash', tarHash], orgSlug, {
3701
3702
  cwd,
3702
3703
  spinner
3704
+ }, {
3705
+ stdio: 'pipe'
3703
3706
  });
3704
3707
  if (foundCResult.ok) {
3705
- const foundIds = utils.cmdFlagValueToArray(/(?<=Vulnerabilities found:).*/.exec(foundCResult.data));
3708
+ // Coana prints ghsaIds as json-formatted string on the final line of the output
3709
+ const foundIds = [];
3710
+ try {
3711
+ const ghsaIdsRaw = foundCResult.data.trim().split('\n').pop();
3712
+ if (ghsaIdsRaw) {
3713
+ foundIds.push(...JSON.parse(ghsaIdsRaw));
3714
+ }
3715
+ } catch {}
3706
3716
  return limit !== undefined ? foundIds.slice(0, limit) : foundIds;
3707
3717
  }
3708
3718
  return [];
@@ -3780,7 +3790,7 @@ async function coanaFix(fixConfig) {
3780
3790
  }
3781
3791
  let ids;
3782
3792
  if (isAll && limit > 0) {
3783
- ids = await discoverGhsaIds(orgSlug, tarHash, fixConfig, {
3793
+ ids = await discoverGhsaIds(orgSlug, tarHash, {
3784
3794
  cwd,
3785
3795
  limit,
3786
3796
  spinner
@@ -3863,7 +3873,7 @@ async function coanaFix(fixConfig) {
3863
3873
  const shouldSpawnCoana = adjustedLimit > 0;
3864
3874
  let ids;
3865
3875
  if (shouldSpawnCoana && isAll) {
3866
- ids = await discoverGhsaIds(orgSlug, tarHash, fixConfig, {
3876
+ ids = await discoverGhsaIds(orgSlug, tarHash, {
3867
3877
  cwd,
3868
3878
  limit: adjustedLimit,
3869
3879
  spinner
@@ -13336,8 +13346,8 @@ async function run$8(argv, importMeta, {
13336
13346
  }
13337
13347
 
13338
13348
  async function outputScanReach(result, {
13339
- cwd,
13340
- outputKind
13349
+ outputKind,
13350
+ outputPath
13341
13351
  }) {
13342
13352
  if (!result.ok) {
13343
13353
  process.exitCode = result.code ?? 1;
@@ -13350,9 +13360,10 @@ async function outputScanReach(result, {
13350
13360
  logger.logger.fail(utils.failMsgWithBadge(result.message, result.cause));
13351
13361
  return;
13352
13362
  }
13363
+ const actualOutputPath = outputPath || constants.default.DOT_SOCKET_DOT_FACTS_JSON;
13353
13364
  logger.logger.log('');
13354
13365
  logger.logger.success('Reachability analysis completed successfully!');
13355
- logger.logger.info(`Reachability report has been written to: ${path.join(cwd, constants.default.DOT_SOCKET_DOT_FACTS_JSON)}`);
13366
+ logger.logger.info(`Reachability report has been written to: ${actualOutputPath}`);
13356
13367
  }
13357
13368
 
13358
13369
  async function handleScanReach({
@@ -13360,6 +13371,7 @@ async function handleScanReach({
13360
13371
  interactive: _interactive,
13361
13372
  orgSlug,
13362
13373
  outputKind,
13374
+ outputPath,
13363
13375
  reachabilityOptions,
13364
13376
  targets
13365
13377
  }) {
@@ -13373,8 +13385,8 @@ async function handleScanReach({
13373
13385
  });
13374
13386
  if (!supportedFilesCResult.ok) {
13375
13387
  await outputScanReach(supportedFilesCResult, {
13376
- cwd,
13377
- outputKind
13388
+ outputKind,
13389
+ outputPath
13378
13390
  });
13379
13391
  return;
13380
13392
  }
@@ -13398,6 +13410,7 @@ async function handleScanReach({
13398
13410
  const result = await performReachabilityAnalysis({
13399
13411
  cwd,
13400
13412
  orgSlug,
13413
+ outputPath,
13401
13414
  packagePaths,
13402
13415
  reachabilityOptions,
13403
13416
  spinner,
@@ -13406,8 +13419,8 @@ async function handleScanReach({
13406
13419
  });
13407
13420
  spinner.stop();
13408
13421
  await outputScanReach(result, {
13409
- cwd,
13410
- outputKind
13422
+ outputKind,
13423
+ outputPath
13411
13424
  });
13412
13425
  }
13413
13426
 
@@ -13426,6 +13439,12 @@ const generalFlags = {
13426
13439
  type: 'string',
13427
13440
  default: '',
13428
13441
  description: 'Force override the organization slug, overrides the default org from config'
13442
+ },
13443
+ output: {
13444
+ type: 'string',
13445
+ default: '',
13446
+ description: 'Path to write the reachability report to (must end with .json). Defaults to .socket.facts.json in the current working directory.',
13447
+ shortFlag: 'o'
13429
13448
  }
13430
13449
  };
13431
13450
  const cmdScanReach = {
@@ -13458,7 +13477,8 @@ async function run$7(argv, importMeta, {
13458
13477
  ${utils.getFlagListOutput(reachabilityFlags)}
13459
13478
 
13460
13479
  Runs the Socket reachability analysis without creating a scan in Socket.
13461
- The output is written to .socket.facts.json in the current working directory.
13480
+ The output is written to .socket.facts.json in the current working directory
13481
+ unless the --output flag is specified.
13462
13482
 
13463
13483
  Note: Manifest files are uploaded to Socket's backend services because the
13464
13484
  reachability analysis requires creating a Software Bill of Materials (SBOM)
@@ -13468,6 +13488,8 @@ async function run$7(argv, importMeta, {
13468
13488
  $ ${command}
13469
13489
  $ ${command} ./proj
13470
13490
  $ ${command} ./proj --reach-ecosystems npm,pypi
13491
+ $ ${command} --output custom-report.json
13492
+ $ ${command} ./proj --output ./reports/analysis.json
13471
13493
  `
13472
13494
  };
13473
13495
  const cli = utils.meowOrExit({
@@ -13482,6 +13504,7 @@ async function run$7(argv, importMeta, {
13482
13504
  json,
13483
13505
  markdown,
13484
13506
  org: orgFlag,
13507
+ output: outputPath,
13485
13508
  reachAnalysisMemoryLimit,
13486
13509
  reachAnalysisTimeout,
13487
13510
  reachConcurrency,
@@ -13538,6 +13561,11 @@ async function run$7(argv, importMeta, {
13538
13561
  test: !json || !markdown,
13539
13562
  message: 'The json and markdown flags cannot be both set, pick one',
13540
13563
  fail: 'omit one'
13564
+ }, {
13565
+ nook: true,
13566
+ test: !outputPath || outputPath.endsWith('.json'),
13567
+ message: 'The --output path must end with .json',
13568
+ fail: 'use a path ending with .json'
13541
13569
  }, {
13542
13570
  nook: true,
13543
13571
  test: targetValidation.isValid,
@@ -13568,10 +13596,10 @@ async function run$7(argv, importMeta, {
13568
13596
  }
13569
13597
  await handleScanReach({
13570
13598
  cwd,
13599
+ interactive,
13571
13600
  orgSlug,
13572
13601
  outputKind,
13573
- targets,
13574
- interactive,
13602
+ outputPath: outputPath || '',
13575
13603
  reachabilityOptions: {
13576
13604
  reachAnalysisTimeout: Number(reachAnalysisTimeout),
13577
13605
  reachAnalysisMemoryLimit: Number(reachAnalysisMemoryLimit),
@@ -13582,7 +13610,8 @@ async function run$7(argv, importMeta, {
13582
13610
  reachEcosystems,
13583
13611
  reachExcludePaths,
13584
13612
  reachSkipCache: Boolean(reachSkipCache)
13585
- }
13613
+ },
13614
+ targets
13586
13615
  });
13587
13616
  }
13588
13617
 
@@ -15419,5 +15448,5 @@ void (async () => {
15419
15448
  await utils.captureException(e);
15420
15449
  }
15421
15450
  })();
15422
- //# debugId=39010d7c-ef10-4b4e-b008-38ac722e7d5d
15451
+ //# debugId=abe9e0d9-90ff-4e73-99b1-648bc5ca3347
15423
15452
  //# sourceMappingURL=cli.js.map