@socketsecurity/cli-with-sentry 1.1.18 ā 1.1.20
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 +9 -0
- package/bin/npm-cli.js +2 -2
- package/bin/npx-cli.js +2 -2
- package/bin/pnpm-cli.js +2 -2
- package/bin/yarn-cli.js +2 -2
- package/dist/cli.js +285 -117
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +8 -3
- package/dist/constants.js.map +1 -1
- package/dist/flags.js +3 -2
- package/dist/flags.js.map +1 -1
- package/dist/npm-cli.js +3 -4
- package/dist/npm-cli.js.map +1 -1
- package/dist/npx-cli.js +3 -3
- package/dist/npx-cli.js.map +1 -1
- package/dist/pnpm-cli.js +3 -3
- package/dist/pnpm-cli.js.map +1 -1
- package/dist/shadow-npm-bin.js +3 -106
- package/dist/shadow-npm-bin.js.map +1 -1
- package/dist/shadow-npm-bin2.js +125 -0
- package/dist/shadow-npm-bin2.js.map +1 -0
- package/dist/shadow-npx-bin.js +12 -0
- package/dist/shadow-npx-bin.js.map +1 -0
- package/dist/shadow-pnpm-bin.js +3 -228
- package/dist/shadow-pnpm-bin.js.map +1 -1
- package/dist/shadow-pnpm-bin2.js +323 -0
- package/dist/shadow-pnpm-bin2.js.map +1 -0
- package/dist/shadow-yarn-bin.js +62 -150
- package/dist/shadow-yarn-bin.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/analytics/cmd-analytics.d.mts.map +1 -1
- package/dist/types/commands/analytics/output-analytics.d.mts.map +1 -1
- package/dist/types/commands/audit-log/cmd-audit-log.d.mts.map +1 -1
- package/dist/types/commands/audit-log/output-audit-log.d.mts.map +1 -1
- package/dist/types/commands/ci/handle-ci.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-auto.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-get.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-list.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-set.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-unset.d.mts.map +1 -1
- package/dist/types/commands/config/handle-config-set.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.map +1 -1
- package/dist/types/commands/fix/pull-request.d.mts.map +1 -1
- package/dist/types/commands/login/attempt-login.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-conda.d.mts.map +1 -1
- package/dist/types/commands/npm/cmd-npm.d.mts.map +1 -1
- package/dist/types/commands/optimize/handle-optimize.d.mts.map +1 -1
- package/dist/types/commands/optimize/ls-by-agent.d.mts.map +1 -1
- package/dist/types/commands/organization/cmd-organization-dependencies.d.mts.map +1 -1
- package/dist/types/commands/organization/cmd-organization-list.d.mts.map +1 -1
- package/dist/types/commands/organization/handle-dependencies.d.mts.map +1 -1
- package/dist/types/commands/organization/handle-organization-list.d.mts.map +1 -1
- package/dist/types/commands/package/handle-purl-deep-score.d.mts.map +1 -1
- package/dist/types/commands/package/handle-purls-shallow-score.d.mts.map +1 -1
- package/dist/types/commands/pnpm/cmd-pnpm.d.mts.map +1 -1
- package/dist/types/commands/raw-npm/run-raw-npm.d.mts.map +1 -1
- package/dist/types/commands/raw-npx/run-raw-npx.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-create.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-del.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-list.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-update.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-view.d.mts.map +1 -1
- package/dist/types/commands/repository/handle-create-repo.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-create.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-diff.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-list.d.mts.map +1 -1
- package/dist/types/commands/scan/create-scan-from-github.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-report-data.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/output-diff-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/output-scan-view.d.mts.map +1 -1
- package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +1 -1
- package/dist/types/commands/wrapper/postinstall-wrapper.d.mts.map +1 -1
- package/dist/types/commands/yarn/cmd-yarn.d.mts.map +1 -1
- package/dist/types/constants.d.mts +1 -0
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/flags.d.mts.map +1 -1
- package/dist/types/shadow/common.d.mts +31 -0
- package/dist/types/shadow/common.d.mts.map +1 -0
- package/dist/types/shadow/npm/bin.d.mts +4 -10
- package/dist/types/shadow/npm/bin.d.mts.map +1 -1
- package/dist/types/shadow/npm-base.d.mts +11 -0
- package/dist/types/shadow/npm-base.d.mts.map +1 -0
- package/dist/types/shadow/npx/bin.d.mts +5 -0
- package/dist/types/shadow/npx/bin.d.mts.map +1 -0
- package/dist/types/shadow/pnpm/bin.d.mts +1 -1
- package/dist/types/shadow/pnpm/bin.d.mts.map +1 -1
- package/dist/types/shadow/stdio-ipc.d.mts +7 -0
- package/dist/types/shadow/stdio-ipc.d.mts.map +1 -0
- package/dist/types/shadow/yarn/bin.d.mts +1 -1
- package/dist/types/shadow/yarn/bin.d.mts.map +1 -1
- package/dist/types/utils/agent.d.mts.map +1 -1
- package/dist/types/utils/alerts-map.d.mts.map +1 -1
- package/dist/types/utils/api.d.mts.map +1 -1
- package/dist/types/utils/cmd.d.mts.map +1 -1
- package/dist/types/utils/coana.d.mts.map +1 -1
- package/dist/types/utils/color-or-markdown.d.mts.map +1 -1
- package/dist/types/utils/config.d.mts.map +1 -1
- package/dist/types/utils/cve-to-ghsa.d.mts.map +1 -1
- package/dist/types/utils/debug.d.mts +45 -0
- package/dist/types/utils/debug.d.mts.map +1 -0
- package/dist/types/utils/determine-org-slug.d.mts.map +1 -1
- package/dist/types/utils/dlx.d.mts +1 -1
- package/dist/types/utils/dlx.d.mts.map +1 -1
- package/dist/types/utils/ecosystem.d.mts.map +1 -1
- package/dist/types/utils/errors.d.mts +48 -0
- package/dist/types/utils/errors.d.mts.map +1 -1
- package/dist/types/utils/filter-config.d.mts.map +1 -1
- package/dist/types/utils/fs.d.mts.map +1 -1
- package/dist/types/utils/get-output-kind.d.mts.map +1 -1
- package/dist/types/utils/git.d.mts.map +1 -1
- package/dist/types/utils/github.d.mts.map +1 -1
- package/dist/types/utils/markdown.d.mts +17 -0
- package/dist/types/utils/markdown.d.mts.map +1 -1
- package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
- package/dist/types/utils/npm-package-arg.d.mts +5 -1
- package/dist/types/utils/npm-package-arg.d.mts.map +1 -1
- package/dist/types/utils/npm-paths.d.mts.map +1 -1
- package/dist/types/utils/npm-spec.d.mts +57 -0
- package/dist/types/utils/npm-spec.d.mts.map +1 -0
- package/dist/types/utils/output-formatting.d.mts.map +1 -1
- package/dist/types/utils/package-environment.d.mts.map +1 -1
- package/dist/types/utils/pnpm-paths.d.mts.map +1 -1
- package/dist/types/utils/purl-to-ghsa.d.mts.map +1 -1
- package/dist/types/utils/purl.d.mts +24 -0
- package/dist/types/utils/purl.d.mts.map +1 -1
- package/dist/types/utils/requirements.d.mts.map +1 -1
- package/dist/types/utils/sdk.d.mts.map +1 -1
- package/dist/types/utils/serialize-result-json.d.mts.map +1 -1
- package/dist/types/utils/socket-json.d.mts.map +1 -1
- package/dist/types/utils/socket-package-alert.d.mts.map +1 -1
- package/dist/types/utils/socket-url.d.mts.map +1 -1
- package/dist/types/utils/strings.d.mts +12 -0
- package/dist/types/utils/strings.d.mts.map +1 -1
- package/dist/types/utils/terminal-link.d.mts +45 -0
- package/dist/types/utils/terminal-link.d.mts.map +1 -0
- package/dist/types/utils/tildify.d.mts +0 -2
- package/dist/types/utils/tildify.d.mts.map +1 -1
- package/dist/types/utils/yarn-paths.d.mts.map +1 -1
- package/dist/types/utils/yarn-version.d.mts.map +1 -1
- package/dist/utils.js +1393 -453
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +682 -682
- package/package.json +3 -3
- package/shadow-bin/npm +2 -2
- package/shadow-bin/npx +2 -2
- package/shadow-bin/pnpm +2 -2
- package/shadow-bin/yarn +2 -2
package/dist/cli.js
CHANGED
|
@@ -94,8 +94,10 @@ async function outputAnalytics(result, {
|
|
|
94
94
|
if (filepath) {
|
|
95
95
|
try {
|
|
96
96
|
await fs.writeFile(filepath, serialized, 'utf8');
|
|
97
|
-
|
|
97
|
+
utils.debugFileOp('write', filepath);
|
|
98
|
+
logger.logger.success(`Data successfully written to ${utils.fileLink(filepath)}`);
|
|
98
99
|
} catch (e) {
|
|
100
|
+
utils.debugFileOp('write', filepath, e);
|
|
99
101
|
process.exitCode = 1;
|
|
100
102
|
logger.logger.log(utils.serializeResultJson({
|
|
101
103
|
ok: false,
|
|
@@ -116,8 +118,10 @@ async function outputAnalytics(result, {
|
|
|
116
118
|
if (filepath) {
|
|
117
119
|
try {
|
|
118
120
|
await fs.writeFile(filepath, serialized, 'utf8');
|
|
119
|
-
|
|
121
|
+
utils.debugFileOp('write', filepath);
|
|
122
|
+
logger.logger.success(`Data successfully written to ${utils.fileLink(filepath)}`);
|
|
120
123
|
} catch (e) {
|
|
124
|
+
utils.debugFileOp('write', filepath, e);
|
|
121
125
|
logger.logger.error(e);
|
|
122
126
|
}
|
|
123
127
|
} else {
|
|
@@ -414,7 +418,7 @@ async function run$S(argv, importMeta, {
|
|
|
414
418
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
415
419
|
nook: true,
|
|
416
420
|
test: noLegacy,
|
|
417
|
-
message: `Legacy flags are no longer supported. See ${
|
|
421
|
+
message: `Legacy flags are no longer supported. See the ${utils.webLink(constants.V1_MIGRATION_GUIDE_URL, 'v1 migration guide')}.`,
|
|
418
422
|
fail: `received legacy flags`
|
|
419
423
|
}, {
|
|
420
424
|
nook: true,
|
|
@@ -433,12 +437,12 @@ async function run$S(argv, importMeta, {
|
|
|
433
437
|
}, {
|
|
434
438
|
nook: true,
|
|
435
439
|
test: !filepath || !!json || !!markdown,
|
|
436
|
-
message:
|
|
440
|
+
message: `The \`--file\` flag is only valid when using \`${constants.FLAG_JSON}\` or \`${constants.FLAG_MARKDOWN}\``,
|
|
437
441
|
fail: 'bad'
|
|
438
442
|
}, {
|
|
439
443
|
nook: true,
|
|
440
444
|
test: !json || !markdown,
|
|
441
|
-
message:
|
|
445
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
442
446
|
fail: 'bad'
|
|
443
447
|
}, {
|
|
444
448
|
nook: true,
|
|
@@ -612,11 +616,9 @@ ${table}
|
|
|
612
616
|
`;
|
|
613
617
|
} catch (e) {
|
|
614
618
|
process.exitCode = 1;
|
|
615
|
-
logger.logger.fail(
|
|
616
|
-
require$$9.debugFn('error', '
|
|
617
|
-
require$$9.debugDir('
|
|
618
|
-
error: e
|
|
619
|
-
});
|
|
619
|
+
logger.logger.fail(`There was a problem converting the logs to Markdown, please try the \`${constants.FLAG_JSON}\` flag`);
|
|
620
|
+
require$$9.debugFn('error', 'Markdown conversion failed');
|
|
621
|
+
require$$9.debugDir('error', e);
|
|
620
622
|
return 'Failed to generate the markdown report';
|
|
621
623
|
}
|
|
622
624
|
}
|
|
@@ -791,7 +793,7 @@ async function run$R(argv, importMeta, {
|
|
|
791
793
|
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$x}`)}
|
|
792
794
|
|
|
793
795
|
This feature requires an Enterprise Plan. To learn more about getting access
|
|
794
|
-
to this feature and many more, please visit ${constants.default.SOCKET_WEBSITE_URL}/pricing
|
|
796
|
+
to this feature and many more, please visit the ${utils.webLink(`${constants.default.SOCKET_WEBSITE_URL}/pricing`, 'Socket pricing page')}.
|
|
795
797
|
|
|
796
798
|
The type FILTER arg is an enum. Defaults to any. It should be one of these:
|
|
797
799
|
associateLabel, cancelInvitation, changeMemberRole, changePlanSubscriptionSeats,
|
|
@@ -839,7 +841,7 @@ async function run$R(argv, importMeta, {
|
|
|
839
841
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
840
842
|
nook: true,
|
|
841
843
|
test: noLegacy,
|
|
842
|
-
message: `Legacy flags are no longer supported. See ${
|
|
844
|
+
message: `Legacy flags are no longer supported. See the ${utils.webLink(constants.V1_MIGRATION_GUIDE_URL, 'v1 migration guide')}.`,
|
|
843
845
|
fail: `received legacy flags`
|
|
844
846
|
}, {
|
|
845
847
|
nook: true,
|
|
@@ -854,7 +856,7 @@ async function run$R(argv, importMeta, {
|
|
|
854
856
|
}, {
|
|
855
857
|
nook: true,
|
|
856
858
|
test: !json || !markdown,
|
|
857
|
-
message:
|
|
859
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
858
860
|
fail: 'bad'
|
|
859
861
|
}, {
|
|
860
862
|
nook: true,
|
|
@@ -1021,8 +1023,8 @@ async function fetchScanData(orgSlug, scanId, options) {
|
|
|
1021
1023
|
return JSON.parse(line);
|
|
1022
1024
|
} catch (e) {
|
|
1023
1025
|
ok = false;
|
|
1024
|
-
require$$9.debugFn('error', '
|
|
1025
|
-
require$$9.debugDir('
|
|
1026
|
+
require$$9.debugFn('error', 'Failed to parse report data line as JSON');
|
|
1027
|
+
require$$9.debugDir('error', {
|
|
1026
1028
|
error: e,
|
|
1027
1029
|
line
|
|
1028
1030
|
});
|
|
@@ -1054,14 +1056,14 @@ async function fetchScanData(orgSlug, scanId, options) {
|
|
|
1054
1056
|
return {
|
|
1055
1057
|
ok: false,
|
|
1056
1058
|
message: 'Socket API error',
|
|
1057
|
-
cause:
|
|
1059
|
+
cause: utils.formatErrorWithDetail('Error requesting scan', e) || 'Error requesting scan: (no error message found)'
|
|
1058
1060
|
};
|
|
1059
1061
|
}), fetchSecurityPolicy().catch(e => {
|
|
1060
1062
|
updatePolicy('failure; unknown blocking error occurred');
|
|
1061
1063
|
return {
|
|
1062
1064
|
ok: false,
|
|
1063
1065
|
message: 'Socket API error',
|
|
1064
|
-
cause:
|
|
1066
|
+
cause: utils.formatErrorWithDetail('Error requesting policy', e) || 'Error requesting policy: (no error message found)'
|
|
1065
1067
|
};
|
|
1066
1068
|
})]).finally(() => {
|
|
1067
1069
|
finishedFetching = true;
|
|
@@ -2154,10 +2156,29 @@ async function handleCreateNewScan({
|
|
|
2154
2156
|
targets,
|
|
2155
2157
|
tmp
|
|
2156
2158
|
}) {
|
|
2159
|
+
require$$9.debugFn('notice', `Creating new scan for ${orgSlug}/${repoName}`);
|
|
2160
|
+
require$$9.debugDir('inspect', {
|
|
2161
|
+
autoManifest,
|
|
2162
|
+
branchName,
|
|
2163
|
+
commitHash,
|
|
2164
|
+
defaultBranch,
|
|
2165
|
+
interactive,
|
|
2166
|
+
pendingHead,
|
|
2167
|
+
pullRequest,
|
|
2168
|
+
readOnly,
|
|
2169
|
+
report,
|
|
2170
|
+
reportLevel,
|
|
2171
|
+
targets,
|
|
2172
|
+
tmp
|
|
2173
|
+
});
|
|
2157
2174
|
if (autoManifest) {
|
|
2158
2175
|
logger.logger.info('Auto-generating manifest files ...');
|
|
2176
|
+
require$$9.debugFn('notice', 'Auto-manifest mode enabled');
|
|
2159
2177
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
2160
2178
|
const detected = await detectManifestActions(sockJson, cwd);
|
|
2179
|
+
require$$9.debugDir('inspect', {
|
|
2180
|
+
detected
|
|
2181
|
+
});
|
|
2161
2182
|
await generateAutoManifest({
|
|
2162
2183
|
detected,
|
|
2163
2184
|
cwd,
|
|
@@ -2173,12 +2194,17 @@ async function handleCreateNewScan({
|
|
|
2173
2194
|
spinner
|
|
2174
2195
|
});
|
|
2175
2196
|
if (!supportedFilesCResult.ok) {
|
|
2197
|
+
require$$9.debugFn('warn', 'Failed to fetch supported scan file names');
|
|
2198
|
+
require$$9.debugDir('inspect', {
|
|
2199
|
+
supportedFilesCResult
|
|
2200
|
+
});
|
|
2176
2201
|
await outputCreateNewScan(supportedFilesCResult, {
|
|
2177
2202
|
interactive,
|
|
2178
2203
|
outputKind
|
|
2179
2204
|
});
|
|
2180
2205
|
return;
|
|
2181
2206
|
}
|
|
2207
|
+
require$$9.debugFn('notice', `Fetched ${supportedFilesCResult.data['size']} supported file types`);
|
|
2182
2208
|
spinner.start('Searching for local files to include in scan...');
|
|
2183
2209
|
const supportedFiles = supportedFilesCResult.data;
|
|
2184
2210
|
const packagePaths = await utils.getPackageFilesForScan(targets, supportedFiles, {
|
|
@@ -2188,10 +2214,11 @@ async function handleCreateNewScan({
|
|
|
2188
2214
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
2189
2215
|
nook: true,
|
|
2190
2216
|
test: packagePaths.length > 0,
|
|
2191
|
-
fail: `found no eligible files to scan. See supported manifest files at ${
|
|
2217
|
+
fail: `found no eligible files to scan. See supported manifest files at ${utils.socketDocsLink('/docs/manifest-file-detection-in-socket', 'docs.socket.dev')}`,
|
|
2192
2218
|
message: 'TARGET (file/dir) must contain matching / supported file types for a scan'
|
|
2193
2219
|
});
|
|
2194
2220
|
if (!wasValidInput) {
|
|
2221
|
+
require$$9.debugFn('warn', 'No eligible files found to scan');
|
|
2195
2222
|
return;
|
|
2196
2223
|
}
|
|
2197
2224
|
logger.logger.success(`Found ${packagePaths.length} local ${words.pluralize('file', packagePaths.length)}`);
|
|
@@ -2200,6 +2227,7 @@ async function handleCreateNewScan({
|
|
|
2200
2227
|
});
|
|
2201
2228
|
if (readOnly) {
|
|
2202
2229
|
logger.logger.log('[ReadOnly] Bailing now');
|
|
2230
|
+
require$$9.debugFn('notice', 'Read-only mode, exiting early');
|
|
2203
2231
|
return;
|
|
2204
2232
|
}
|
|
2205
2233
|
let scanPaths = packagePaths;
|
|
@@ -2209,6 +2237,10 @@ async function handleCreateNewScan({
|
|
|
2209
2237
|
if (reach.runReachabilityAnalysis) {
|
|
2210
2238
|
logger.logger.error('');
|
|
2211
2239
|
logger.logger.info('Starting reachability analysis...');
|
|
2240
|
+
require$$9.debugFn('notice', 'Reachability analysis enabled');
|
|
2241
|
+
require$$9.debugDir('inspect', {
|
|
2242
|
+
reachabilityOptions: reach
|
|
2243
|
+
});
|
|
2212
2244
|
spinner.start();
|
|
2213
2245
|
const reachResult = await performReachabilityAnalysis({
|
|
2214
2246
|
branchName,
|
|
@@ -2285,8 +2317,16 @@ async function handleCreateNewScan({
|
|
|
2285
2317
|
}
|
|
2286
2318
|
|
|
2287
2319
|
async function handleCi(autoManifest) {
|
|
2320
|
+
require$$9.debugFn('notice', 'Starting CI scan');
|
|
2321
|
+
require$$9.debugDir('inspect', {
|
|
2322
|
+
autoManifest
|
|
2323
|
+
});
|
|
2288
2324
|
const orgSlugCResult = await utils.getDefaultOrgSlug();
|
|
2289
2325
|
if (!orgSlugCResult.ok) {
|
|
2326
|
+
require$$9.debugFn('warn', 'Failed to get default org slug');
|
|
2327
|
+
require$$9.debugDir('inspect', {
|
|
2328
|
+
orgSlugCResult
|
|
2329
|
+
});
|
|
2290
2330
|
process.exitCode = orgSlugCResult.code ?? 1;
|
|
2291
2331
|
// Always assume json mode.
|
|
2292
2332
|
logger.logger.log(utils.serializeResultJson(orgSlugCResult));
|
|
@@ -2296,6 +2336,13 @@ async function handleCi(autoManifest) {
|
|
|
2296
2336
|
const cwd = process.cwd();
|
|
2297
2337
|
const branchName = (await utils.gitBranch(cwd)) || (await utils.detectDefaultBranch(cwd));
|
|
2298
2338
|
const repoName = await utils.getRepoName(cwd);
|
|
2339
|
+
require$$9.debugFn('notice', `CI scan for ${orgSlug}/${repoName} on branch ${branchName}`);
|
|
2340
|
+
require$$9.debugDir('inspect', {
|
|
2341
|
+
orgSlug,
|
|
2342
|
+
cwd,
|
|
2343
|
+
branchName,
|
|
2344
|
+
repoName
|
|
2345
|
+
});
|
|
2299
2346
|
await handleCreateNewScan({
|
|
2300
2347
|
autoManifest,
|
|
2301
2348
|
branchName,
|
|
@@ -2669,7 +2716,7 @@ ${utils.getSupportedConfigEntries().map(({
|
|
|
2669
2716
|
}, {
|
|
2670
2717
|
nook: true,
|
|
2671
2718
|
test: !json || !markdown,
|
|
2672
|
-
message:
|
|
2719
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
2673
2720
|
fail: 'bad'
|
|
2674
2721
|
});
|
|
2675
2722
|
if (!wasValidInput) {
|
|
@@ -2780,7 +2827,7 @@ async function run$O(argv, importMeta, {
|
|
|
2780
2827
|
}, {
|
|
2781
2828
|
nook: true,
|
|
2782
2829
|
test: !json || !markdown,
|
|
2783
|
-
message:
|
|
2830
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
2784
2831
|
fail: 'bad'
|
|
2785
2832
|
});
|
|
2786
2833
|
if (!wasValidInput) {
|
|
@@ -2912,7 +2959,7 @@ async function run$N(argv, importMeta, {
|
|
|
2912
2959
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
2913
2960
|
nook: true,
|
|
2914
2961
|
test: !json || !markdown,
|
|
2915
|
-
message:
|
|
2962
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
2916
2963
|
fail: 'bad'
|
|
2917
2964
|
});
|
|
2918
2965
|
if (!wasValidInput) {
|
|
@@ -2963,7 +3010,17 @@ async function handleConfigSet({
|
|
|
2963
3010
|
outputKind,
|
|
2964
3011
|
value
|
|
2965
3012
|
}) {
|
|
3013
|
+
require$$9.debugFn('notice', `Setting config ${key} = ${value}`);
|
|
3014
|
+
require$$9.debugDir('inspect', {
|
|
3015
|
+
key,
|
|
3016
|
+
value,
|
|
3017
|
+
outputKind
|
|
3018
|
+
});
|
|
2966
3019
|
const result = utils.updateConfigValue(key, value);
|
|
3020
|
+
require$$9.debugFn('notice', `Config update ${result.ok ? 'succeeded' : 'failed'}`);
|
|
3021
|
+
require$$9.debugDir('inspect', {
|
|
3022
|
+
result
|
|
3023
|
+
});
|
|
2967
3024
|
await outputConfigSet(result, outputKind);
|
|
2968
3025
|
}
|
|
2969
3026
|
|
|
@@ -3039,7 +3096,7 @@ ${utils.getSupportedConfigEntries().map(({
|
|
|
3039
3096
|
}, {
|
|
3040
3097
|
nook: true,
|
|
3041
3098
|
test: !json || !markdown,
|
|
3042
|
-
message:
|
|
3099
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
3043
3100
|
fail: 'bad'
|
|
3044
3101
|
});
|
|
3045
3102
|
if (!wasValidInput) {
|
|
@@ -3154,7 +3211,7 @@ ${utils.getSupportedConfigEntries().map(({
|
|
|
3154
3211
|
}, {
|
|
3155
3212
|
nook: true,
|
|
3156
3213
|
test: !json || !markdown,
|
|
3157
|
-
message:
|
|
3214
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
3158
3215
|
fail: 'bad'
|
|
3159
3216
|
});
|
|
3160
3217
|
if (!wasValidInput) {
|
|
@@ -3369,9 +3426,7 @@ async function getSocketFixPrsWithContext(owner, repo, options) {
|
|
|
3369
3426
|
}
|
|
3370
3427
|
} catch (e) {
|
|
3371
3428
|
require$$9.debugFn('error', `GraphQL pagination failed for ${owner}/${repo}`);
|
|
3372
|
-
require$$9.debugDir('
|
|
3373
|
-
error: e
|
|
3374
|
-
});
|
|
3429
|
+
require$$9.debugDir('error', e);
|
|
3375
3430
|
}
|
|
3376
3431
|
return contextualMatches;
|
|
3377
3432
|
}
|
|
@@ -3588,9 +3643,7 @@ async function coanaFix(fixConfig) {
|
|
|
3588
3643
|
}
|
|
3589
3644
|
} catch (e) {
|
|
3590
3645
|
require$$9.debugFn('warn', 'Failed to count open PRs, using original limit');
|
|
3591
|
-
require$$9.debugDir('
|
|
3592
|
-
error: e
|
|
3593
|
-
});
|
|
3646
|
+
require$$9.debugDir('error', e);
|
|
3594
3647
|
}
|
|
3595
3648
|
}
|
|
3596
3649
|
const shouldSpawnCoana = adjustedLimit > 0;
|
|
@@ -3644,7 +3697,7 @@ async function coanaFix(fixConfig) {
|
|
|
3644
3697
|
stdio: 'inherit'
|
|
3645
3698
|
});
|
|
3646
3699
|
if (!fixCResult.ok) {
|
|
3647
|
-
logger.logger.error(`Update failed for ${ghsaId}: ${fixCResult
|
|
3700
|
+
logger.logger.error(`Update failed for ${ghsaId}: ${utils.getErrorCause(fixCResult)}`);
|
|
3648
3701
|
continue ghsaLoop;
|
|
3649
3702
|
}
|
|
3650
3703
|
|
|
@@ -3746,9 +3799,7 @@ async function coanaFix(fixConfig) {
|
|
|
3746
3799
|
await utils.gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
3747
3800
|
} catch (e) {
|
|
3748
3801
|
logger.logger.warn(`Unexpected condition: Push failed for ${ghsaId}, skipping PR creation.`);
|
|
3749
|
-
require$$9.debugDir('
|
|
3750
|
-
error: e
|
|
3751
|
-
});
|
|
3802
|
+
require$$9.debugDir('error', e);
|
|
3752
3803
|
// eslint-disable-next-line no-await-in-loop
|
|
3753
3804
|
await utils.gitResetAndClean(fixEnv.baseBranch, cwd);
|
|
3754
3805
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -3792,6 +3843,10 @@ const CVE_FORMAT_REGEXP = /^CVE-\d{4}-\d{4,}$/;
|
|
|
3792
3843
|
* Filters out invalid IDs and logs conversion results.
|
|
3793
3844
|
*/
|
|
3794
3845
|
async function convertIdsToGhsas(ids) {
|
|
3846
|
+
require$$9.debugFn('notice', `Converting ${ids.length} IDs to GHSA format`);
|
|
3847
|
+
require$$9.debugDir('inspect', {
|
|
3848
|
+
ids
|
|
3849
|
+
});
|
|
3795
3850
|
const validGhsas = [];
|
|
3796
3851
|
const errors = [];
|
|
3797
3852
|
for (const id of ids) {
|
|
@@ -3835,7 +3890,14 @@ async function convertIdsToGhsas(ids) {
|
|
|
3835
3890
|
}
|
|
3836
3891
|
if (errors.length) {
|
|
3837
3892
|
logger.logger.warn(`Skipped ${errors.length} invalid IDs:\n${errors.map(e => ` - ${e}`).join('\n')}`);
|
|
3893
|
+
require$$9.debugDir('inspect', {
|
|
3894
|
+
errors
|
|
3895
|
+
});
|
|
3838
3896
|
}
|
|
3897
|
+
require$$9.debugFn('notice', `Converted to ${validGhsas.length} valid GHSA IDs`);
|
|
3898
|
+
require$$9.debugDir('inspect', {
|
|
3899
|
+
validGhsas
|
|
3900
|
+
});
|
|
3839
3901
|
return validGhsas;
|
|
3840
3902
|
}
|
|
3841
3903
|
async function handleFix({
|
|
@@ -3854,6 +3916,21 @@ async function handleFix({
|
|
|
3854
3916
|
spinner,
|
|
3855
3917
|
unknownFlags
|
|
3856
3918
|
}) {
|
|
3919
|
+
require$$9.debugFn('notice', `Starting fix command for ${orgSlug}`);
|
|
3920
|
+
require$$9.debugDir('inspect', {
|
|
3921
|
+
autopilot,
|
|
3922
|
+
cwd,
|
|
3923
|
+
ghsas,
|
|
3924
|
+
glob,
|
|
3925
|
+
limit,
|
|
3926
|
+
minSatisfying,
|
|
3927
|
+
onlyCompute,
|
|
3928
|
+
outputFile,
|
|
3929
|
+
outputKind,
|
|
3930
|
+
prCheck,
|
|
3931
|
+
rangeStyle,
|
|
3932
|
+
unknownFlags
|
|
3933
|
+
});
|
|
3857
3934
|
await outputFixResult(await coanaFix({
|
|
3858
3935
|
autopilot,
|
|
3859
3936
|
cwd,
|
|
@@ -3933,7 +4010,7 @@ const hiddenFlags = {
|
|
|
3933
4010
|
glob: {
|
|
3934
4011
|
type: 'string',
|
|
3935
4012
|
default: '',
|
|
3936
|
-
description: 'Glob pattern to
|
|
4013
|
+
description: 'Glob pattern to filter workspaces by',
|
|
3937
4014
|
hidden: true
|
|
3938
4015
|
},
|
|
3939
4016
|
maxSatisfying: {
|
|
@@ -4006,7 +4083,7 @@ async function run$K(argv, importMeta, {
|
|
|
4006
4083
|
|
|
4007
4084
|
Examples
|
|
4008
4085
|
$ ${command}
|
|
4009
|
-
$ ${command}
|
|
4086
|
+
$ ${command} ${constants.FLAG_ID} CVE-2021-23337
|
|
4010
4087
|
$ ${command} ./path/to/project --range-style pin
|
|
4011
4088
|
`
|
|
4012
4089
|
};
|
|
@@ -4350,7 +4427,7 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
|
|
|
4350
4427
|
apiBaseUrl ??= utils.getConfigValueOrUndef(constants.CONFIG_KEY_API_BASE_URL) ?? undefined;
|
|
4351
4428
|
apiProxy ??= utils.getConfigValueOrUndef(constants.CONFIG_KEY_API_PROXY) ?? undefined;
|
|
4352
4429
|
const apiTokenInput = await prompts.password({
|
|
4353
|
-
message: `Enter your ${
|
|
4430
|
+
message: `Enter your ${utils.socketDocsLink('/docs/api-keys', 'Socket.dev API token')} (leave blank to use a limited public token)`
|
|
4354
4431
|
});
|
|
4355
4432
|
if (apiTokenInput === undefined) {
|
|
4356
4433
|
logger.logger.fail('Canceled by user');
|
|
@@ -4608,7 +4685,7 @@ const {
|
|
|
4608
4685
|
YARN_LOCK
|
|
4609
4686
|
} = constants.default;
|
|
4610
4687
|
const nodejsPlatformTypes = new Set(['javascript', 'js', 'nodejs', constants.NPM, constants.PNPM, 'ts', 'tsx', 'typescript']);
|
|
4611
|
-
function
|
|
4688
|
+
function argvObjectToArray(argvObj) {
|
|
4612
4689
|
if (argvObj['help']) {
|
|
4613
4690
|
return [constants.FLAG_HELP];
|
|
4614
4691
|
}
|
|
@@ -4656,7 +4733,7 @@ async function runCdxgen(argvObj) {
|
|
|
4656
4733
|
stdio: 'inherit'
|
|
4657
4734
|
};
|
|
4658
4735
|
|
|
4659
|
-
// Detect package manager based on lockfiles
|
|
4736
|
+
// Detect package manager based on lockfiles.
|
|
4660
4737
|
const pnpmLockPath = await utils.findUp(PNPM_LOCK_YAML, {
|
|
4661
4738
|
onlyFiles: true
|
|
4662
4739
|
});
|
|
@@ -4668,7 +4745,7 @@ async function runCdxgen(argvObj) {
|
|
|
4668
4745
|
});
|
|
4669
4746
|
const agent = pnpmLockPath ? constants.PNPM : yarnLockPath && utils.isYarnBerry() ? constants.YARN : constants.NPM;
|
|
4670
4747
|
let cleanupPackageLock = false;
|
|
4671
|
-
if (argvMutable['type'] !== constants.YARN && nodejsPlatformTypes.has(argvMutable['type'])
|
|
4748
|
+
if (yarnLockPath && argvMutable['type'] !== constants.YARN && nodejsPlatformTypes.has(argvMutable['type'])) {
|
|
4672
4749
|
if (npmLockPath) {
|
|
4673
4750
|
argvMutable['type'] = constants.NPM;
|
|
4674
4751
|
} else {
|
|
@@ -4686,8 +4763,8 @@ async function runCdxgen(argvObj) {
|
|
|
4686
4763
|
}
|
|
4687
4764
|
}
|
|
4688
4765
|
|
|
4689
|
-
// Use appropriate package manager for cdxgen
|
|
4690
|
-
const shadowResult = await utils.spawnCdxgenDlx(
|
|
4766
|
+
// Use appropriate package manager for cdxgen.
|
|
4767
|
+
const shadowResult = await utils.spawnCdxgenDlx(argvObjectToArray(argvMutable), {
|
|
4691
4768
|
...shadowOpts,
|
|
4692
4769
|
agent
|
|
4693
4770
|
});
|
|
@@ -5230,7 +5307,7 @@ async function run$D(argv, importMeta, {
|
|
|
5230
5307
|
}, {
|
|
5231
5308
|
nook: true,
|
|
5232
5309
|
test: !json || !markdown,
|
|
5233
|
-
message:
|
|
5310
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
5234
5311
|
fail: 'bad'
|
|
5235
5312
|
});
|
|
5236
5313
|
if (!wasValidInput) {
|
|
@@ -6279,10 +6356,10 @@ async function run$x(argv, importMeta, context) {
|
|
|
6279
6356
|
API Token Requirements
|
|
6280
6357
|
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$r}`)}
|
|
6281
6358
|
|
|
6282
|
-
Note: Everything after "
|
|
6283
|
-
Only the
|
|
6359
|
+
Note: Everything after "${constants.NPM}" is passed to the ${constants.NPM} command.
|
|
6360
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
6284
6361
|
|
|
6285
|
-
Use \`socket wrapper on\` to alias this command as
|
|
6362
|
+
Use \`socket wrapper on\` to alias this command as \`${constants.NPM}\`.
|
|
6286
6363
|
|
|
6287
6364
|
Examples
|
|
6288
6365
|
$ ${command}
|
|
@@ -6301,7 +6378,7 @@ async function run$x(argv, importMeta, context) {
|
|
|
6301
6378
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
6302
6379
|
return;
|
|
6303
6380
|
}
|
|
6304
|
-
const
|
|
6381
|
+
const shadowNpmBin = /*@__PURE__*/require$5(constants.default.shadowNpmBinPath);
|
|
6305
6382
|
process.exitCode = 1;
|
|
6306
6383
|
|
|
6307
6384
|
// Filter Socket flags from argv but keep --json for npm.
|
|
@@ -6311,7 +6388,7 @@ async function run$x(argv, importMeta, context) {
|
|
|
6311
6388
|
}, [constants.FLAG_JSON]);
|
|
6312
6389
|
const {
|
|
6313
6390
|
spawnPromise
|
|
6314
|
-
} = await
|
|
6391
|
+
} = await shadowNpmBin(argsToForward, {
|
|
6315
6392
|
stdio: 'inherit'
|
|
6316
6393
|
});
|
|
6317
6394
|
|
|
@@ -6353,10 +6430,10 @@ async function run$w(argv, importMeta, {
|
|
|
6353
6430
|
API Token Requirements
|
|
6354
6431
|
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$q}`)}
|
|
6355
6432
|
|
|
6356
|
-
Note: Everything after "
|
|
6357
|
-
Only the
|
|
6433
|
+
Note: Everything after "${constants.NPX}" is passed to the ${constants.NPX} command.
|
|
6434
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
6358
6435
|
|
|
6359
|
-
Use \`socket wrapper on\` to alias this command as
|
|
6436
|
+
Use \`socket wrapper on\` to alias this command as \`${constants.NPX}\`.
|
|
6360
6437
|
|
|
6361
6438
|
Examples
|
|
6362
6439
|
$ ${command} cowsay
|
|
@@ -6374,11 +6451,11 @@ async function run$w(argv, importMeta, {
|
|
|
6374
6451
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
6375
6452
|
return;
|
|
6376
6453
|
}
|
|
6377
|
-
const
|
|
6454
|
+
const shadowNpxBin = /*@__PURE__*/require$4(constants.default.shadowNpxBinPath);
|
|
6378
6455
|
process.exitCode = 1;
|
|
6379
6456
|
const {
|
|
6380
6457
|
spawnPromise
|
|
6381
|
-
} = await
|
|
6458
|
+
} = await shadowNpxBin(argv, {
|
|
6382
6459
|
stdio: 'inherit'
|
|
6383
6460
|
});
|
|
6384
6461
|
|
|
@@ -6708,6 +6785,9 @@ async function npmQuery(npmExecPath, cwd) {
|
|
|
6708
6785
|
try {
|
|
6709
6786
|
stdout = (await spawn.spawn(npmExecPath, ['query', ':not(.dev)'], {
|
|
6710
6787
|
cwd,
|
|
6788
|
+
// On Windows, npm is often a .cmd file that requires shell execution.
|
|
6789
|
+
// The spawn function from @socketsecurity/registry will handle this properly
|
|
6790
|
+
// when shell is true.
|
|
6711
6791
|
shell: constants.default.WIN32
|
|
6712
6792
|
})).stdout;
|
|
6713
6793
|
} catch {}
|
|
@@ -6725,6 +6805,9 @@ async function lsBun(pkgEnvDetails, options) {
|
|
|
6725
6805
|
// https://github.com/oven-sh/bun/issues/8283
|
|
6726
6806
|
return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['pm', 'ls', '--all'], {
|
|
6727
6807
|
cwd,
|
|
6808
|
+
// On Windows, bun is often a .cmd file that requires shell execution.
|
|
6809
|
+
// The spawn function from @socketsecurity/registry will handle this properly
|
|
6810
|
+
// when shell is true.
|
|
6728
6811
|
shell: constants.default.WIN32
|
|
6729
6812
|
})).stdout;
|
|
6730
6813
|
} catch {}
|
|
@@ -6760,6 +6843,9 @@ async function lsPnpm(pkgEnvDetails, options) {
|
|
|
6760
6843
|
// https://en.wiktionary.org/wiki/parsable
|
|
6761
6844
|
['ls', '--parseable', constants.FLAG_PROD, '--depth', 'Infinity'], {
|
|
6762
6845
|
cwd,
|
|
6846
|
+
// On Windows, pnpm is often a .cmd file that requires shell execution.
|
|
6847
|
+
// The spawn function from @socketsecurity/registry will handle this properly
|
|
6848
|
+
// when shell is true.
|
|
6763
6849
|
shell: constants.default.WIN32
|
|
6764
6850
|
})).stdout;
|
|
6765
6851
|
} catch {}
|
|
@@ -6777,6 +6863,9 @@ async function lsVlt(pkgEnvDetails, options) {
|
|
|
6777
6863
|
// See https://docs.vlt.sh/cli/commands/list#options.
|
|
6778
6864
|
stdout = (await spawn.spawn(pkgEnvDetails.agentExecPath, ['ls', '--view', 'human', ':not(.dev)'], {
|
|
6779
6865
|
cwd,
|
|
6866
|
+
// On Windows, pnpm is often a .cmd file that requires shell execution.
|
|
6867
|
+
// The spawn function from @socketsecurity/registry will handle this properly
|
|
6868
|
+
// when shell is true.
|
|
6780
6869
|
shell: constants.default.WIN32
|
|
6781
6870
|
})).stdout;
|
|
6782
6871
|
} catch {}
|
|
@@ -6794,6 +6883,9 @@ async function lsYarnBerry(pkgEnvDetails, options) {
|
|
|
6794
6883
|
// https://github.com/yarnpkg/berry/issues/5117
|
|
6795
6884
|
return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['info', '--recursive', '--name-only'], {
|
|
6796
6885
|
cwd,
|
|
6886
|
+
// On Windows, yarn is often a .cmd file that requires shell execution.
|
|
6887
|
+
// The spawn function from @socketsecurity/registry will handle this properly
|
|
6888
|
+
// when shell is true.
|
|
6797
6889
|
shell: constants.default.WIN32
|
|
6798
6890
|
})).stdout;
|
|
6799
6891
|
} catch {}
|
|
@@ -6813,6 +6905,9 @@ async function lsYarnClassic(pkgEnvDetails, options) {
|
|
|
6813
6905
|
// environment is production
|
|
6814
6906
|
return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['list', constants.FLAG_PROD], {
|
|
6815
6907
|
cwd,
|
|
6908
|
+
// On Windows, yarn is often a .cmd file that requires shell execution.
|
|
6909
|
+
// The spawn function from @socketsecurity/registry will handle this properly
|
|
6910
|
+
// when shell is true.
|
|
6816
6911
|
shell: constants.default.WIN32
|
|
6817
6912
|
})).stdout;
|
|
6818
6913
|
} catch {}
|
|
@@ -7056,9 +7151,9 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
7056
7151
|
if (
|
|
7057
7152
|
// ...if the spec doesn't start with a valid Socket override.
|
|
7058
7153
|
!(thisSpec.startsWith(sockOverridePrefix) &&
|
|
7059
|
-
// Check the validity of the spec by
|
|
7060
|
-
// seeing if it will coerce to a version.
|
|
7061
|
-
vendor.semverExports.coerce(utils.
|
|
7154
|
+
// Check the validity of the spec by parsing it with npm-package-arg
|
|
7155
|
+
// and seeing if it will coerce to a version.
|
|
7156
|
+
vendor.semverExports.coerce(utils.safeNpa(thisSpec).subSpec.rawSpec)?.version)) {
|
|
7062
7157
|
thisSpec = sockOverrideSpec;
|
|
7063
7158
|
depObj[origPkgName] = thisSpec;
|
|
7064
7159
|
state.added.add(sockRegPkgName);
|
|
@@ -7107,12 +7202,12 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
7107
7202
|
const thisSpec = oldSpec.startsWith('$') ? depAlias || newSpec : oldSpec || newSpec;
|
|
7108
7203
|
if (thisSpec.startsWith(sockOverridePrefix)) {
|
|
7109
7204
|
if (pin && utils.getMajor(
|
|
7110
|
-
// Check the validity of the spec by
|
|
7205
|
+
// Check the validity of the spec by parsing it with npm-package-arg
|
|
7111
7206
|
// and seeing if it will coerce to a version. semver.coerce
|
|
7112
7207
|
// will strip leading v's, carets (^), comparators (<,<=,>,>=,=),
|
|
7113
7208
|
// and tildes (~). If not coerced to a valid version then
|
|
7114
7209
|
// default to the manifest entry version.
|
|
7115
|
-
vendor.semverExports.coerce(utils.
|
|
7210
|
+
vendor.semverExports.coerce(utils.safeNpa(thisSpec).subSpec.rawSpec)?.version ?? version) !== major) {
|
|
7116
7211
|
const otherVersion = (await packages.fetchPackageManifest(thisSpec))?.version;
|
|
7117
7212
|
if (otherVersion && otherVersion !== version) {
|
|
7118
7213
|
newSpec = `${sockOverridePrefix}${pin ? otherVersion : `^${utils.getMajor(otherVersion)}`}`;
|
|
@@ -7196,10 +7291,8 @@ async function updateLockfile(pkgEnvDetails, options) {
|
|
|
7196
7291
|
}
|
|
7197
7292
|
} catch (e) {
|
|
7198
7293
|
spinner?.stop();
|
|
7199
|
-
require$$9.debugFn('error', '
|
|
7200
|
-
require$$9.debugDir('
|
|
7201
|
-
error: e
|
|
7202
|
-
});
|
|
7294
|
+
require$$9.debugFn('error', 'Lockfile update failed');
|
|
7295
|
+
require$$9.debugDir('error', e);
|
|
7203
7296
|
if (wasSpinning) {
|
|
7204
7297
|
spinner.start();
|
|
7205
7298
|
}
|
|
@@ -7299,17 +7392,29 @@ async function handleOptimize({
|
|
|
7299
7392
|
pin,
|
|
7300
7393
|
prod
|
|
7301
7394
|
}) {
|
|
7395
|
+
require$$9.debugFn('notice', `Starting optimization for ${cwd}`);
|
|
7396
|
+
require$$9.debugDir('inspect', {
|
|
7397
|
+
cwd,
|
|
7398
|
+
outputKind,
|
|
7399
|
+
pin,
|
|
7400
|
+
prod
|
|
7401
|
+
});
|
|
7302
7402
|
const pkgEnvCResult = await utils.detectAndValidatePackageEnvironment(cwd, {
|
|
7303
7403
|
cmdName: CMD_NAME$p,
|
|
7304
7404
|
logger: logger.logger,
|
|
7305
7405
|
prod
|
|
7306
7406
|
});
|
|
7307
7407
|
if (!pkgEnvCResult.ok) {
|
|
7408
|
+
require$$9.debugFn('warn', 'Package environment validation failed');
|
|
7409
|
+
require$$9.debugDir('inspect', {
|
|
7410
|
+
pkgEnvCResult
|
|
7411
|
+
});
|
|
7308
7412
|
await outputOptimizeResult(pkgEnvCResult, outputKind);
|
|
7309
7413
|
return;
|
|
7310
7414
|
}
|
|
7311
7415
|
const pkgEnvDetails = pkgEnvCResult.data;
|
|
7312
7416
|
if (!pkgEnvDetails) {
|
|
7417
|
+
require$$9.debugFn('warn', 'No package environment details found');
|
|
7313
7418
|
await outputOptimizeResult({
|
|
7314
7419
|
ok: false,
|
|
7315
7420
|
message: 'No package found.',
|
|
@@ -7317,11 +7422,16 @@ async function handleOptimize({
|
|
|
7317
7422
|
}, outputKind);
|
|
7318
7423
|
return;
|
|
7319
7424
|
}
|
|
7425
|
+
require$$9.debugFn('notice', `Detected package manager: ${pkgEnvDetails.agent} v${pkgEnvDetails.agentVersion}`);
|
|
7426
|
+
require$$9.debugDir('inspect', {
|
|
7427
|
+
pkgEnvDetails
|
|
7428
|
+
});
|
|
7320
7429
|
const {
|
|
7321
7430
|
agent,
|
|
7322
7431
|
agentVersion
|
|
7323
7432
|
} = pkgEnvDetails;
|
|
7324
7433
|
if (agent === VLT) {
|
|
7434
|
+
require$$9.debugFn('warn', `${agent} does not support overrides`);
|
|
7325
7435
|
await outputOptimizeResult({
|
|
7326
7436
|
ok: false,
|
|
7327
7437
|
message: 'Unsupported',
|
|
@@ -7330,10 +7440,16 @@ async function handleOptimize({
|
|
|
7330
7440
|
return;
|
|
7331
7441
|
}
|
|
7332
7442
|
logger.logger.info(`Optimizing packages for ${agent} v${agentVersion}.\n`);
|
|
7333
|
-
|
|
7443
|
+
require$$9.debugFn('notice', 'Applying optimization');
|
|
7444
|
+
const optimizationResult = await applyOptimization(pkgEnvDetails, {
|
|
7334
7445
|
pin,
|
|
7335
7446
|
prod
|
|
7336
|
-
})
|
|
7447
|
+
});
|
|
7448
|
+
require$$9.debugFn('notice', `Optimization ${optimizationResult.ok ? 'succeeded' : 'failed'}`);
|
|
7449
|
+
require$$9.debugDir('inspect', {
|
|
7450
|
+
optimizationResult
|
|
7451
|
+
});
|
|
7452
|
+
await outputOptimizeResult(optimizationResult, outputKind);
|
|
7337
7453
|
}
|
|
7338
7454
|
|
|
7339
7455
|
const CMD_NAME$o = 'optimize';
|
|
@@ -7501,10 +7617,20 @@ async function handleDependencies({
|
|
|
7501
7617
|
offset,
|
|
7502
7618
|
outputKind
|
|
7503
7619
|
}) {
|
|
7620
|
+
require$$9.debugFn('notice', `Fetching dependencies with limit=${limit}, offset=${offset}`);
|
|
7621
|
+
require$$9.debugDir('inspect', {
|
|
7622
|
+
limit,
|
|
7623
|
+
offset,
|
|
7624
|
+
outputKind
|
|
7625
|
+
});
|
|
7504
7626
|
const result = await fetchDependencies({
|
|
7505
7627
|
limit,
|
|
7506
7628
|
offset
|
|
7507
7629
|
});
|
|
7630
|
+
require$$9.debugFn('notice', `Dependencies ${result.ok ? 'fetched successfully' : 'fetch failed'}`);
|
|
7631
|
+
require$$9.debugDir('inspect', {
|
|
7632
|
+
result
|
|
7633
|
+
});
|
|
7508
7634
|
await outputDependencies(result, {
|
|
7509
7635
|
limit,
|
|
7510
7636
|
offset,
|
|
@@ -7574,7 +7700,7 @@ async function run$t(argv, importMeta, {
|
|
|
7574
7700
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
7575
7701
|
nook: true,
|
|
7576
7702
|
test: !json || !markdown,
|
|
7577
|
-
message:
|
|
7703
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
7578
7704
|
fail: 'bad'
|
|
7579
7705
|
}, {
|
|
7580
7706
|
nook: true,
|
|
@@ -7915,7 +8041,15 @@ async function outputOrganizationList(orgsCResult, outputKind = 'text') {
|
|
|
7915
8041
|
}
|
|
7916
8042
|
|
|
7917
8043
|
async function handleOrganizationList(outputKind = 'text') {
|
|
8044
|
+
require$$9.debugFn('notice', 'Fetching organization list');
|
|
8045
|
+
require$$9.debugDir('inspect', {
|
|
8046
|
+
outputKind
|
|
8047
|
+
});
|
|
7918
8048
|
const data = await utils.fetchOrganization();
|
|
8049
|
+
require$$9.debugFn('notice', `Organization list ${data.ok ? 'fetched successfully' : 'fetch failed'}`);
|
|
8050
|
+
require$$9.debugDir('inspect', {
|
|
8051
|
+
data
|
|
8052
|
+
});
|
|
7919
8053
|
await outputOrganizationList(data, outputKind);
|
|
7920
8054
|
}
|
|
7921
8055
|
|
|
@@ -7969,7 +8103,7 @@ async function run$q(argv, importMeta, {
|
|
|
7969
8103
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
7970
8104
|
nook: true,
|
|
7971
8105
|
test: !json || !markdown,
|
|
7972
|
-
message:
|
|
8106
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
7973
8107
|
fail: 'bad'
|
|
7974
8108
|
}, {
|
|
7975
8109
|
nook: true,
|
|
@@ -8319,7 +8453,16 @@ function createMarkdownReport(data) {
|
|
|
8319
8453
|
}
|
|
8320
8454
|
|
|
8321
8455
|
async function handlePurlDeepScore(purl, outputKind) {
|
|
8456
|
+
require$$9.debugFn('notice', `Fetching deep score for ${purl}`);
|
|
8457
|
+
require$$9.debugDir('inspect', {
|
|
8458
|
+
purl,
|
|
8459
|
+
outputKind
|
|
8460
|
+
});
|
|
8322
8461
|
const result = await fetchPurlDeepScore(purl);
|
|
8462
|
+
require$$9.debugFn('notice', `Deep score ${result.ok ? 'fetched successfully' : 'fetch failed'}`);
|
|
8463
|
+
require$$9.debugDir('inspect', {
|
|
8464
|
+
result
|
|
8465
|
+
});
|
|
8323
8466
|
await outputPurlsDeepScore(purl, result, outputKind);
|
|
8324
8467
|
}
|
|
8325
8468
|
|
|
@@ -8751,7 +8894,16 @@ async function handlePurlsShallowScore({
|
|
|
8751
8894
|
outputKind,
|
|
8752
8895
|
purls
|
|
8753
8896
|
}) {
|
|
8897
|
+
require$$9.debugFn('notice', `Fetching shallow scores for ${purls.length} packages`);
|
|
8898
|
+
require$$9.debugDir('inspect', {
|
|
8899
|
+
purls,
|
|
8900
|
+
outputKind
|
|
8901
|
+
});
|
|
8754
8902
|
const packageData = await fetchPurlsShallowScore(purls);
|
|
8903
|
+
require$$9.debugFn('notice', `Shallow scores ${packageData.ok ? 'fetched successfully' : 'fetch failed'}`);
|
|
8904
|
+
require$$9.debugDir('inspect', {
|
|
8905
|
+
packageData
|
|
8906
|
+
});
|
|
8755
8907
|
outputPurlsShallowScore(purls, packageData, outputKind);
|
|
8756
8908
|
}
|
|
8757
8909
|
|
|
@@ -9051,7 +9203,7 @@ async function computeSHA256(filepath) {
|
|
|
9051
9203
|
return {
|
|
9052
9204
|
ok: false,
|
|
9053
9205
|
message: 'Failed to compute file hash',
|
|
9054
|
-
cause: `Unable to read file ${filepath}: ${e
|
|
9206
|
+
cause: `Unable to read file ${filepath}: ${utils.getErrorCause(e)}`
|
|
9055
9207
|
};
|
|
9056
9208
|
}
|
|
9057
9209
|
}
|
|
@@ -9150,9 +9302,7 @@ async function processFilePatch(pkgPath, fileName, fileInfo, socketDir, options)
|
|
|
9150
9302
|
logger.logger.success(`Patch applied successfully`);
|
|
9151
9303
|
} catch (e) {
|
|
9152
9304
|
logger.logger.error('Error applying patch');
|
|
9153
|
-
require$$9.debugDir('
|
|
9154
|
-
error: e
|
|
9155
|
-
});
|
|
9305
|
+
require$$9.debugDir('error', e);
|
|
9156
9306
|
result = false;
|
|
9157
9307
|
}
|
|
9158
9308
|
logger.logger.groupEnd();
|
|
@@ -9232,7 +9382,7 @@ async function handlePatch({
|
|
|
9232
9382
|
} catch (e) {
|
|
9233
9383
|
spinner.stop();
|
|
9234
9384
|
let message = 'Failed to apply patches';
|
|
9235
|
-
let cause = e
|
|
9385
|
+
let cause = utils.getErrorCause(e);
|
|
9236
9386
|
if (e instanceof SyntaxError) {
|
|
9237
9387
|
message = `Invalid JSON in ${constants.MANIFEST_JSON}`;
|
|
9238
9388
|
cause = e.message;
|
|
@@ -9370,10 +9520,10 @@ async function run$l(argv, importMeta, context) {
|
|
|
9370
9520
|
API Token Requirements
|
|
9371
9521
|
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$g}`)}
|
|
9372
9522
|
|
|
9373
|
-
Note: Everything after "
|
|
9374
|
-
Only the
|
|
9523
|
+
Note: Everything after "${constants.PNPM}" is passed to the ${constants.PNPM} command.
|
|
9524
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
9375
9525
|
|
|
9376
|
-
Use \`socket wrapper on\` to alias this command as
|
|
9526
|
+
Use \`socket wrapper on\` to alias this command as \`${constants.PNPM}\`.
|
|
9377
9527
|
|
|
9378
9528
|
Examples
|
|
9379
9529
|
$ ${command}
|
|
@@ -9393,14 +9543,16 @@ async function run$l(argv, importMeta, context) {
|
|
|
9393
9543
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
9394
9544
|
return;
|
|
9395
9545
|
}
|
|
9396
|
-
const
|
|
9546
|
+
const shadowPnpmBin = /*@__PURE__*/require$3(constants.default.shadowPnpmBinPath);
|
|
9397
9547
|
process.exitCode = 1;
|
|
9398
9548
|
|
|
9399
9549
|
// Filter Socket flags from argv.
|
|
9400
9550
|
const filteredArgv = utils.filterFlags(argv, config.flags);
|
|
9401
9551
|
const {
|
|
9402
9552
|
spawnPromise
|
|
9403
|
-
} = await
|
|
9553
|
+
} = await shadowPnpmBin(filteredArgv, {
|
|
9554
|
+
stdio: 'inherit'
|
|
9555
|
+
});
|
|
9404
9556
|
await spawnPromise;
|
|
9405
9557
|
process.exitCode = 0;
|
|
9406
9558
|
}
|
|
@@ -9408,6 +9560,9 @@ async function run$l(argv, importMeta, context) {
|
|
|
9408
9560
|
async function runRawNpm(argv) {
|
|
9409
9561
|
process.exitCode = 1;
|
|
9410
9562
|
const spawnPromise = spawn.spawn(utils.getNpmBinPath(), argv, {
|
|
9563
|
+
// On Windows, npm is often a .cmd file that requires shell execution.
|
|
9564
|
+
// The spawn function from @socketsecurity/registry will handle this properly
|
|
9565
|
+
// when shell is true.
|
|
9411
9566
|
shell: constants.default.WIN32,
|
|
9412
9567
|
stdio: 'inherit'
|
|
9413
9568
|
});
|
|
@@ -9440,7 +9595,7 @@ const config$4 = {
|
|
|
9440
9595
|
the Socket wrapper. Use at your own risk.
|
|
9441
9596
|
|
|
9442
9597
|
Note: Everything after "raw-npm" is passed to the npm command.
|
|
9443
|
-
Only the
|
|
9598
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
9444
9599
|
|
|
9445
9600
|
Examples
|
|
9446
9601
|
$ ${command} install -g cowsay
|
|
@@ -9471,6 +9626,9 @@ async function run$k(argv, importMeta, {
|
|
|
9471
9626
|
async function runRawNpx(argv) {
|
|
9472
9627
|
process.exitCode = 1;
|
|
9473
9628
|
const spawnPromise = spawn.spawn(utils.getNpxBinPath(), argv, {
|
|
9629
|
+
// On Windows, npx is often a .cmd file that requires shell execution.
|
|
9630
|
+
// The spawn function from @socketsecurity/registry will handle this properly
|
|
9631
|
+
// when shell is true.
|
|
9474
9632
|
shell: constants.default.WIN32,
|
|
9475
9633
|
stdio: 'inherit'
|
|
9476
9634
|
});
|
|
@@ -9503,7 +9661,7 @@ const config$3 = {
|
|
|
9503
9661
|
the Socket wrapper. Use at your own risk.
|
|
9504
9662
|
|
|
9505
9663
|
Note: Everything after "raw-npx" is passed to the npx command.
|
|
9506
|
-
Only the
|
|
9664
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
9507
9665
|
|
|
9508
9666
|
Examples
|
|
9509
9667
|
$ ${command} cowsay
|
|
@@ -9588,6 +9746,16 @@ async function handleCreateRepo({
|
|
|
9588
9746
|
repoName,
|
|
9589
9747
|
visibility
|
|
9590
9748
|
}, outputKind) {
|
|
9749
|
+
require$$9.debugFn('notice', `Creating repository ${orgSlug}/${repoName}`);
|
|
9750
|
+
require$$9.debugDir('inspect', {
|
|
9751
|
+
defaultBranch,
|
|
9752
|
+
description,
|
|
9753
|
+
homepage,
|
|
9754
|
+
orgSlug,
|
|
9755
|
+
repoName,
|
|
9756
|
+
visibility,
|
|
9757
|
+
outputKind
|
|
9758
|
+
});
|
|
9591
9759
|
const data = await fetchCreateRepo({
|
|
9592
9760
|
defaultBranch,
|
|
9593
9761
|
description,
|
|
@@ -9596,6 +9764,10 @@ async function handleCreateRepo({
|
|
|
9596
9764
|
repoName,
|
|
9597
9765
|
visibility
|
|
9598
9766
|
});
|
|
9767
|
+
require$$9.debugFn('notice', `Repository creation ${data.ok ? 'succeeded' : 'failed'}`);
|
|
9768
|
+
require$$9.debugDir('inspect', {
|
|
9769
|
+
data
|
|
9770
|
+
});
|
|
9599
9771
|
outputCreateRepo(data, repoName, outputKind);
|
|
9600
9772
|
}
|
|
9601
9773
|
|
|
@@ -9692,7 +9864,7 @@ async function run$i(argv, importMeta, {
|
|
|
9692
9864
|
}, {
|
|
9693
9865
|
nook: true,
|
|
9694
9866
|
test: noLegacy,
|
|
9695
|
-
message: `Legacy flags are no longer supported. See ${
|
|
9867
|
+
message: `Legacy flags are no longer supported. See the ${utils.webLink(constants.V1_MIGRATION_GUIDE_URL, 'v1 migration guide')}.`,
|
|
9696
9868
|
fail: `received legacy flags`
|
|
9697
9869
|
}, {
|
|
9698
9870
|
test: !!repoName,
|
|
@@ -9823,7 +9995,7 @@ async function run$h(argv, importMeta, {
|
|
|
9823
9995
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
9824
9996
|
nook: true,
|
|
9825
9997
|
test: noLegacy,
|
|
9826
|
-
message: `Legacy flags are no longer supported. See ${
|
|
9998
|
+
message: `Legacy flags are no longer supported. See the ${utils.webLink(constants.V1_MIGRATION_GUIDE_URL, 'v1 migration guide')}.`,
|
|
9827
9999
|
fail: `received legacy flags`
|
|
9828
10000
|
}, {
|
|
9829
10001
|
nook: true,
|
|
@@ -10124,7 +10296,7 @@ async function run$g(argv, importMeta, {
|
|
|
10124
10296
|
}, {
|
|
10125
10297
|
nook: true,
|
|
10126
10298
|
test: !json || !markdown,
|
|
10127
|
-
message:
|
|
10299
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
10128
10300
|
fail: 'bad'
|
|
10129
10301
|
}, {
|
|
10130
10302
|
nook: true,
|
|
@@ -10314,7 +10486,7 @@ async function run$f(argv, importMeta, {
|
|
|
10314
10486
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
10315
10487
|
nook: true,
|
|
10316
10488
|
test: noLegacy,
|
|
10317
|
-
message: `Legacy flags are no longer supported. See ${
|
|
10489
|
+
message: `Legacy flags are no longer supported. See the ${utils.webLink(constants.V1_MIGRATION_GUIDE_URL, 'v1 migration guide')}.`,
|
|
10318
10490
|
fail: `received legacy flags`
|
|
10319
10491
|
}, {
|
|
10320
10492
|
nook: true,
|
|
@@ -10476,7 +10648,7 @@ async function run$e(argv, importMeta, {
|
|
|
10476
10648
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
10477
10649
|
nook: true,
|
|
10478
10650
|
test: noLegacy,
|
|
10479
|
-
message: `Legacy flags are no longer supported. See ${
|
|
10651
|
+
message: `Legacy flags are no longer supported. See the ${utils.webLink(constants.V1_MIGRATION_GUIDE_URL, 'v1 migration guide')}.`,
|
|
10480
10652
|
fail: `received legacy flags`
|
|
10481
10653
|
}, {
|
|
10482
10654
|
nook: true,
|
|
@@ -10490,7 +10662,7 @@ async function run$e(argv, importMeta, {
|
|
|
10490
10662
|
}, {
|
|
10491
10663
|
nook: true,
|
|
10492
10664
|
test: !json || !markdown,
|
|
10493
|
-
message:
|
|
10665
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
10494
10666
|
fail: 'bad'
|
|
10495
10667
|
}, {
|
|
10496
10668
|
nook: true,
|
|
@@ -10728,7 +10900,7 @@ async function run$d(argv, importMeta, {
|
|
|
10728
10900
|
Note: for a first run you probably want to set --default-branch to indicate
|
|
10729
10901
|
the default branch name, like "main" or "master".
|
|
10730
10902
|
|
|
10731
|
-
The
|
|
10903
|
+
The ${utils.socketDashboardLink('/org/YOURORG/alerts', '"alerts page"')} will show
|
|
10732
10904
|
the results from the last scan designated as the "pending head" on the branch
|
|
10733
10905
|
configured on Socket to be the "default branch". When creating a scan the
|
|
10734
10906
|
--set-as-alerts-page flag will default to true to update this. You can prevent
|
|
@@ -11151,7 +11323,7 @@ async function handleJson(data, file, dashboardMessage) {
|
|
|
11151
11323
|
logger.logger.fail(`Writing to \`${file}\` failed...`);
|
|
11152
11324
|
logger.logger.error(err);
|
|
11153
11325
|
} else {
|
|
11154
|
-
logger.logger.success(`Data successfully written to \`${file}\``);
|
|
11326
|
+
logger.logger.success(`Data successfully written to \`${utils.fileLink(file)}\``);
|
|
11155
11327
|
}
|
|
11156
11328
|
logger.logger.error(dashboardMessage);
|
|
11157
11329
|
});
|
|
@@ -11383,7 +11555,7 @@ async function run$b(argv, importMeta, {
|
|
|
11383
11555
|
}, {
|
|
11384
11556
|
nook: true,
|
|
11385
11557
|
test: !json || !markdown,
|
|
11386
|
-
message:
|
|
11558
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
11387
11559
|
fail: 'bad'
|
|
11388
11560
|
}, {
|
|
11389
11561
|
nook: true,
|
|
@@ -11792,19 +11964,17 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
|
|
|
11792
11964
|
};
|
|
11793
11965
|
} catch (e) {
|
|
11794
11966
|
logger.logger.fail('An error was thrown while trying to download a manifest file... url:', downloadUrl);
|
|
11795
|
-
require$$9.debugDir('
|
|
11796
|
-
error: e
|
|
11797
|
-
});
|
|
11967
|
+
require$$9.debugDir('error', e);
|
|
11798
11968
|
|
|
11799
11969
|
// If an error occurs and fileStream was created, attempt to clean up.
|
|
11800
11970
|
if (fs$1.existsSync(localPath)) {
|
|
11801
11971
|
// Check if fileStream was even opened before trying to delete
|
|
11802
11972
|
// This check might be too simplistic depending on when error occurs
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
}
|
|
11807
|
-
}
|
|
11973
|
+
try {
|
|
11974
|
+
await fs$1.promises.unlink(localPath);
|
|
11975
|
+
} catch (e) {
|
|
11976
|
+
logger.logger.fail(utils.formatErrorWithDetail(`Error deleting partial file ${localPath}`, e));
|
|
11977
|
+
}
|
|
11808
11978
|
}
|
|
11809
11979
|
// Construct a more informative error message
|
|
11810
11980
|
let detailedError = `Error during download of ${downloadUrl}: ${e.message}`;
|
|
@@ -12495,7 +12665,7 @@ async function run$9(argv, importMeta, {
|
|
|
12495
12665
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
12496
12666
|
nook: true,
|
|
12497
12667
|
test: noLegacy,
|
|
12498
|
-
message: `Legacy flags are no longer supported. See ${
|
|
12668
|
+
message: `Legacy flags are no longer supported. See the ${utils.webLink(constants.V1_MIGRATION_GUIDE_URL, 'v1 migration guide')}.`,
|
|
12499
12669
|
fail: `received legacy flags`
|
|
12500
12670
|
}, {
|
|
12501
12671
|
nook: true,
|
|
@@ -13428,8 +13598,8 @@ async function fetchScan(orgSlug, scanId) {
|
|
|
13428
13598
|
return JSON.parse(line);
|
|
13429
13599
|
} catch (e) {
|
|
13430
13600
|
ok = false;
|
|
13431
|
-
require$$9.debugFn('error', '
|
|
13432
|
-
require$$9.debugDir('
|
|
13601
|
+
require$$9.debugFn('error', 'Failed to parse scan result line as JSON');
|
|
13602
|
+
require$$9.debugDir('error', {
|
|
13433
13603
|
error: e,
|
|
13434
13604
|
line
|
|
13435
13605
|
});
|
|
@@ -13467,7 +13637,7 @@ async function outputScanView(result, orgSlug, scanId, filePath, outputKind) {
|
|
|
13467
13637
|
logger.logger.info('Writing json results to', filePath);
|
|
13468
13638
|
try {
|
|
13469
13639
|
await fs.writeFile(filePath, json, 'utf8');
|
|
13470
|
-
logger.logger.info(`Data successfully written to ${filePath}`);
|
|
13640
|
+
logger.logger.info(`Data successfully written to ${utils.fileLink(filePath)}`);
|
|
13471
13641
|
} catch (e) {
|
|
13472
13642
|
process.exitCode = 1;
|
|
13473
13643
|
logger.logger.fail('There was an error trying to write the markdown to disk');
|
|
@@ -13508,7 +13678,7 @@ View this report at: ${constants.default.SOCKET_WEBSITE_URL}/dashboard/org/${org
|
|
|
13508
13678
|
if (filePath && filePath !== '-') {
|
|
13509
13679
|
try {
|
|
13510
13680
|
await fs.writeFile(filePath, report, 'utf8');
|
|
13511
|
-
logger.logger.log(`Data successfully written to ${filePath}`);
|
|
13681
|
+
logger.logger.log(`Data successfully written to ${utils.fileLink(filePath)}`);
|
|
13512
13682
|
} catch (e) {
|
|
13513
13683
|
process.exitCode = 1;
|
|
13514
13684
|
logger.logger.fail('There was an error trying to write the markdown to disk');
|
|
@@ -13627,7 +13797,7 @@ async function run$4(argv, importMeta, {
|
|
|
13627
13797
|
}, {
|
|
13628
13798
|
nook: true,
|
|
13629
13799
|
test: !json || !markdown,
|
|
13630
|
-
message:
|
|
13800
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
13631
13801
|
fail: 'bad'
|
|
13632
13802
|
}, {
|
|
13633
13803
|
nook: true,
|
|
@@ -13944,7 +14114,7 @@ async function run$3(argv, importMeta, {
|
|
|
13944
14114
|
- Special access
|
|
13945
14115
|
|
|
13946
14116
|
This feature requires a Threat Feed license. Please contact
|
|
13947
|
-
sales@socket.dev if you are interested in purchasing this access.
|
|
14117
|
+
${utils.mailtoLink('sales@socket.dev')} if you are interested in purchasing this access.
|
|
13948
14118
|
|
|
13949
14119
|
Options
|
|
13950
14120
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -14309,10 +14479,8 @@ Do you want to install the Socket npm wrapper (this will create an alias to the
|
|
|
14309
14479
|
}
|
|
14310
14480
|
}
|
|
14311
14481
|
} catch (e) {
|
|
14312
|
-
require$$9.debugFn('
|
|
14313
|
-
require$$9.debugDir('
|
|
14314
|
-
error: e
|
|
14315
|
-
});
|
|
14482
|
+
require$$9.debugFn('warn', 'Tab completion setup failed (non-fatal)');
|
|
14483
|
+
require$$9.debugDir('warn', e);
|
|
14316
14484
|
// Ignore. Skip tab completion setup.
|
|
14317
14485
|
}
|
|
14318
14486
|
if (!updatedTabCompletion) {
|
|
@@ -14345,7 +14513,7 @@ async function setupShadowNpm(query) {
|
|
|
14345
14513
|
addSocketWrapper(zshRcPath);
|
|
14346
14514
|
}
|
|
14347
14515
|
} catch (e) {
|
|
14348
|
-
throw new Error(`There was an issue setting up the alias: ${e
|
|
14516
|
+
throw new Error(`There was an issue setting up the alias: ${utils.getErrorCause(e)}`);
|
|
14349
14517
|
}
|
|
14350
14518
|
}
|
|
14351
14519
|
}
|
|
@@ -14507,10 +14675,10 @@ async function run(argv, importMeta, context) {
|
|
|
14507
14675
|
API Token Requirements
|
|
14508
14676
|
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME}`)}
|
|
14509
14677
|
|
|
14510
|
-
Note: Everything after "
|
|
14511
|
-
Only the
|
|
14678
|
+
Note: Everything after "${constants.YARN}" is passed to the ${constants.YARN} command.
|
|
14679
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
14512
14680
|
|
|
14513
|
-
Use \`socket wrapper on\` to alias this command as
|
|
14681
|
+
Use \`socket wrapper on\` to alias this command as \`${constants.YARN}\`.
|
|
14514
14682
|
|
|
14515
14683
|
Examples
|
|
14516
14684
|
$ ${command}
|
|
@@ -14530,14 +14698,16 @@ async function run(argv, importMeta, context) {
|
|
|
14530
14698
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
14531
14699
|
return;
|
|
14532
14700
|
}
|
|
14533
|
-
const
|
|
14701
|
+
const shadowYarnBin = /*@__PURE__*/require$1(constants.default.shadowYarnBinPath);
|
|
14534
14702
|
process.exitCode = 1;
|
|
14535
14703
|
|
|
14536
14704
|
// Filter Socket flags from argv.
|
|
14537
14705
|
const filteredArgv = utils.filterFlags(argv, config.flags);
|
|
14538
14706
|
const {
|
|
14539
14707
|
spawnPromise
|
|
14540
|
-
} = await
|
|
14708
|
+
} = await shadowYarnBin(filteredArgv, {
|
|
14709
|
+
stdio: 'inherit'
|
|
14710
|
+
});
|
|
14541
14711
|
await spawnPromise;
|
|
14542
14712
|
process.exitCode = 0;
|
|
14543
14713
|
}
|
|
@@ -14665,7 +14835,7 @@ void (async () => {
|
|
|
14665
14835
|
version: constants.default.ENV.INLINED_SOCKET_CLI_VERSION,
|
|
14666
14836
|
logCallback: (name, version, latest) => {
|
|
14667
14837
|
logger.logger.log(`\n\nš¦ Update available for ${vendor.yoctocolorsCjsExports.cyan(name)}: ${vendor.yoctocolorsCjsExports.gray(version)} ā ${vendor.yoctocolorsCjsExports.green(latest)}`);
|
|
14668
|
-
logger.logger.log(`š ${
|
|
14838
|
+
logger.logger.log(`š ${utils.socketPackageLink('npm', name, `files/${latest}/CHANGELOG.md`, 'View changelog')}`);
|
|
14669
14839
|
}
|
|
14670
14840
|
});
|
|
14671
14841
|
try {
|
|
@@ -14679,10 +14849,8 @@ void (async () => {
|
|
|
14679
14849
|
});
|
|
14680
14850
|
} catch (e) {
|
|
14681
14851
|
process.exitCode = 1;
|
|
14682
|
-
require$$9.debugFn('error', '
|
|
14683
|
-
require$$9.debugDir('
|
|
14684
|
-
error: e
|
|
14685
|
-
});
|
|
14852
|
+
require$$9.debugFn('error', 'CLI uncaught error');
|
|
14853
|
+
require$$9.debugDir('error', e);
|
|
14686
14854
|
let errorBody;
|
|
14687
14855
|
let errorTitle;
|
|
14688
14856
|
let errorMessage = '';
|
|
@@ -14734,5 +14902,5 @@ void (async () => {
|
|
|
14734
14902
|
await utils.captureException(e);
|
|
14735
14903
|
}
|
|
14736
14904
|
})();
|
|
14737
|
-
//# debugId=
|
|
14905
|
+
//# debugId=c2710cf0-3d3a-46a7-8ead-88053b9e55be
|
|
14738
14906
|
//# sourceMappingURL=cli.js.map
|