socket 1.1.26 → 1.1.28

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,16 @@ 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.28](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.28) - 2025-11-13
8
+
9
+ ### Added
10
+ - Backported `socket fix` with `--json` improvements
11
+
12
+ ## [1.1.27](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.27) - 2025-11-12
13
+
14
+ ### Added
15
+ - Backported `--exclude` and `--include` flags for `socket fix` command from v2
16
+
7
17
  ## [1.1.26](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.26) - 2025-11-08
8
18
 
9
19
  ### Added
package/dist/cli.js CHANGED
@@ -18,6 +18,7 @@ var prompts = require('../external/@socketsecurity/registry/lib/prompts');
18
18
  var spawn = require('../external/@socketsecurity/registry/lib/spawn');
19
19
  var fs$2 = require('../external/@socketsecurity/registry/lib/fs');
20
20
  var strings = require('../external/@socketsecurity/registry/lib/strings');
21
+ var os = require('node:os');
21
22
  var path$1 = require('../external/@socketsecurity/registry/lib/path');
22
23
  var require$$11 = require('../external/@socketsecurity/registry/lib/objects');
23
24
  var registry = require('../external/@socketsecurity/registry');
@@ -26,7 +27,6 @@ var require$$12 = require('../external/@socketsecurity/registry/lib/promises');
26
27
  var regexps = require('../external/@socketsecurity/registry/lib/regexps');
27
28
  var require$$0$1 = require('node:crypto');
28
29
  var require$$1 = require('node:util');
29
- var os = require('node:os');
30
30
  var promises = require('node:stream/promises');
31
31
 
32
32
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -3559,8 +3559,9 @@ async function coanaFix(fixConfig) {
3559
3559
  autopilot,
3560
3560
  cwd,
3561
3561
  disableMajorUpdates,
3562
+ exclude,
3562
3563
  ghsas,
3563
- glob,
3564
+ include,
3564
3565
  limit,
3565
3566
  minimumReleaseAge,
3566
3567
  orgSlug,
@@ -3630,18 +3631,47 @@ async function coanaFix(fixConfig) {
3630
3631
  }
3631
3632
  };
3632
3633
  }
3633
- const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...(isAll ? ['all'] : ghsas), ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(minimumReleaseAge ? ['--minimum-release-age', minimumReleaseAge] : []), ...(glob ? ['--glob', glob] : []), ...(!applyFixes ? [constants.FLAG_DRY_RUN] : []), ...(outputFile ? ['--output-file', outputFile] : []), ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
3634
- cwd,
3635
- spinner,
3636
- stdio: 'inherit'
3637
- });
3638
- spinner?.stop();
3639
- return fixCResult.ok ? {
3640
- ok: true,
3641
- data: {
3642
- fixed: true
3634
+
3635
+ // Create a temporary file for the output.
3636
+ const tmpDir = os.tmpdir();
3637
+ const tmpFile = path.join(tmpDir, `socket-fix-${Date.now()}.json`);
3638
+ try {
3639
+ const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...(isAll ? ['all'] : ghsas), ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(minimumReleaseAge ? ['--minimum-release-age', minimumReleaseAge] : []), ...(include.length ? ['--include', ...include] : []), ...(exclude.length ? ['--exclude', ...exclude] : []), ...(!applyFixes ? [constants.FLAG_DRY_RUN] : []), '--output-file', tmpFile, ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
3640
+ cwd,
3641
+ spinner,
3642
+ stdio: 'inherit'
3643
+ });
3644
+ spinner?.stop();
3645
+ if (!fixCResult.ok) {
3646
+ return fixCResult;
3643
3647
  }
3644
- } : fixCResult;
3648
+
3649
+ // Read the temporary file to get the actual fixes result.
3650
+ const fixesResultJson = fs$2.readJsonSync(tmpFile, {
3651
+ throws: false
3652
+ });
3653
+
3654
+ // Copy to outputFile if provided.
3655
+ if (outputFile) {
3656
+ logger.logger.info(`Copying fixes result to ${outputFile}`);
3657
+ const tmpContent = await fs$1.promises.readFile(tmpFile, 'utf8');
3658
+ await fs$1.promises.writeFile(outputFile, tmpContent, 'utf8');
3659
+ }
3660
+ return {
3661
+ ok: true,
3662
+ data: {
3663
+ data: fixesResultJson,
3664
+ fixed: true
3665
+ }
3666
+ };
3667
+ } finally {
3668
+ // Clean up the temporary file.
3669
+ try {
3670
+ await fs$1.promises.unlink(tmpFile);
3671
+ } catch (e) {
3672
+ // Ignore cleanup errors.
3673
+ }
3674
+ }
3645
3675
  }
