socket 1.1.41 → 1.1.43
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 +19 -1
- package/dist/cli.js +115 -73
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +4 -4
- package/dist/constants.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/handle-fix.d.mts +1 -1
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/types.d.mts +4 -1
- package/dist/types/commands/fix/types.d.mts.map +1 -1
- package/dist/types/commands/scan/output-scan-reach.d.mts.map +1 -1
- package/dist/types/utils/dlx.d.mts.map +1 -1
- package/dist/utils.js +30 -30
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,25 @@ 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.
|
|
7
|
+
## [1.1.43](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.43) - 2025-12-08
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Added `--all` flag to `socket fix` for explicitly processing all vulnerabilities in local mode. Cannot be used with `--id`.
|
|
11
|
+
|
|
12
|
+
### Deprecated
|
|
13
|
+
- Running `socket fix` in local mode without `--all` or `--id` is deprecated. A warning is shown when neither flag is provided. In a future release, one of these flags will be required.
|
|
14
|
+
|
|
15
|
+
## [1.1.42](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.42) - 2025-12-04
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- Added `--ecosystems` flag to `socket fix`.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Updated the Coana CLI to v `14.12.113`.
|
|
22
|
+
- Rename `--limit` flag to `--pr-limit` for `socket fix`, but keep old flag as an alias. Note: `--pr-limit` has no effect in local mode, use `--id` options instead.
|
|
23
|
+
- Process all vulnerabilities with `socket fix` when no `--id` options are provided.
|
|
24
|
+
|
|
25
|
+
## [1.1.41](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.41) - 2025-12-02
|
|
8
26
|
|
|
9
27
|
### Added
|
|
10
28
|
- Added `--reach-version` flag to `socket scan create` and `socket scan reach` to override the @coana-tech/cli version used for reachability analysis.
|
package/dist/cli.js
CHANGED
|
@@ -446,7 +446,7 @@ async function run$S(argv, importMeta, {
|
|
|
446
446
|
fail: 'bad'
|
|
447
447
|
}, {
|
|
448
448
|
nook: true,
|
|
449
|
-
test: hasApiToken,
|
|
449
|
+
test: dryRun || hasApiToken,
|
|
450
450
|
message: 'This command requires a Socket API token for access',
|
|
451
451
|
fail: 'try `socket login`'
|
|
452
452
|
});
|
|
@@ -850,7 +850,7 @@ async function run$R(argv, importMeta, {
|
|
|
850
850
|
fail: 'missing'
|
|
851
851
|
}, {
|
|
852
852
|
nook: true,
|
|
853
|
-
test: hasApiToken,
|
|
853
|
+
test: dryRun || hasApiToken,
|
|
854
854
|
message: 'This command requires a Socket API token for access',
|
|
855
855
|
fail: 'try `socket login`'
|
|
856
856
|
}, {
|
|
@@ -3694,13 +3694,13 @@ async function getFixEnv() {
|
|
|
3694
3694
|
async function discoverGhsaIds(orgSlug, tarHash, options) {
|
|
3695
3695
|
const {
|
|
3696
3696
|
cwd = process.cwd(),
|
|
3697
|
-
|
|
3697
|
+
ecosystems,
|
|
3698
3698
|
spinner
|
|
3699
3699
|
} = {
|
|
3700
3700
|
__proto__: null,
|
|
3701
3701
|
...options
|
|
3702
3702
|
};
|
|
3703
|
-
const foundCResult = await utils.spawnCoanaDlx(['find-vulnerabilities', cwd, '--manifests-tar-hash', tarHash], orgSlug, {
|
|
3703
|
+
const foundCResult = await utils.spawnCoanaDlx(['find-vulnerabilities', cwd, '--manifests-tar-hash', tarHash, ...(ecosystems?.length ? ['--purl-types', ...ecosystems] : [])], orgSlug, {
|
|
3704
3704
|
cwd,
|
|
3705
3705
|
spinner,
|
|
3706
3706
|
coanaVersion: options?.coanaVersion
|
|
@@ -3708,32 +3708,32 @@ async function discoverGhsaIds(orgSlug, tarHash, options) {
|
|
|
3708
3708
|
stdio: 'pipe'
|
|
3709
3709
|
});
|
|
3710
3710
|
if (foundCResult.ok) {
|
|
3711
|
-
// Coana prints ghsaIds as json-formatted string on the final line of the output
|
|
3712
|
-
const foundIds = [];
|
|
3713
3711
|
try {
|
|
3712
|
+
// Coana prints ghsaIds as json-formatted string on the final line of the output.
|
|
3714
3713
|
const ghsaIdsRaw = foundCResult.data.trim().split('\n').pop();
|
|
3715
3714
|
if (ghsaIdsRaw) {
|
|
3716
|
-
|
|
3715
|
+
return JSON.parse(ghsaIdsRaw);
|
|
3717
3716
|
}
|
|
3718
3717
|
} catch {}
|
|
3719
|
-
return limit !== undefined ? foundIds.slice(0, limit) : foundIds;
|
|
3720
3718
|
}
|
|
3721
3719
|
return [];
|
|
3722
3720
|
}
|
|
3723
3721
|
async function coanaFix(fixConfig) {
|
|
3724
3722
|
const {
|
|
3723
|
+
all,
|
|
3725
3724
|
applyFixes,
|
|
3726
3725
|
autopilot,
|
|
3727
3726
|
coanaVersion,
|
|
3728
3727
|
cwd,
|
|
3729
3728
|
disableMajorUpdates,
|
|
3729
|
+
ecosystems,
|
|
3730
3730
|
exclude,
|
|
3731
3731
|
ghsas,
|
|
3732
3732
|
include,
|
|
3733
|
-
limit,
|
|
3734
3733
|
minimumReleaseAge,
|
|
3735
3734
|
orgSlug,
|
|
3736
3735
|
outputFile,
|
|
3736
|
+
prLimit,
|
|
3737
3737
|
showAffectedDirectDependencies,
|
|
3738
3738
|
spinner
|
|
3739
3739
|
} = fixConfig;
|
|
@@ -3776,9 +3776,14 @@ async function coanaFix(fixConfig) {
|
|
|
3776
3776
|
data: uploadCResult.data
|
|
3777
3777
|
};
|
|
3778
3778
|
}
|
|
3779
|
-
const
|
|
3779
|
+
const shouldDiscoverGhsaIds = all || !ghsas.length;
|
|
3780
3780
|
const shouldOpenPrs = fixEnv.isCi && fixEnv.repoInfo;
|
|
3781
3781
|
if (!shouldOpenPrs) {
|
|
3782
|
+
// In local mode, if neither --all nor --id is provided, show deprecation warning.
|
|
3783
|
+
if (shouldDiscoverGhsaIds && !all) {
|
|
3784
|
+
logger.logger.warn('Implicit --all is deprecated in local mode and will be removed in a future release. Please use --all explicitly.');
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3782
3787
|
// Inform user about local mode when fixes will be applied.
|
|
3783
3788
|
if (applyFixes && ghsas.length) {
|
|
3784
3789
|
const envCheck = checkCiEnvVars();
|
|
@@ -3792,20 +3797,15 @@ async function coanaFix(fixConfig) {
|
|
|
3792
3797
|
logger.logger.info('Running in local mode - fixes will be applied directly to your working directory.\n' + getCiEnvInstructions());
|
|
3793
3798
|
}
|
|
3794
3799
|
}
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
ids = ghsas.slice(0, limit);
|
|
3805
|
-
} else {
|
|
3806
|
-
ids = [];
|
|
3807
|
-
}
|
|
3808
|
-
if (limit < 1 || ids.length === 0) {
|
|
3800
|
+
|
|
3801
|
+
// In local mode, process all discovered/provided IDs (no limit).
|
|
3802
|
+
const ids = shouldDiscoverGhsaIds ? await discoverGhsaIds(orgSlug, tarHash, {
|
|
3803
|
+
coanaVersion,
|
|
3804
|
+
cwd,
|
|
3805
|
+
ecosystems,
|
|
3806
|
+
spinner
|
|
3807
|
+
}) : ghsas;
|
|
3808
|
+
if (ids.length === 0) {
|
|
3809
3809
|
spinner?.stop();
|
|
3810
3810
|
return {
|
|
3811
3811
|
ok: true,
|
|
@@ -3819,7 +3819,7 @@ async function coanaFix(fixConfig) {
|
|
|
3819
3819
|
const tmpDir = os.tmpdir();
|
|
3820
3820
|
const tmpFile = path.join(tmpDir, `socket-fix-${Date.now()}.json`);
|
|
3821
3821
|
try {
|
|
3822
|
-
const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...ids, ...(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, {
|
|
3822
|
+
const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...ids, ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(minimumReleaseAge ? ['--minimum-release-age', minimumReleaseAge] : []), ...(include.length ? ['--include', ...include] : []), ...(exclude.length ? ['--exclude', ...exclude] : []), ...(ecosystems.length ? ['--purl-types', ...ecosystems] : []), ...(!applyFixes ? [constants.FLAG_DRY_RUN] : []), '--output-file', tmpFile, ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3823
3823
|
coanaVersion,
|
|
3824
3824
|
cwd,
|
|
3825
3825
|
spinner,
|
|
@@ -3858,8 +3858,8 @@ async function coanaFix(fixConfig) {
|
|
|
3858
3858
|
}
|
|
3859
3859
|
}
|
|
3860
3860
|
|
|
3861
|
-
// Adjust limit based on open Socket Fix PRs.
|
|
3862
|
-
let
|
|
3861
|
+
// Adjust PR limit based on open Socket Fix PRs.
|
|
3862
|
+
let adjustedPrLimit = prLimit;
|
|
3863
3863
|
if (shouldOpenPrs && fixEnv.repoInfo) {
|
|
3864
3864
|
try {
|
|
3865
3865
|
const openPrs = await getSocketFixPrs(fixEnv.repoInfo.owner, fixEnv.repoInfo.repo, {
|
|
@@ -3867,26 +3867,24 @@ async function coanaFix(fixConfig) {
|
|
|
3867
3867
|
});
|
|
3868
3868
|
const openPrCount = openPrs.length;
|
|
3869
3869
|
// Reduce limit by number of open PRs to avoid creating too many.
|
|
3870
|
-
|
|
3870
|
+
adjustedPrLimit = Math.max(0, prLimit - openPrCount);
|
|
3871
3871
|
if (openPrCount > 0) {
|
|
3872
|
-
require$$9.debugFn('notice', `
|
|
3872
|
+
require$$9.debugFn('notice', `prLimit: adjusted from ${prLimit} to ${adjustedPrLimit} (${openPrCount} open Socket Fix ${words.pluralize('PR', openPrCount)}`);
|
|
3873
3873
|
}
|
|
3874
3874
|
} catch (e) {
|
|
3875
3875
|
require$$9.debugFn('warn', 'Failed to count open PRs, using original limit');
|
|
3876
3876
|
require$$9.debugDir('error', e);
|
|
3877
3877
|
}
|
|
3878
3878
|
}
|
|
3879
|
-
const shouldSpawnCoana =
|
|
3879
|
+
const shouldSpawnCoana = adjustedPrLimit > 0;
|
|
3880
3880
|
let ids;
|
|
3881
|
-
if (shouldSpawnCoana
|
|
3882
|
-
ids = await discoverGhsaIds(orgSlug, tarHash, {
|
|
3881
|
+
if (shouldSpawnCoana) {
|
|
3882
|
+
ids = (shouldDiscoverGhsaIds ? await discoverGhsaIds(orgSlug, tarHash, {
|
|
3883
|
+
coanaVersion,
|
|
3883
3884
|
cwd,
|
|
3884
|
-
|
|
3885
|
-
spinner
|
|
3886
|
-
|
|
3887
|
-
});
|
|
3888
|
-
} else if (shouldSpawnCoana) {
|
|
3889
|
-
ids = ghsas.slice(0, adjustedLimit);
|
|
3885
|
+
ecosystems,
|
|
3886
|
+
spinner
|
|
3887
|
+
}) : ghsas).slice(0, adjustedPrLimit);
|
|
3890
3888
|
}
|
|
3891
3889
|
if (!ids?.length) {
|
|
3892
3890
|
require$$9.debugFn('notice', 'miss: no GHSA IDs to process');
|
|
@@ -3919,7 +3917,7 @@ async function coanaFix(fixConfig) {
|
|
|
3919
3917
|
|
|
3920
3918
|
// Apply fix for single GHSA ID.
|
|
3921
3919
|
// eslint-disable-next-line no-await-in-loop
|
|
3922
|
-
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, {
|
|
3920
|
+
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] : []), ...(ecosystems.length ? ['--purl-types', ...ecosystems] : []), ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3923
3921
|
coanaVersion,
|
|
3924
3922
|
cwd,
|
|
3925
3923
|
spinner,
|
|
@@ -4080,8 +4078,8 @@ async function coanaFix(fixConfig) {
|
|
|
4080
4078
|
await utils.gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
4081
4079
|
}
|
|
4082
4080
|
count += 1;
|
|
4083
|
-
require$$9.debugFn('notice', `increment: count ${count}/${Math.min(
|
|
4084
|
-
if (count >=
|
|
4081
|
+
require$$9.debugFn('notice', `increment: count ${count}/${Math.min(adjustedPrLimit, ids.length)}`);
|
|
4082
|
+
if (count >= adjustedPrLimit) {
|
|
4085
4083
|
break ghsaLoop;
|
|
4086
4084
|
}
|
|
4087
4085
|
}
|
|
@@ -4175,21 +4173,23 @@ async function convertIdsToGhsas(ids) {
|
|
|
4175
4173
|
return validGhsas;
|
|
4176
4174
|
}
|
|
4177
4175
|
async function handleFix({
|
|
4176
|
+
all,
|
|
4178
4177
|
applyFixes,
|
|
4179
4178
|
autopilot,
|
|
4180
4179
|
coanaVersion,
|
|
4181
4180
|
cwd,
|
|
4182
4181
|
disableMajorUpdates,
|
|
4182
|
+
ecosystems,
|
|
4183
4183
|
exclude,
|
|
4184
4184
|
ghsas,
|
|
4185
4185
|
include,
|
|
4186
|
-
limit,
|
|
4187
4186
|
minSatisfying,
|
|
4188
4187
|
minimumReleaseAge,
|
|
4189
4188
|
orgSlug,
|
|
4190
4189
|
outputFile,
|
|
4191
4190
|
outputKind,
|
|
4192
4191
|
prCheck,
|
|
4192
|
+
prLimit,
|
|
4193
4193
|
rangeStyle,
|
|
4194
4194
|
showAffectedDirectDependencies,
|
|
4195
4195
|
spinner,
|
|
@@ -4197,40 +4197,44 @@ async function handleFix({
|
|
|
4197
4197
|
}) {
|
|
4198
4198
|
require$$9.debugFn('notice', `Starting fix command for ${orgSlug}`);
|
|
4199
4199
|
require$$9.debugDir('inspect', {
|
|
4200
|
+
all,
|
|
4200
4201
|
applyFixes,
|
|
4201
4202
|
autopilot,
|
|
4202
4203
|
coanaVersion,
|
|
4203
4204
|
cwd,
|
|
4204
4205
|
disableMajorUpdates,
|
|
4206
|
+
ecosystems,
|
|
4205
4207
|
exclude,
|
|
4206
4208
|
ghsas,
|
|
4207
4209
|
include,
|
|
4208
|
-
limit,
|
|
4209
4210
|
minSatisfying,
|
|
4210
4211
|
minimumReleaseAge,
|
|
4211
4212
|
outputFile,
|
|
4212
4213
|
outputKind,
|
|
4213
4214
|
prCheck,
|
|
4215
|
+
prLimit,
|
|
4214
4216
|
rangeStyle,
|
|
4215
4217
|
showAffectedDirectDependencies,
|
|
4216
4218
|
unknownFlags
|
|
4217
4219
|
});
|
|
4218
4220
|
await outputFixResult(await coanaFix({
|
|
4221
|
+
all,
|
|
4219
4222
|
applyFixes,
|
|
4220
4223
|
autopilot,
|
|
4221
4224
|
coanaVersion,
|
|
4222
4225
|
cwd,
|
|
4223
4226
|
disableMajorUpdates,
|
|
4227
|
+
ecosystems,
|
|
4224
4228
|
exclude,
|
|
4225
4229
|
// Convert mixed CVE/GHSA/PURL inputs to GHSA IDs only.
|
|
4226
4230
|
ghsas: await convertIdsToGhsas(ghsas),
|
|
4227
4231
|
include,
|
|
4228
|
-
limit,
|
|
4229
4232
|
minimumReleaseAge,
|
|
4230
4233
|
minSatisfying,
|
|
4231
4234
|
orgSlug,
|
|
4232
4235
|
outputFile,
|
|
4233
4236
|
prCheck,
|
|
4237
|
+
prLimit,
|
|
4234
4238
|
rangeStyle,
|
|
4235
4239
|
showAffectedDirectDependencies,
|
|
4236
4240
|
spinner,
|
|
@@ -4286,6 +4290,11 @@ const generalFlags$2 = {
|
|
|
4286
4290
|
// Hidden to allow custom documenting of the negated `--no-major-updates` variant.
|
|
4287
4291
|
hidden: true
|
|
4288
4292
|
},
|
|
4293
|
+
all: {
|
|
4294
|
+
type: 'boolean',
|
|
4295
|
+
default: false,
|
|
4296
|
+
description: 'Process all discovered vulnerabilities in local mode. Cannot be used with --id.'
|
|
4297
|
+
},
|
|
4289
4298
|
id: {
|
|
4290
4299
|
type: 'string',
|
|
4291
4300
|
default: [],
|
|
@@ -4293,13 +4302,14 @@ const generalFlags$2 = {
|
|
|
4293
4302
|
- ${vendor.terminalLinkExports('GHSA IDs', 'https://docs.github.com/en/code-security/security-advisories/working-with-global-security-advisories-from-the-github-advisory-database/about-the-github-advisory-database#about-ghsa-ids')} (e.g., GHSA-xxxx-xxxx-xxxx)
|
|
4294
4303
|
- ${vendor.terminalLinkExports('CVE IDs', 'https://cve.mitre.org/cve/identifiers/')} (e.g., CVE-${new Date().getFullYear()}-1234) - automatically converted to GHSA
|
|
4295
4304
|
- ${vendor.terminalLinkExports('PURLs', 'https://github.com/package-url/purl-spec')} (e.g., pkg:npm/package@1.0.0) - automatically converted to GHSA
|
|
4296
|
-
Can be provided as comma separated values or as multiple flags
|
|
4305
|
+
Can be provided as comma separated values or as multiple flags. Cannot be used with --all.`,
|
|
4297
4306
|
isMultiple: true
|
|
4298
4307
|
},
|
|
4299
|
-
|
|
4308
|
+
prLimit: {
|
|
4309
|
+
aliases: ['limit'],
|
|
4300
4310
|
type: 'number',
|
|
4301
4311
|
default: DEFAULT_LIMIT,
|
|
4302
|
-
description: `
|
|
4312
|
+
description: `Maximum number of pull requests to create in CI mode (default ${DEFAULT_LIMIT}). Has no effect in local mode.`
|
|
4303
4313
|
},
|
|
4304
4314
|
rangeStyle: {
|
|
4305
4315
|
type: 'string',
|
|
@@ -4321,6 +4331,12 @@ Available styles:
|
|
|
4321
4331
|
default: '',
|
|
4322
4332
|
description: 'Set a minimum age requirement for suggested upgrade versions (e.g., 1h, 2d, 3w). A higher age requirement reduces the risk of upgrading to malicious versions. For example, setting the value to 1 week (1w) gives ecosystem maintainers one week to remove potentially malicious versions.'
|
|
4323
4333
|
},
|
|
4334
|
+
ecosystems: {
|
|
4335
|
+
type: 'string',
|
|
4336
|
+
default: [],
|
|
4337
|
+
description: 'Limit fix analysis to specific ecosystems. Can be provided as comma separated values or as multiple flags. Defaults to all ecosystems.',
|
|
4338
|
+
isMultiple: true
|
|
4339
|
+
},
|
|
4324
4340
|
showAffectedDirectDependencies: {
|
|
4325
4341
|
type: 'boolean',
|
|
4326
4342
|
default: false,
|
|
@@ -4432,19 +4448,21 @@ async function run$K(argv, importMeta, {
|
|
|
4432
4448
|
allowUnknownFlags: false
|
|
4433
4449
|
});
|
|
4434
4450
|
const {
|
|
4451
|
+
all,
|
|
4435
4452
|
applyFixes,
|
|
4436
4453
|
autopilot,
|
|
4454
|
+
ecosystems,
|
|
4437
4455
|
exclude,
|
|
4438
4456
|
fixVersion,
|
|
4439
4457
|
include,
|
|
4440
4458
|
json,
|
|
4441
|
-
limit,
|
|
4442
4459
|
majorUpdates,
|
|
4443
4460
|
markdown,
|
|
4444
4461
|
maxSatisfying,
|
|
4445
4462
|
minimumReleaseAge,
|
|
4446
4463
|
outputFile,
|
|
4447
4464
|
prCheck,
|
|
4465
|
+
prLimit,
|
|
4448
4466
|
rangeStyle,
|
|
4449
4467
|
showAffectedDirectDependencies,
|
|
4450
4468
|
// We patched in this feature with `npx custompatch meow` at
|
|
@@ -4455,6 +4473,24 @@ async function run$K(argv, importMeta, {
|
|
|
4455
4473
|
const minSatisfying = cli.flags['minSatisfying'] || !maxSatisfying;
|
|
4456
4474
|
const disableMajorUpdates = !majorUpdates;
|
|
4457
4475
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
4476
|
+
|
|
4477
|
+
// Process comma-separated values for ecosystems flag.
|
|
4478
|
+
const ecosystemsRaw = utils.cmdFlagValueToArray(ecosystems);
|
|
4479
|
+
|
|
4480
|
+
// Validate ecosystem values early, before dry-run check.
|
|
4481
|
+
const validatedEcosystems = [];
|
|
4482
|
+
const validEcosystemChoices = utils.getEcosystemChoicesForMeow();
|
|
4483
|
+
for (const ecosystem of ecosystemsRaw) {
|
|
4484
|
+
if (!validEcosystemChoices.includes(ecosystem)) {
|
|
4485
|
+
logger.logger.fail(`Invalid ecosystem: "${ecosystem}". Valid values are: ${arrays.joinAnd(validEcosystemChoices)}`);
|
|
4486
|
+
process.exitCode = 1;
|
|
4487
|
+
return;
|
|
4488
|
+
}
|
|
4489
|
+
validatedEcosystems.push(ecosystem);
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4492
|
+
// Collect ghsas early to validate --all and --id mutual exclusivity.
|
|
4493
|
+
const ghsas = arrays.arrayUnique([...utils.cmdFlagValueToArray(cli.flags['id']), ...utils.cmdFlagValueToArray(cli.flags['ghsa']), ...utils.cmdFlagValueToArray(cli.flags['purl'])]);
|
|
4458
4494
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
4459
4495
|
test: utils.RangeStyles.includes(rangeStyle),
|
|
4460
4496
|
message: `Expecting range style of ${arrays.joinOr(utils.RangeStyles)}`,
|
|
@@ -4464,6 +4500,11 @@ async function run$K(argv, importMeta, {
|
|
|
4464
4500
|
test: !json || !markdown,
|
|
4465
4501
|
message: 'The json and markdown flags cannot be both set, pick one',
|
|
4466
4502
|
fail: 'omit one'
|
|
4503
|
+
}, {
|
|
4504
|
+
nook: true,
|
|
4505
|
+
test: !all || !ghsas.length,
|
|
4506
|
+
message: 'The --all and --id flags cannot be used together',
|
|
4507
|
+
fail: 'omit one'
|
|
4467
4508
|
});
|
|
4468
4509
|
if (!wasValidInput) {
|
|
4469
4510
|
return;
|
|
@@ -4486,25 +4527,26 @@ async function run$K(argv, importMeta, {
|
|
|
4486
4527
|
const {
|
|
4487
4528
|
spinner
|
|
4488
4529
|
} = constants.default;
|
|
4489
|
-
const ghsas = arrays.arrayUnique([...utils.cmdFlagValueToArray(cli.flags['id']), ...utils.cmdFlagValueToArray(cli.flags['ghsa']), ...utils.cmdFlagValueToArray(cli.flags['purl'])]);
|
|
4490
4530
|
const includePatterns = utils.cmdFlagValueToArray(include);
|
|
4491
4531
|
const excludePatterns = utils.cmdFlagValueToArray(exclude);
|
|
4492
4532
|
await handleFix({
|
|
4533
|
+
all,
|
|
4493
4534
|
applyFixes,
|
|
4494
4535
|
autopilot,
|
|
4495
4536
|
coanaVersion: fixVersion,
|
|
4496
4537
|
cwd,
|
|
4497
4538
|
disableMajorUpdates,
|
|
4539
|
+
ecosystems: validatedEcosystems,
|
|
4498
4540
|
exclude: excludePatterns,
|
|
4499
4541
|
ghsas,
|
|
4500
4542
|
include: includePatterns,
|
|
4501
|
-
limit,
|
|
4502
4543
|
minimumReleaseAge,
|
|
4503
4544
|
minSatisfying,
|
|
4504
4545
|
orgSlug,
|
|
4505
4546
|
outputFile,
|
|
4506
4547
|
outputKind,
|
|
4507
4548
|
prCheck,
|
|
4549
|
+
prLimit,
|
|
4508
4550
|
rangeStyle,
|
|
4509
4551
|
showAffectedDirectDependencies,
|
|
4510
4552
|
spinner,
|
|
@@ -8064,7 +8106,7 @@ async function run$t(argv, importMeta, {
|
|
|
8064
8106
|
fail: 'bad'
|
|
8065
8107
|
}, {
|
|
8066
8108
|
nook: true,
|
|
8067
|
-
test: hasApiToken,
|
|
8109
|
+
test: dryRun || hasApiToken,
|
|
8068
8110
|
message: 'This command requires a Socket API token for access',
|
|
8069
8111
|
fail: 'try `socket login`'
|
|
8070
8112
|
});
|
|
@@ -8203,7 +8245,7 @@ async function run$s(argv, importMeta, {
|
|
|
8203
8245
|
fail: 'omit one'
|
|
8204
8246
|
}, {
|
|
8205
8247
|
nook: true,
|
|
8206
|
-
test: hasApiToken,
|
|
8248
|
+
test: dryRun || hasApiToken,
|
|
8207
8249
|
message: 'This command requires a Socket API token for access',
|
|
8208
8250
|
fail: 'try `socket login`'
|
|
8209
8251
|
});
|
|
@@ -8339,7 +8381,7 @@ async function run$r(argv, importMeta, {
|
|
|
8339
8381
|
fail: 'omit one'
|
|
8340
8382
|
}, {
|
|
8341
8383
|
nook: true,
|
|
8342
|
-
test: hasApiToken,
|
|
8384
|
+
test: dryRun || hasApiToken,
|
|
8343
8385
|
message: 'This command requires a Socket API token for access',
|
|
8344
8386
|
fail: 'try `socket login`'
|
|
8345
8387
|
});
|
|
@@ -8467,7 +8509,7 @@ async function run$q(argv, importMeta, {
|
|
|
8467
8509
|
fail: 'bad'
|
|
8468
8510
|
}, {
|
|
8469
8511
|
nook: true,
|
|
8470
|
-
test: hasApiToken,
|
|
8512
|
+
test: dryRun || hasApiToken,
|
|
8471
8513
|
message: 'This command requires a Socket API token for access',
|
|
8472
8514
|
fail: 'try `socket login`'
|
|
8473
8515
|
});
|
|
@@ -8598,7 +8640,7 @@ async function run$p(argv, importMeta, {
|
|
|
8598
8640
|
fail: 'omit one'
|
|
8599
8641
|
}, {
|
|
8600
8642
|
nook: true,
|
|
8601
|
-
test: hasApiToken,
|
|
8643
|
+
test: dryRun || hasApiToken,
|
|
8602
8644
|
message: 'This command requires a Socket API token for access',
|
|
8603
8645
|
fail: 'try `socket login`'
|
|
8604
8646
|
});
|
|
@@ -8967,7 +9009,7 @@ async function run$o(argv, importMeta, {
|
|
|
8967
9009
|
fail: 'omit one'
|
|
8968
9010
|
}, {
|
|
8969
9011
|
nook: true,
|
|
8970
|
-
test: hasApiToken,
|
|
9012
|
+
test: dryRun || hasApiToken,
|
|
8971
9013
|
message: 'This command requires a Socket API token for access',
|
|
8972
9014
|
fail: 'try `socket login`'
|
|
8973
9015
|
});
|
|
@@ -10253,7 +10295,7 @@ async function run$i(argv, importMeta, {
|
|
|
10253
10295
|
fail: 'missing'
|
|
10254
10296
|
}, {
|
|
10255
10297
|
nook: true,
|
|
10256
|
-
test: hasApiToken,
|
|
10298
|
+
test: dryRun || hasApiToken,
|
|
10257
10299
|
message: 'This command requires a Socket API token for access',
|
|
10258
10300
|
fail: 'try `socket login`'
|
|
10259
10301
|
});
|
|
@@ -10389,7 +10431,7 @@ async function run$h(argv, importMeta, {
|
|
|
10389
10431
|
fail: 'missing'
|
|
10390
10432
|
}, {
|
|
10391
10433
|
nook: true,
|
|
10392
|
-
test: hasApiToken,
|
|
10434
|
+
test: dryRun || hasApiToken,
|
|
10393
10435
|
message: 'This command requires a Socket API token for access',
|
|
10394
10436
|
fail: 'try `socket login`'
|
|
10395
10437
|
});
|
|
@@ -10681,7 +10723,7 @@ async function run$g(argv, importMeta, {
|
|
|
10681
10723
|
fail: 'bad'
|
|
10682
10724
|
}, {
|
|
10683
10725
|
nook: true,
|
|
10684
|
-
test: hasApiToken,
|
|
10726
|
+
test: dryRun || hasApiToken,
|
|
10685
10727
|
message: 'This command requires a Socket API token for access',
|
|
10686
10728
|
fail: 'try `socket login`'
|
|
10687
10729
|
}, {
|
|
@@ -10880,7 +10922,7 @@ async function run$f(argv, importMeta, {
|
|
|
10880
10922
|
fail: 'missing'
|
|
10881
10923
|
}, {
|
|
10882
10924
|
nook: true,
|
|
10883
|
-
test: hasApiToken,
|
|
10925
|
+
test: dryRun || hasApiToken,
|
|
10884
10926
|
message: 'This command requires a Socket API token for access',
|
|
10885
10927
|
fail: 'try `socket login`'
|
|
10886
10928
|
});
|
|
@@ -11047,7 +11089,7 @@ async function run$e(argv, importMeta, {
|
|
|
11047
11089
|
fail: 'bad'
|
|
11048
11090
|
}, {
|
|
11049
11091
|
nook: true,
|
|
11050
|
-
test: hasApiToken,
|
|
11092
|
+
test: dryRun || hasApiToken,
|
|
11051
11093
|
message: 'This command requires a Socket API token for access',
|
|
11052
11094
|
fail: 'try `socket login`'
|
|
11053
11095
|
});
|
|
@@ -11531,7 +11573,7 @@ async function run$d(argv, importMeta, {
|
|
|
11531
11573
|
fail: 'omit one'
|
|
11532
11574
|
}, {
|
|
11533
11575
|
nook: true,
|
|
11534
|
-
test: hasApiToken,
|
|
11576
|
+
test: dryRun || hasApiToken,
|
|
11535
11577
|
message: 'This command requires a Socket API token for access',
|
|
11536
11578
|
fail: 'try `socket login`'
|
|
11537
11579
|
}, {
|
|
@@ -11720,7 +11762,7 @@ async function run$c(argv, importMeta, {
|
|
|
11720
11762
|
fail: 'missing'
|
|
11721
11763
|
}, {
|
|
11722
11764
|
nook: true,
|
|
11723
|
-
test: hasApiToken,
|
|
11765
|
+
test: dryRun || hasApiToken,
|
|
11724
11766
|
message: 'This command requires a Socket API token for access',
|
|
11725
11767
|
fail: 'try `socket login`'
|
|
11726
11768
|
});
|
|
@@ -12034,7 +12076,7 @@ async function run$b(argv, importMeta, {
|
|
|
12034
12076
|
fail: 'bad'
|
|
12035
12077
|
}, {
|
|
12036
12078
|
nook: true,
|
|
12037
|
-
test: hasApiToken,
|
|
12079
|
+
test: dryRun || hasApiToken,
|
|
12038
12080
|
message: 'This command requires a Socket API token for access',
|
|
12039
12081
|
fail: 'try `socket login`'
|
|
12040
12082
|
});
|
|
@@ -12927,11 +12969,11 @@ async function run$a(argv, importMeta, {
|
|
|
12927
12969
|
fail: 'omit one'
|
|
12928
12970
|
}, {
|
|
12929
12971
|
nook: true,
|
|
12930
|
-
test: hasSocketApiToken,
|
|
12972
|
+
test: dryRun || hasSocketApiToken,
|
|
12931
12973
|
message: 'This command requires a Socket API token for access',
|
|
12932
12974
|
fail: 'try `socket login`'
|
|
12933
12975
|
}, {
|
|
12934
|
-
test: hasGithubApiToken,
|
|
12976
|
+
test: dryRun || hasGithubApiToken,
|
|
12935
12977
|
message: 'This command requires a GitHub API token for access',
|
|
12936
12978
|
fail: 'missing'
|
|
12937
12979
|
});
|
|
@@ -13195,7 +13237,7 @@ async function run$9(argv, importMeta, {
|
|
|
13195
13237
|
fail: 'omit one'
|
|
13196
13238
|
}, {
|
|
13197
13239
|
nook: true,
|
|
13198
|
-
test: hasApiToken,
|
|
13240
|
+
test: dryRun || hasApiToken,
|
|
13199
13241
|
message: 'This command requires a Socket API token for access',
|
|
13200
13242
|
fail: 'try `socket login`'
|
|
13201
13243
|
}, {
|
|
@@ -13356,7 +13398,7 @@ async function run$8(argv, importMeta, {
|
|
|
13356
13398
|
fail: 'omit one'
|
|
13357
13399
|
}, {
|
|
13358
13400
|
nook: true,
|
|
13359
|
-
test: hasApiToken,
|
|
13401
|
+
test: dryRun || hasApiToken,
|
|
13360
13402
|
message: 'This command requires a Socket API token for access',
|
|
13361
13403
|
fail: 'try `socket login`'
|
|
13362
13404
|
});
|
|
@@ -13579,7 +13621,7 @@ async function run$7(argv, importMeta, {
|
|
|
13579
13621
|
fail: 'missing'
|
|
13580
13622
|
}, {
|
|
13581
13623
|
nook: true,
|
|
13582
|
-
test: hasApiToken,
|
|
13624
|
+
test: dryRun || hasApiToken,
|
|
13583
13625
|
message: 'This command requires an API token for access',
|
|
13584
13626
|
fail: 'try `socket login`'
|
|
13585
13627
|
}, {
|
|
@@ -13769,7 +13811,7 @@ async function run$6(argv, importMeta, {
|
|
|
13769
13811
|
fail: 'omit one'
|
|
13770
13812
|
}, {
|
|
13771
13813
|
nook: true,
|
|
13772
|
-
test: hasApiToken,
|
|
13814
|
+
test: dryRun || hasApiToken,
|
|
13773
13815
|
message: 'This command requires a Socket API token for access',
|
|
13774
13816
|
fail: 'try `socket login`'
|
|
13775
13817
|
});
|
|
@@ -14368,7 +14410,7 @@ async function run$4(argv, importMeta, {
|
|
|
14368
14410
|
fail: 'bad'
|
|
14369
14411
|
}, {
|
|
14370
14412
|
nook: true,
|
|
14371
|
-
test: hasApiToken,
|
|
14413
|
+
test: dryRun || hasApiToken,
|
|
14372
14414
|
message: 'This command requires a Socket API token for access',
|
|
14373
14415
|
fail: 'try `socket login`'
|
|
14374
14416
|
}, {
|
|
@@ -14803,7 +14845,7 @@ async function run$3(argv, importMeta, {
|
|
|
14803
14845
|
fail: 'omit one'
|
|
14804
14846
|
}, {
|
|
14805
14847
|
nook: true,
|
|
14806
|
-
test: hasApiToken,
|
|
14848
|
+
test: dryRun || hasApiToken,
|
|
14807
14849
|
message: 'This command requires a Socket API token for access',
|
|
14808
14850
|
fail: 'try `socket login`'
|
|
14809
14851
|
});
|
|
@@ -15475,5 +15517,5 @@ void (async () => {
|
|
|
15475
15517
|
await utils.captureException(e);
|
|
15476
15518
|
}
|
|
15477
15519
|
})();
|
|
15478
|
-
//# debugId=
|
|
15520
|
+
//# debugId=ebb27358-0f57-49ac-99e3-bf4b9dd0739e
|
|
15479
15521
|
//# sourceMappingURL=cli.js.map
|