socket 1.1.51 → 1.1.53
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 +14 -0
- package/dist/cli.js +123 -48
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +10 -4
- package/dist/constants.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/ci/fetch-default-org-slug.d.mts +1 -1
- package/dist/types/commands/ci/fetch-default-org-slug.d.mts.map +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 +6 -2
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/types.d.mts +1 -0
- package/dist/types/commands/fix/types.d.mts.map +1 -1
- package/dist/types/commands/organization/fetch-organization-list.d.mts +1 -0
- package/dist/types/commands/organization/fetch-organization-list.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts +1 -0
- package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +1 -0
- package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +1 -1
- package/dist/types/constants.d.mts +5 -1
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/utils/api.d.mts +1 -0
- package/dist/types/utils/api.d.mts.map +1 -1
- package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
- package/dist/types/utils/package-environment.d.mts.map +1 -1
- package/dist/utils.js +31 -18
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ 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.53](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.53) - 2026-01-06
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- The `scan_type` query argument is now set to `'socket_tier1'` when running `socket scan create --reach`.
|
|
11
|
+
This change ensures Tier 1 alerts from scans are ingested into the organization-level alerts correctly.
|
|
12
|
+
|
|
13
|
+
## [1.1.52](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.52) - 2026-01-02
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- Added `--silence` flag to `socket fix` to suppress intermediate output and show only the final result.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Updated the Coana CLI to v `14.12.139`.
|
|
20
|
+
|
|
7
21
|
## [1.1.51](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.51) - 2025-12-23
|
|
8
22
|
|
|
9
23
|
### Added
|
package/dist/cli.js
CHANGED
|
@@ -886,7 +886,8 @@ async function fetchCreateOrgFullScan(packagePaths, orgSlug, config, options) {
|
|
|
886
886
|
commitMessage,
|
|
887
887
|
committers,
|
|
888
888
|
pullRequest,
|
|
889
|
-
repoName
|
|
889
|
+
repoName,
|
|
890
|
+
scanType
|
|
890
891
|
} = {
|
|
891
892
|
__proto__: null,
|
|
892
893
|
...config
|
|
@@ -934,6 +935,7 @@ async function fetchCreateOrgFullScan(packagePaths, orgSlug, config, options) {
|
|
|
934
935
|
...(pullRequest ? {
|
|
935
936
|
pull_request: String(pullRequest)
|
|
936
937
|
} : {}),
|
|
938
|
+
scan_type: scanType,
|
|
937
939
|
repo: repoName,
|
|
938
940
|
set_as_pending_head: String(pendingHead),
|
|
939
941
|
tmp: String(tmp)
|
|
@@ -945,7 +947,8 @@ async function fetchCreateOrgFullScan(packagePaths, orgSlug, config, options) {
|
|
|
945
947
|
async function fetchSupportedScanFileNames(options) {
|
|
946
948
|
const {
|
|
947
949
|
sdkOpts,
|
|
948
|
-
spinner
|
|
950
|
+
spinner,
|
|
951
|
+
silence = false
|
|
949
952
|
} = {
|
|
950
953
|
__proto__: null,
|
|
951
954
|
...options
|
|
@@ -957,7 +960,8 @@ async function fetchSupportedScanFileNames(options) {
|
|
|
957
960
|
const sockSdk = sockSdkCResult.data;
|
|
958
961
|
return await utils.handleApiCall(sockSdk.getSupportedScanFiles(), {
|
|
959
962
|
description: 'supported scan file types',
|
|
960
|
-
spinner
|
|
963
|
+
spinner,
|
|
964
|
+
silence
|
|
961
965
|
});
|
|
962
966
|
}
|
|
963
967
|
|
|
@@ -2329,7 +2333,8 @@ async function handleCreateNewScan({
|
|
|
2329
2333
|
committers,
|
|
2330
2334
|
pullRequest,
|
|
2331
2335
|
repoName,
|
|
2332
|
-
branchName
|
|
2336
|
+
branchName,
|
|
2337
|
+
scanType: reach.runReachabilityAnalysis ? constants.default.SCAN_TYPE_SOCKET_TIER1 : constants.default.SCAN_TYPE_SOCKET
|
|
2333
2338
|
}, {
|
|
2334
2339
|
cwd,
|
|
2335
2340
|
defaultBranch,
|
|
@@ -3730,6 +3735,7 @@ async function discoverGhsaIds(orgSlug, tarHash, options) {
|
|
|
3730
3735
|
const {
|
|
3731
3736
|
cwd = process.cwd(),
|
|
3732
3737
|
ecosystems,
|
|
3738
|
+
silence = false,
|
|
3733
3739
|
spinner
|
|
3734
3740
|
} = {
|
|
3735
3741
|
__proto__: null,
|
|
@@ -3737,7 +3743,7 @@ async function discoverGhsaIds(orgSlug, tarHash, options) {
|
|
|
3737
3743
|
};
|
|
3738
3744
|
const foundCResult = await utils.spawnCoanaDlx(['find-vulnerabilities', cwd, '--manifests-tar-hash', tarHash, ...(ecosystems?.length ? ['--purl-types', ...ecosystems] : [])], orgSlug, {
|
|
3739
3745
|
cwd,
|
|
3740
|
-
spinner,
|
|
3746
|
+
spinner: silence ? undefined : spinner,
|
|
3741
3747
|
coanaVersion: options?.coanaVersion
|
|
3742
3748
|
}, {
|
|
3743
3749
|
stdio: 'pipe'
|
|
@@ -3771,20 +3777,24 @@ async function coanaFix(fixConfig) {
|
|
|
3771
3777
|
outputFile,
|
|
3772
3778
|
prLimit,
|
|
3773
3779
|
showAffectedDirectDependencies,
|
|
3780
|
+
silence,
|
|
3774
3781
|
spinner
|
|
3775
3782
|
} = fixConfig;
|
|
3776
3783
|
const fixEnv = await getFixEnv();
|
|
3777
3784
|
require$$9.debugDir('inspect', {
|
|
3778
3785
|
fixEnv
|
|
3779
3786
|
});
|
|
3780
|
-
|
|
3787
|
+
if (!silence) {
|
|
3788
|
+
spinner?.start();
|
|
3789
|
+
}
|
|
3781
3790
|
const sockSdkCResult = await utils.setupSdk();
|
|
3782
3791
|
if (!sockSdkCResult.ok) {
|
|
3783
3792
|
return sockSdkCResult;
|
|
3784
3793
|
}
|
|
3785
3794
|
const sockSdk = sockSdkCResult.data;
|
|
3786
3795
|
const supportedFilesCResult = await fetchSupportedScanFileNames({
|
|
3787
|
-
spinner
|
|
3796
|
+
spinner: silence ? undefined : spinner,
|
|
3797
|
+
silence
|
|
3788
3798
|
});
|
|
3789
3799
|
if (!supportedFilesCResult.ok) {
|
|
3790
3800
|
return supportedFilesCResult;
|
|
@@ -3798,14 +3808,17 @@ async function coanaFix(fixConfig) {
|
|
|
3798
3808
|
const filepathsToUpload = scanFilepaths.filter(p => path.basename(p).toLowerCase() !== constants.DOT_SOCKET_DOT_FACTS_JSON);
|
|
3799
3809
|
const uploadCResult = await utils.handleApiCall(sockSdk.uploadManifestFiles(orgSlug, filepathsToUpload, cwd), {
|
|
3800
3810
|
description: 'upload manifests',
|
|
3801
|
-
spinner
|
|
3811
|
+
spinner,
|
|
3812
|
+
silence
|
|
3802
3813
|
});
|
|
3803
3814
|
if (!uploadCResult.ok) {
|
|
3804
3815
|
return uploadCResult;
|
|
3805
3816
|
}
|
|
3806
3817
|
const tarHash = uploadCResult.data.tarHash;
|
|
3807
3818
|
if (!tarHash) {
|
|
3808
|
-
|
|
3819
|
+
if (!silence) {
|
|
3820
|
+
spinner?.stop();
|
|
3821
|
+
}
|
|
3809
3822
|
return {
|
|
3810
3823
|
ok: false,
|
|
3811
3824
|
message: 'No tar hash returned from Socket API upload-manifest-files endpoint',
|
|
@@ -3816,12 +3829,12 @@ async function coanaFix(fixConfig) {
|
|
|
3816
3829
|
const shouldOpenPrs = fixEnv.isCi && fixEnv.repoInfo;
|
|
3817
3830
|
if (!shouldOpenPrs) {
|
|
3818
3831
|
// In local mode, if neither --all nor --id is provided, show deprecation warning.
|
|
3819
|
-
if (shouldDiscoverGhsaIds && !all) {
|
|
3832
|
+
if (!silence && shouldDiscoverGhsaIds && !all) {
|
|
3820
3833
|
logger.logger.warn('Implicit --all is deprecated in local mode and will be removed in a future release. Please use --all explicitly.');
|
|
3821
3834
|
}
|
|
3822
3835
|
|
|
3823
3836
|
// Inform user about local mode when fixes will be applied.
|
|
3824
|
-
if (applyFixes && ghsas.length) {
|
|
3837
|
+
if (!silence && applyFixes && ghsas.length) {
|
|
3825
3838
|
const envCheck = checkCiEnvVars();
|
|
3826
3839
|
if (envCheck.present.length) {
|
|
3827
3840
|
// Some CI vars are set but not all - show what's missing.
|
|
@@ -3839,10 +3852,13 @@ async function coanaFix(fixConfig) {
|
|
|
3839
3852
|
coanaVersion,
|
|
3840
3853
|
cwd,
|
|
3841
3854
|
ecosystems,
|
|
3855
|
+
silence,
|
|
3842
3856
|
spinner
|
|
3843
3857
|
}) : ghsas;
|
|
3844
3858
|
if (ids.length === 0) {
|
|
3845
|
-
|
|
3859
|
+
if (!silence) {
|
|
3860
|
+
spinner?.stop();
|
|
3861
|
+
}
|
|
3846
3862
|
return {
|
|
3847
3863
|
ok: true,
|
|
3848
3864
|
data: {
|
|
@@ -3858,10 +3874,12 @@ async function coanaFix(fixConfig) {
|
|
|
3858
3874
|
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, ...(debug ? ['--debug'] : []), ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3859
3875
|
coanaVersion,
|
|
3860
3876
|
cwd,
|
|
3861
|
-
spinner,
|
|
3862
|
-
stdio: 'inherit'
|
|
3877
|
+
spinner: silence ? undefined : spinner,
|
|
3878
|
+
stdio: silence ? 'pipe' : 'inherit'
|
|
3863
3879
|
});
|
|
3864
|
-
|
|
3880
|
+
if (!silence) {
|
|
3881
|
+
spinner?.stop();
|
|
3882
|
+
}
|
|
3865
3883
|
if (!fixCResult.ok) {
|
|
3866
3884
|
return fixCResult;
|
|
3867
3885
|
}
|
|
@@ -3873,7 +3891,9 @@ async function coanaFix(fixConfig) {
|
|
|
3873
3891
|
|
|
3874
3892
|
// Copy to outputFile if provided.
|
|
3875
3893
|
if (outputFile) {
|
|
3876
|
-
|
|
3894
|
+
if (!silence) {
|
|
3895
|
+
logger.logger.info(`Copying fixes result to ${outputFile}`);
|
|
3896
|
+
}
|
|
3877
3897
|
const tmpContent = await fs$1.promises.readFile(tmpFile, 'utf8');
|
|
3878
3898
|
await fs$1.promises.writeFile(outputFile, tmpContent, 'utf8');
|
|
3879
3899
|
}
|
|
@@ -3919,6 +3939,7 @@ async function coanaFix(fixConfig) {
|
|
|
3919
3939
|
coanaVersion,
|
|
3920
3940
|
cwd,
|
|
3921
3941
|
ecosystems,
|
|
3942
|
+
silence,
|
|
3922
3943
|
spinner
|
|
3923
3944
|
}) : ghsas).slice(0, adjustedPrLimit);
|
|
3924
3945
|
}
|
|
@@ -3929,7 +3950,9 @@ async function coanaFix(fixConfig) {
|
|
|
3929
3950
|
require$$9.debugFn('notice', 'miss: no repo info detected');
|
|
3930
3951
|
}
|
|
3931
3952
|
if (!ids?.length || !fixEnv.repoInfo) {
|
|
3932
|
-
|
|
3953
|
+
if (!silence) {
|
|
3954
|
+
spinner?.stop();
|
|
3955
|
+
}
|
|
3933
3956
|
return {
|
|
3934
3957
|
ok: true,
|
|
3935
3958
|
data: {
|
|
@@ -3956,11 +3979,13 @@ async function coanaFix(fixConfig) {
|
|
|
3956
3979
|
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] : []), ...(debug ? ['--debug'] : []), ...(disableMajorUpdates ? ['--disable-major-updates'] : []), ...(showAffectedDirectDependencies ? ['--show-affected-direct-dependencies'] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3957
3980
|
coanaVersion,
|
|
3958
3981
|
cwd,
|
|
3959
|
-
spinner,
|
|
3960
|
-
stdio: 'inherit'
|
|
3982
|
+
spinner: silence ? undefined : spinner,
|
|
3983
|
+
stdio: silence ? 'pipe' : 'inherit'
|
|
3961
3984
|
});
|
|
3962
3985
|
if (!fixCResult.ok) {
|
|
3963
|
-
|
|
3986
|
+
if (!silence) {
|
|
3987
|
+
logger.logger.error(`Update failed for ${ghsaId}: ${utils.getErrorCause(fixCResult)}`);
|
|
3988
|
+
}
|
|
3964
3989
|
continue ghsaLoop;
|
|
3965
3990
|
}
|
|
3966
3991
|
|
|
@@ -3983,7 +4008,9 @@ async function coanaFix(fixConfig) {
|
|
|
3983
4008
|
});
|
|
3984
4009
|
if (existingOpenPrs.length > 0) {
|
|
3985
4010
|
const prNum = existingOpenPrs[0].number;
|
|
3986
|
-
|
|
4011
|
+
if (!silence) {
|
|
4012
|
+
logger.logger.info(`PR #${prNum} already exists for ${ghsaId}, skipping.`);
|
|
4013
|
+
}
|
|
3987
4014
|
require$$9.debugFn('notice', `skip: open PR #${prNum} exists for ${ghsaId}`);
|
|
3988
4015
|
continue ghsaLoop;
|
|
3989
4016
|
}
|
|
@@ -4001,7 +4028,9 @@ async function coanaFix(fixConfig) {
|
|
|
4001
4028
|
|
|
4002
4029
|
// Check for GitHub token before doing any git operations.
|
|
4003
4030
|
if (!fixEnv.githubToken) {
|
|
4004
|
-
|
|
4031
|
+
if (!silence) {
|
|
4032
|
+
logger.logger.error('Cannot create pull request: SOCKET_CLI_GITHUB_TOKEN environment variable is not set.\n' + 'Set SOCKET_CLI_GITHUB_TOKEN or GITHUB_TOKEN to enable PR creation.');
|
|
4033
|
+
}
|
|
4005
4034
|
require$$9.debugFn('error', `skip: missing GitHub token for ${ghsaId}`);
|
|
4006
4035
|
continue ghsaLoop;
|
|
4007
4036
|
}
|
|
@@ -4022,7 +4051,9 @@ async function coanaFix(fixConfig) {
|
|
|
4022
4051
|
// eslint-disable-next-line no-await-in-loop
|
|
4023
4052
|
await utils.gitPushBranch(branch, cwd));
|
|
4024
4053
|
if (!pushed) {
|
|
4025
|
-
|
|
4054
|
+
if (!silence) {
|
|
4055
|
+
logger.logger.warn(`Push failed for ${ghsaId}, skipping PR creation.`);
|
|
4056
|
+
}
|
|
4026
4057
|
// eslint-disable-next-line no-await-in-loop
|
|
4027
4058
|
await utils.gitResetAndClean(fixEnv.baseBranch, cwd);
|
|
4028
4059
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -4049,23 +4080,29 @@ async function coanaFix(fixConfig) {
|
|
|
4049
4080
|
data
|
|
4050
4081
|
} = prResult.pr;
|
|
4051
4082
|
const prRef = `PR #${data.number}`;
|
|
4052
|
-
|
|
4083
|
+
if (!silence) {
|
|
4084
|
+
logger.logger.success(`Opened ${prRef} for ${ghsaId}.`);
|
|
4085
|
+
}
|
|
4053
4086
|
if (autopilot) {
|
|
4054
|
-
|
|
4055
|
-
|
|
4087
|
+
if (!silence) {
|
|
4088
|
+
logger.logger.indent();
|
|
4089
|
+
spinner?.indent();
|
|
4090
|
+
}
|
|
4056
4091
|
// eslint-disable-next-line no-await-in-loop
|
|
4057
4092
|
const {
|
|
4058
4093
|
details,
|
|
4059
4094
|
enabled
|
|
4060
4095
|
} = await utils.enablePrAutoMerge(data);
|
|
4061
|
-
if (
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4096
|
+
if (!silence) {
|
|
4097
|
+
if (enabled) {
|
|
4098
|
+
logger.logger.info(`Auto-merge enabled for ${prRef}.`);
|
|
4099
|
+
} else {
|
|
4100
|
+
const message = `Failed to enable auto-merge for ${prRef}${details ? `:\n${details.map(d => ` - ${d}`).join('\n')}` : '.'}`;
|
|
4101
|
+
logger.logger.error(message);
|
|
4102
|
+
}
|
|
4103
|
+
logger.logger.dedent();
|
|
4104
|
+
spinner?.dedent();
|
|
4066
4105
|
}
|
|
4067
|
-
logger.logger.dedent();
|
|
4068
|
-
spinner?.dedent();
|
|
4069
4106
|
}
|
|
4070
4107
|
|
|
4071
4108
|
// Clean up local branch only - keep remote branch for PR merge.
|
|
@@ -4074,22 +4111,32 @@ async function coanaFix(fixConfig) {
|
|
|
4074
4111
|
} else {
|
|
4075
4112
|
// Handle PR creation failures.
|
|
4076
4113
|
if (prResult.reason === 'already_exists') {
|
|
4077
|
-
|
|
4114
|
+
if (!silence) {
|
|
4115
|
+
logger.logger.info(`PR already exists for ${ghsaId} (this should not happen due to earlier check).`);
|
|
4116
|
+
}
|
|
4078
4117
|
// Don't delete branch - PR exists and needs it.
|
|
4079
4118
|
} else if (prResult.reason === 'validation_error') {
|
|
4080
|
-
|
|
4119
|
+
if (!silence) {
|
|
4120
|
+
logger.logger.error(`Failed to create PR for ${ghsaId}:\n${prResult.details}`);
|
|
4121
|
+
}
|
|
4081
4122
|
// eslint-disable-next-line no-await-in-loop
|
|
4082
4123
|
await cleanupFailedPrBranches(branch, cwd);
|
|
4083
4124
|
} else if (prResult.reason === 'permission_denied') {
|
|
4084
|
-
|
|
4125
|
+
if (!silence) {
|
|
4126
|
+
logger.logger.error(`Failed to create PR for ${ghsaId}: Permission denied. Check SOCKET_CLI_GITHUB_TOKEN permissions.`);
|
|
4127
|
+
}
|
|
4085
4128
|
// eslint-disable-next-line no-await-in-loop
|
|
4086
4129
|
await cleanupFailedPrBranches(branch, cwd);
|
|
4087
4130
|
} else if (prResult.reason === 'network_error') {
|
|
4088
|
-
|
|
4131
|
+
if (!silence) {
|
|
4132
|
+
logger.logger.error(`Failed to create PR for ${ghsaId}: Network error. Please try again.`);
|
|
4133
|
+
}
|
|
4089
4134
|
// eslint-disable-next-line no-await-in-loop
|
|
4090
4135
|
await cleanupFailedPrBranches(branch, cwd);
|
|
4091
4136
|
} else {
|
|
4092
|
-
|
|
4137
|
+
if (!silence) {
|
|
4138
|
+
logger.logger.error(`Failed to create PR for ${ghsaId}: ${prResult.error.message}`);
|
|
4139
|
+
}
|
|
4093
4140
|
// eslint-disable-next-line no-await-in-loop
|
|
4094
4141
|
await cleanupFailedPrBranches(branch, cwd);
|
|
4095
4142
|
}
|
|
@@ -4101,7 +4148,9 @@ async function coanaFix(fixConfig) {
|
|
|
4101
4148
|
// eslint-disable-next-line no-await-in-loop
|
|
4102
4149
|
await utils.gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
4103
4150
|
} catch (e) {
|
|
4104
|
-
|
|
4151
|
+
if (!silence) {
|
|
4152
|
+
logger.logger.warn(`Unexpected condition: Push failed for ${ghsaId}, skipping PR creation.`);
|
|
4153
|
+
}
|
|
4105
4154
|
require$$9.debugDir('error', e);
|
|
4106
4155
|
// Clean up branches (push may have succeeded before error).
|
|
4107
4156
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -4119,7 +4168,9 @@ async function coanaFix(fixConfig) {
|
|
|
4119
4168
|
break ghsaLoop;
|
|
4120
4169
|
}
|
|
4121
4170
|
}
|
|
4122
|
-
|
|
4171
|
+
if (!silence) {
|
|
4172
|
+
spinner?.stop();
|
|
4173
|
+
}
|
|
4123
4174
|
return {
|
|
4124
4175
|
ok: true,
|
|
4125
4176
|
data: {
|
|
@@ -4150,7 +4201,13 @@ const CVE_FORMAT_REGEXP = /^CVE-\d{4}-\d{4,}$/;
|
|
|
4150
4201
|
* Converts mixed CVE/GHSA/PURL IDs to GHSA IDs only.
|
|
4151
4202
|
* Filters out invalid IDs and logs conversion results.
|
|
4152
4203
|
*/
|
|
4153
|
-
async function convertIdsToGhsas(ids) {
|
|
4204
|
+
async function convertIdsToGhsas(ids, options) {
|
|
4205
|
+
const {
|
|
4206
|
+
silence = false
|
|
4207
|
+
} = {
|
|
4208
|
+
__proto__: null,
|
|
4209
|
+
...options
|
|
4210
|
+
};
|
|
4154
4211
|
require$$9.debugFn('notice', `Converting ${ids.length} IDs to GHSA format`);
|
|
4155
4212
|
require$$9.debugDir('inspect', {
|
|
4156
4213
|
ids
|
|
@@ -4177,17 +4234,21 @@ async function convertIdsToGhsas(ids) {
|
|
|
4177
4234
|
const conversionResult = await utils.convertCveToGhsa(trimmedId);
|
|
4178
4235
|
if (conversionResult.ok) {
|
|
4179
4236
|
validGhsas.push(conversionResult.data);
|
|
4180
|
-
|
|
4237
|
+
if (!silence) {
|
|
4238
|
+
logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data}`);
|
|
4239
|
+
}
|
|
4181
4240
|
} else {
|
|
4182
4241
|
errors.push(`${trimmedId}: ${conversionResult.message}`);
|
|
4183
4242
|
}
|
|
4184
4243
|
} else if (trimmedId.startsWith('pkg:')) {
|
|
4185
|
-
// Convert PURL to GHSAs
|
|
4244
|
+
// Convert PURL to GHSAs.
|
|
4186
4245
|
// eslint-disable-next-line no-await-in-loop
|
|
4187
4246
|
const conversionResult = await utils.convertPurlToGhsas(trimmedId);
|
|
4188
4247
|
if (conversionResult.ok && conversionResult.data.length) {
|
|
4189
4248
|
validGhsas.push(...conversionResult.data);
|
|
4190
|
-
|
|
4249
|
+
if (!silence) {
|
|
4250
|
+
logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data.length} GHSA(s): ${arrays.joinAnd(conversionResult.data)}`);
|
|
4251
|
+
}
|
|
4191
4252
|
} else {
|
|
4192
4253
|
errors.push(`${trimmedId}: ${conversionResult.message || 'No GHSAs found'}`);
|
|
4193
4254
|
}
|
|
@@ -4197,7 +4258,9 @@ async function convertIdsToGhsas(ids) {
|
|
|
4197
4258
|
}
|
|
4198
4259
|
}
|
|
4199
4260
|
if (errors.length) {
|
|
4200
|
-
|
|
4261
|
+
if (!silence) {
|
|
4262
|
+
logger.logger.warn(`Skipped ${errors.length} invalid IDs:\n${errors.map(e => ` - ${e}`).join('\n')}`);
|
|
4263
|
+
}
|
|
4201
4264
|
require$$9.debugDir('inspect', {
|
|
4202
4265
|
errors
|
|
4203
4266
|
});
|
|
@@ -4229,6 +4292,7 @@ async function handleFix({
|
|
|
4229
4292
|
prLimit,
|
|
4230
4293
|
rangeStyle,
|
|
4231
4294
|
showAffectedDirectDependencies,
|
|
4295
|
+
silence,
|
|
4232
4296
|
spinner,
|
|
4233
4297
|
unknownFlags
|
|
4234
4298
|
}) {
|
|
@@ -4253,6 +4317,7 @@ async function handleFix({
|
|
|
4253
4317
|
prLimit,
|
|
4254
4318
|
rangeStyle,
|
|
4255
4319
|
showAffectedDirectDependencies,
|
|
4320
|
+
silence,
|
|
4256
4321
|
unknownFlags
|
|
4257
4322
|
});
|
|
4258
4323
|
await outputFixResult(await coanaFix({
|
|
@@ -4266,7 +4331,9 @@ async function handleFix({
|
|
|
4266
4331
|
ecosystems,
|
|
4267
4332
|
exclude,
|
|
4268
4333
|
// Convert mixed CVE/GHSA/PURL inputs to GHSA IDs only.
|
|
4269
|
-
ghsas: await convertIdsToGhsas(ghsas
|
|
4334
|
+
ghsas: await convertIdsToGhsas(ghsas, {
|
|
4335
|
+
silence
|
|
4336
|
+
}),
|
|
4270
4337
|
include,
|
|
4271
4338
|
minimumReleaseAge,
|
|
4272
4339
|
minSatisfying,
|
|
@@ -4276,6 +4343,7 @@ async function handleFix({
|
|
|
4276
4343
|
prLimit,
|
|
4277
4344
|
rangeStyle,
|
|
4278
4345
|
showAffectedDirectDependencies,
|
|
4346
|
+
silence,
|
|
4279
4347
|
spinner,
|
|
4280
4348
|
unknownFlags
|
|
4281
4349
|
}), outputKind);
|
|
@@ -4386,6 +4454,11 @@ Available styles:
|
|
|
4386
4454
|
type: 'boolean',
|
|
4387
4455
|
default: false,
|
|
4388
4456
|
description: 'List the direct dependencies responsible for introducing transitive vulnerabilities and list the updates required to resolve the vulnerabilities'
|
|
4457
|
+
},
|
|
4458
|
+
silence: {
|
|
4459
|
+
type: 'boolean',
|
|
4460
|
+
default: false,
|
|
4461
|
+
description: 'Silence all output except the final result'
|
|
4389
4462
|
}
|
|
4390
4463
|
};
|
|
4391
4464
|
const hiddenFlags = {
|
|
@@ -4511,6 +4584,7 @@ async function run$K(argv, importMeta, {
|
|
|
4511
4584
|
prLimit,
|
|
4512
4585
|
rangeStyle,
|
|
4513
4586
|
showAffectedDirectDependencies,
|
|
4587
|
+
silence,
|
|
4514
4588
|
// We patched in this feature with `npx custompatch meow` at
|
|
4515
4589
|
// socket-cli/patches/meow#13.2.0.patch.
|
|
4516
4590
|
unknownFlags = []
|
|
@@ -4559,7 +4633,7 @@ async function run$K(argv, importMeta, {
|
|
|
4559
4633
|
logger.logger.log(constants.default.DRY_RUN_NOT_SAVING);
|
|
4560
4634
|
return;
|
|
4561
4635
|
}
|
|
4562
|
-
const orgSlugCResult = await utils.getDefaultOrgSlug();
|
|
4636
|
+
const orgSlugCResult = await utils.getDefaultOrgSlug(silence);
|
|
4563
4637
|
if (!orgSlugCResult.ok) {
|
|
4564
4638
|
process.exitCode = orgSlugCResult.code ?? 1;
|
|
4565
4639
|
logger.logger.fail(`${constants.ERROR_UNABLE_RESOLVE_ORG}.\nEnsure a Socket API token is specified for the organization using the SOCKET_CLI_API_TOKEN environment variable.`);
|
|
@@ -4596,6 +4670,7 @@ async function run$K(argv, importMeta, {
|
|
|
4596
4670
|
prLimit,
|
|
4597
4671
|
rangeStyle,
|
|
4598
4672
|
showAffectedDirectDependencies,
|
|
4673
|
+
silence,
|
|
4599
4674
|
spinner,
|
|
4600
4675
|
unknownFlags
|
|
4601
4676
|
});
|
|
@@ -15267,5 +15342,5 @@ process.on('unhandledRejection', async (reason, promise) => {
|
|
|
15267
15342
|
// eslint-disable-next-line n/no-process-exit
|
|
15268
15343
|
process.exit(1);
|
|
15269
15344
|
});
|
|
15270
|
-
//# debugId=
|
|
15345
|
+
//# debugId=34fc0e98-20b6-46ae-ac78-e1d398b7a973
|
|
15271
15346
|
//# sourceMappingURL=cli.js.map
|