3646
3676
 
3647
3677
  // Adjust limit based on open Socket Fix PRs.
@@ -3665,7 +3695,7 @@ async function coanaFix(fixConfig) {
3665
3695
  const shouldSpawnCoana = adjustedLimit > 0;
3666
3696
  let ids;
3667
3697
  if (shouldSpawnCoana && isAll) {
3668
- const foundCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(minimumReleaseAge ? ['--minimum-release-age', minimumReleaseAge] : []), ...(glob ? ['--glob', glob] : []), ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
3698
+ const foundCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(minimumReleaseAge ? ['--minimum-release-age', minimumReleaseAge] : []), ...(include.length ? ['--include', ...include] : []), ...(exclude.length ? ['--exclude', ...exclude] : []), ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
3669
3699
  cwd,
3670
3700
  spinner
3671
3701
  });
@@ -3707,7 +3737,7 @@ async function coanaFix(fixConfig) {
3707
3737
 
3708
3738
  // Apply fix for single GHSA ID.
3709
3739
  // eslint-disable-next-line no-await-in-loop
3710
- const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ghsaId, ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(minimumReleaseAge ? ['--minimum-release-age', minimumReleaseAge] : []), ...(glob ? ['--glob', glob] : []), ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
3740
+ const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ghsaId, ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(minimumReleaseAge ? ['--minimum-release-age', minimumReleaseAge] : []), ...(include.length ? ['--include', ...include] : []), ...(exclude.length ? ['--exclude', ...exclude] : []), ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
3711
3741
  cwd,
3712
3742
  spinner,
3713
3743
  stdio: 'inherit'
@@ -3921,8 +3951,9 @@ async function handleFix({
3921
3951
  autopilot,
3922
3952
  cwd,
3923
3953
  disableMajorUpdates,
3954
+ exclude,
3924
3955
  ghsas,
3925
- glob,
3956
+ include,
3926
3957
  limit,
3927
3958
  minSatisfying,
3928
3959
  minimumReleaseAge,
@@ -3937,14 +3968,16 @@ async function handleFix({
3937
3968
  }) {
3938
3969
  require$$9.debugFn('notice', `Starting fix command for ${orgSlug}`);
3939
3970
  require$$9.debugDir('inspect', {
3971
+ applyFixes,
3940
3972
  autopilot,
3941
3973
  cwd,
3942
3974
  disableMajorUpdates,
3975
+ exclude,
3943
3976
  ghsas,
3944
- glob,
3977
+ include,
3945
3978
  limit,
3946
3979
  minSatisfying,
3947
- applyFixes,
3980
+ minimumReleaseAge,
3948
3981
  outputFile,
3949
3982
  outputKind,
3950
3983
  prCheck,
@@ -3953,21 +3986,24 @@ async function handleFix({
3953
3986
  unknownFlags
3954
3987
  });
3955
3988
  await outputFixResult(await coanaFix({
3956
- autopilot,
3957
3989
  applyFixes,
3990
+ autopilot,
3958
3991
  cwd,
3959
3992
  disableMajorUpdates,
3960
- // Convert mixed CVE/GHSA/PURL inputs to GHSA IDs only
3993
+ exclude,
3994
+ // Convert mixed CVE/GHSA/PURL inputs to GHSA IDs only.
3961
3995
  ghsas: await convertIdsToGhsas(ghsas),
3962
- glob,
3996
+ include,
3963
3997
  limit,
3964
3998
  minimumReleaseAge,
3999
+ minSatisfying,
3965
4000
  orgSlug,
4001
+ outputFile,
4002
+ prCheck,
3966
4003
  rangeStyle,
3967
4004
  showAffectedDirectDependencies,
3968
4005
  spinner,
3969
- unknownFlags,
3970
- outputFile
4006
+ unknownFlags
3971
4007
  }), outputKind);
3972
4008
  }
3973
4009
 
@@ -3994,6 +4030,20 @@ const generalFlags$2 = {
3994
4030
  // Hidden to allow custom documenting of the negated `--no-apply-fixes` variant.
3995
4031
  hidden: true
3996
4032
  },
4033
+ exclude: {
4034
+ type: 'string',
4035
+ default: [],
4036
+ description: 'Exclude workspaces matching these glob patterns. Can be provided as comma separated values or as multiple flags',
4037
+ isMultiple: true,
4038
+ hidden: false
4039
+ },
4040
+ include: {
4041
+ type: 'string',
4042
+ default: [],
4043
+ description: 'Include workspaces matching these glob patterns. Can be provided as comma separated values or as multiple flags',
4044
+ isMultiple: true,
4045
+ hidden: false
4046
+ },
3997
4047
  majorUpdates: {
3998
4048
  type: 'boolean',
3999
4049
  default: true,
@@ -4051,12 +4101,6 @@ const hiddenFlags = {
4051
4101
  ...generalFlags$2['id'],
4052
4102
  hidden: true
4053
4103
  },
4054
- glob: {
4055
- type: 'string',
4056
- default: '',
4057
- description: 'Glob pattern to filter workspaces by',
4058
- hidden: true
4059
- },
4060
4104
  maxSatisfying: {
4061
4105
  type: 'boolean',
4062
4106
  default: true,
@@ -4155,7 +4199,8 @@ async function run$K(argv, importMeta, {
4155
4199
  const {
4156
4200
  applyFixes,
4157
4201
  autopilot,
4158
- glob,
4202
+ exclude,
4203
+ include,
4159
4204
  json,
4160
4205
  limit,
4161
4206
  majorUpdates,
@@ -4206,24 +4251,27 @@ async function run$K(argv, importMeta, {
4206
4251
  spinner
4207
4252
  } = constants.default;
4208
4253
  const ghsas = arrays.arrayUnique([...utils.cmdFlagValueToArray(cli.flags['id']), ...utils.cmdFlagValueToArray(cli.flags['ghsa']), ...utils.cmdFlagValueToArray(cli.flags['purl'])]);
4254
+ const includePatterns = utils.cmdFlagValueToArray(include);
4255
+ const excludePatterns = utils.cmdFlagValueToArray(exclude);
4209
4256
  await handleFix({
4210
- autopilot,
4211
4257
  applyFixes,
4258
+ autopilot,
4212
4259
  cwd,
4213
4260
  disableMajorUpdates,
4261
+ exclude: excludePatterns,
4214
4262
  ghsas,
4215
- glob,
4263
+ include: includePatterns,
4216
4264
  limit,
4217
4265
  minimumReleaseAge,
4218
4266
  minSatisfying,
4219
- prCheck,
4220
4267
  orgSlug,
4268
+ outputFile,
4221
4269
  outputKind,
4270
+ prCheck,
4222
4271
  rangeStyle,
4223
4272
  showAffectedDirectDependencies,
4224
4273
  spinner,
4225
- unknownFlags,
4226
- outputFile
4274
+ unknownFlags
4227
4275
  });
4228
4276
  }
4229
4277
 
@@ -15043,5 +15091,5 @@ void (async () => {
15043
15091
  await utils.captureException(e);
15044
15092
  }
15045
15093
  })();
15046
- //# debugId=6efb19e5-82e5-4a78-9747-dd32059707f5
15094
+ //# debugId=13d5a945-42af-4203-b65f-268cf102639c
15047
15095
  //# sourceMappingURL=cli.js.map