@socketsecurity/cli-with-sentry 1.0.97 → 1.0.98
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/dist/cli.js +711 -354
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/shadow-npm-inject.js +2 -2
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/pull-request.d.mts +6 -1
- package/dist/types/commands/fix/pull-request.d.mts.map +1 -1
- package/dist/types/commands/patch/cmd-patch.d.mts +11 -0
- package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -0
- package/dist/types/commands/patch/handle-patch.d.mts +10 -0
- package/dist/types/commands/patch/handle-patch.d.mts.map +1 -0
- package/dist/types/commands/patch/output-patch-result.d.mts +5 -0
- package/dist/types/commands/patch/output-patch-result.d.mts.map +1 -0
- package/dist/types/commands.d.mts +7 -0
- package/dist/types/commands.d.mts.map +1 -1
- package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
- package/dist/utils.js +40 -38
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +4621 -4613
- package/external/@coana-tech/cli/cli.mjs +61 -52
- package/external/@coana-tech/cli/repos/coana-tech/alucard/alucard.jar +0 -0
- package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
- package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
- package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
- package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
- package/package.json +4 -4
- package/dist/types/commands/scan/suggest-repo-slug.d.mts +0 -9
- package/dist/types/commands/scan/suggest-repo-slug.d.mts.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -18,11 +18,11 @@ var spawn = require('../external/@socketsecurity/registry/lib/spawn');
|
|
|
18
18
|
var fs$2 = require('../external/@socketsecurity/registry/lib/fs');
|
|
19
19
|
var strings = require('../external/@socketsecurity/registry/lib/strings');
|
|
20
20
|
var arrays = require('../external/@socketsecurity/registry/lib/arrays');
|
|
21
|
+
var regexps = require('../external/@socketsecurity/registry/lib/regexps');
|
|
21
22
|
var registry = require('../external/@socketsecurity/registry');
|
|
22
23
|
var npm = require('../external/@socketsecurity/registry/lib/npm');
|
|
23
24
|
var packages = require('../external/@socketsecurity/registry/lib/packages');
|
|
24
25
|
var sorts = require('../external/@socketsecurity/registry/lib/sorts');
|
|
25
|
-
var regexps = require('../external/@socketsecurity/registry/lib/regexps');
|
|
26
26
|
var shadowNpmInject = require('./shadow-npm-inject.js');
|
|
27
27
|
var require$$9 = require('../external/@socketsecurity/registry/lib/objects');
|
|
28
28
|
var path$1 = require('../external/@socketsecurity/registry/lib/path');
|
|
@@ -322,21 +322,21 @@ async function handleAnalytics({
|
|
|
322
322
|
const {
|
|
323
323
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$M
|
|
324
324
|
} = constants;
|
|
325
|
-
const CMD_NAME$
|
|
326
|
-
const description$
|
|
327
|
-
const hidden$
|
|
325
|
+
const CMD_NAME$x = 'analytics';
|
|
326
|
+
const description$D = 'Look up analytics data';
|
|
327
|
+
const hidden$v = false;
|
|
328
328
|
const cmdAnalytics = {
|
|
329
|
-
description: description$
|
|
330
|
-
hidden: hidden$
|
|
331
|
-
run: run$
|
|
329
|
+
description: description$D,
|
|
330
|
+
hidden: hidden$v,
|
|
331
|
+
run: run$Q
|
|
332
332
|
};
|
|
333
|
-
async function run$
|
|
333
|
+
async function run$Q(argv, importMeta, {
|
|
334
334
|
parentName
|
|
335
335
|
}) {
|
|
336
336
|
const config = {
|
|
337
|
-
commandName: CMD_NAME$
|
|
338
|
-
description: description$
|
|
339
|
-
hidden: hidden$
|
|
337
|
+
commandName: CMD_NAME$x,
|
|
338
|
+
description: description$D,
|
|
339
|
+
hidden: hidden$v,
|
|
340
340
|
flags: {
|
|
341
341
|
...flags.commonFlags,
|
|
342
342
|
...flags.outputFlags,
|
|
@@ -352,7 +352,7 @@ async function run$P(argv, importMeta, {
|
|
|
352
352
|
$ ${command} [options] [ "org" | "repo" <reponame>] [TIME]
|
|
353
353
|
|
|
354
354
|
API Token Requirements
|
|
355
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
355
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$x}`)}
|
|
356
356
|
|
|
357
357
|
The scope is either org or repo level, defaults to org.
|
|
358
358
|
|
|
@@ -755,21 +755,21 @@ const {
|
|
|
755
755
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$L,
|
|
756
756
|
SOCKET_WEBSITE_URL: SOCKET_WEBSITE_URL$3
|
|
757
757
|
} = constants;
|
|
758
|
-
const CMD_NAME$
|
|
759
|
-
const description$
|
|
760
|
-
const hidden$
|
|
758
|
+
const CMD_NAME$w = 'audit-log';
|
|
759
|
+
const description$C = 'Look up the audit log for an organization';
|
|
760
|
+
const hidden$u = false;
|
|
761
761
|
const cmdAuditLog = {
|
|
762
|
-
description: description$
|
|
763
|
-
hidden: hidden$
|
|
764
|
-
run: run$
|
|
762
|
+
description: description$C,
|
|
763
|
+
hidden: hidden$u,
|
|
764
|
+
run: run$P
|
|
765
765
|
};
|
|
766
|
-
async function run$
|
|
766
|
+
async function run$P(argv, importMeta, {
|
|
767
767
|
parentName
|
|
768
768
|
}) {
|
|
769
769
|
const config = {
|
|
770
|
-
commandName: CMD_NAME$
|
|
771
|
-
description: description$
|
|
772
|
-
hidden: hidden$
|
|
770
|
+
commandName: CMD_NAME$w,
|
|
771
|
+
description: description$C,
|
|
772
|
+
hidden: hidden$u,
|
|
773
773
|
flags: {
|
|
774
774
|
...flags.commonFlags,
|
|
775
775
|
...flags.outputFlags,
|
|
@@ -797,7 +797,7 @@ async function run$O(argv, importMeta, {
|
|
|
797
797
|
$ ${command} [options] [FILTER]
|
|
798
798
|
|
|
799
799
|
API Token Requirements
|
|
800
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
800
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$w}`)}
|
|
801
801
|
|
|
802
802
|
This feature requires an Enterprise Plan. To learn more about getting access
|
|
803
803
|
to this feature and many more, please visit ${SOCKET_WEBSITE_URL$3}/pricing
|
|
@@ -2376,9 +2376,9 @@ const config$k = {
|
|
|
2376
2376
|
const cmdCI = {
|
|
2377
2377
|
description: config$k.description,
|
|
2378
2378
|
hidden: config$k.hidden,
|
|
2379
|
-
run: run$
|
|
2379
|
+
run: run$O
|
|
2380
2380
|
};
|
|
2381
|
-
async function run$
|
|
2381
|
+
async function run$O(argv, importMeta, {
|
|
2382
2382
|
parentName
|
|
2383
2383
|
}) {
|
|
2384
2384
|
const cli = utils.meowOrExit({
|
|
@@ -2623,21 +2623,21 @@ async function handleConfigAuto({
|
|
|
2623
2623
|
const {
|
|
2624
2624
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$J
|
|
2625
2625
|
} = constants;
|
|
2626
|
-
const CMD_NAME$
|
|
2627
|
-
const description$
|
|
2628
|
-
const hidden$
|
|
2626
|
+
const CMD_NAME$v = 'auto';
|
|
2627
|
+
const description$B = 'Automatically discover and set the correct value config item';
|
|
2628
|
+
const hidden$t = false;
|
|
2629
2629
|
const cmdConfigAuto = {
|
|
2630
|
-
description: description$
|
|
2631
|
-
hidden: hidden$
|
|
2632
|
-
run: run$
|
|
2630
|
+
description: description$B,
|
|
2631
|
+
hidden: hidden$t,
|
|
2632
|
+
run: run$N
|
|
2633
2633
|
};
|
|
2634
|
-
async function run$
|
|
2634
|
+
async function run$N(argv, importMeta, {
|
|
2635
2635
|
parentName
|
|
2636
2636
|
}) {
|
|
2637
2637
|
const config = {
|
|
2638
|
-
commandName: CMD_NAME$
|
|
2639
|
-
description: description$
|
|
2640
|
-
hidden: hidden$
|
|
2638
|
+
commandName: CMD_NAME$v,
|
|
2639
|
+
description: description$B,
|
|
2640
|
+
hidden: hidden$t,
|
|
2641
2641
|
flags: {
|
|
2642
2642
|
...flags.commonFlags,
|
|
2643
2643
|
...flags.outputFlags
|
|
@@ -2764,9 +2764,9 @@ ${utils.getSupportedConfigEntries().map(([key, desc]) => ` - ${key} -- ${des
|
|
|
2764
2764
|
const cmdConfigGet = {
|
|
2765
2765
|
description: config$j.description,
|
|
2766
2766
|
hidden: config$j.hidden,
|
|
2767
|
-
run: run$
|
|
2767
|
+
run: run$M
|
|
2768
2768
|
};
|
|
2769
|
-
async function run$
|
|
2769
|
+
async function run$M(argv, importMeta, {
|
|
2770
2770
|
parentName
|
|
2771
2771
|
}) {
|
|
2772
2772
|
const cli = utils.meowOrExit({
|
|
@@ -2903,9 +2903,9 @@ const config$i = {
|
|
|
2903
2903
|
const cmdConfigList = {
|
|
2904
2904
|
description: config$i.description,
|
|
2905
2905
|
hidden: config$i.hidden,
|
|
2906
|
-
run: run$
|
|
2906
|
+
run: run$L
|
|
2907
2907
|
};
|
|
2908
|
-
async function run$
|
|
2908
|
+
async function run$L(argv, importMeta, {
|
|
2909
2909
|
parentName
|
|
2910
2910
|
}) {
|
|
2911
2911
|
const cli = utils.meowOrExit({
|
|
@@ -2982,21 +2982,21 @@ async function handleConfigSet({
|
|
|
2982
2982
|
const {
|
|
2983
2983
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$G
|
|
2984
2984
|
} = constants;
|
|
2985
|
-
const CMD_NAME$
|
|
2986
|
-
const description$
|
|
2987
|
-
const hidden$
|
|
2985
|
+
const CMD_NAME$u = 'set';
|
|
2986
|
+
const description$A = 'Update the value of a local CLI config item';
|
|
2987
|
+
const hidden$s = false;
|
|
2988
2988
|
const cmdConfigSet = {
|
|
2989
|
-
description: description$
|
|
2990
|
-
hidden: hidden$
|
|
2991
|
-
run: run$
|
|
2989
|
+
description: description$A,
|
|
2990
|
+
hidden: hidden$s,
|
|
2991
|
+
run: run$K
|
|
2992
2992
|
};
|
|
2993
|
-
async function run$
|
|
2993
|
+
async function run$K(argv, importMeta, {
|
|
2994
2994
|
parentName
|
|
2995
2995
|
}) {
|
|
2996
2996
|
const config = {
|
|
2997
|
-
commandName: CMD_NAME$
|
|
2998
|
-
description: description$
|
|
2999
|
-
hidden: hidden$
|
|
2997
|
+
commandName: CMD_NAME$u,
|
|
2998
|
+
description: description$A,
|
|
2999
|
+
hidden: hidden$s,
|
|
3000
3000
|
flags: {
|
|
3001
3001
|
...flags.commonFlags,
|
|
3002
3002
|
...flags.outputFlags
|
|
@@ -3109,21 +3109,21 @@ async function handleConfigUnset({
|
|
|
3109
3109
|
const {
|
|
3110
3110
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$F
|
|
3111
3111
|
} = constants;
|
|
3112
|
-
const CMD_NAME$
|
|
3113
|
-
const description$
|
|
3114
|
-
const hidden$
|
|
3112
|
+
const CMD_NAME$t = 'unset';
|
|
3113
|
+
const description$z = 'Clear the value of a local CLI config item';
|
|
3114
|
+
const hidden$r = false;
|
|
3115
3115
|
const cmdConfigUnset = {
|
|
3116
|
-
description: description$
|
|
3117
|
-
hidden: hidden$
|
|
3118
|
-
run: run$
|
|
3116
|
+
description: description$z,
|
|
3117
|
+
hidden: hidden$r,
|
|
3118
|
+
run: run$J
|
|
3119
3119
|
};
|
|
3120
|
-
async function run$
|
|
3120
|
+
async function run$J(argv, importMeta, {
|
|
3121
3121
|
parentName
|
|
3122
3122
|
}) {
|
|
3123
3123
|
const config = {
|
|
3124
|
-
commandName: CMD_NAME$
|
|
3125
|
-
description: description$
|
|
3126
|
-
hidden: hidden$
|
|
3124
|
+
commandName: CMD_NAME$t,
|
|
3125
|
+
description: description$z,
|
|
3126
|
+
hidden: hidden$r,
|
|
3127
3127
|
flags: {
|
|
3128
3128
|
...flags.commonFlags,
|
|
3129
3129
|
...flags.outputFlags
|
|
@@ -3182,9 +3182,9 @@ ${utils.getSupportedConfigEntries().map(([key, desc]) => ` - ${key} -- ${des
|
|
|
3182
3182
|
});
|
|
3183
3183
|
}
|
|
3184
3184
|
|
|
3185
|
-
const description$
|
|
3185
|
+
const description$y = 'Manage Socket CLI configuration';
|
|
3186
3186
|
const cmdConfig = {
|
|
3187
|
-
description: description$
|
|
3187
|
+
description: description$y,
|
|
3188
3188
|
hidden: false,
|
|
3189
3189
|
async run(argv, importMeta, {
|
|
3190
3190
|
parentName
|
|
@@ -3197,74 +3197,13 @@ const cmdConfig = {
|
|
|
3197
3197
|
unset: cmdConfigUnset
|
|
3198
3198
|
}, {
|
|
3199
3199
|
argv,
|
|
3200
|
-
description: description$
|
|
3200
|
+
description: description$y,
|
|
3201
3201
|
importMeta,
|
|
3202
3202
|
name: `${parentName} config`
|
|
3203
3203
|
});
|
|
3204
3204
|
}
|
|
3205
3205
|
};
|
|
3206
3206
|
|
|
3207
|
-
async function coanaFix(fixConfig) {
|
|
3208
|
-
const {
|
|
3209
|
-
ghsas
|
|
3210
|
-
} = fixConfig;
|
|
3211
|
-
if (!ghsas.length) {
|
|
3212
|
-
return {
|
|
3213
|
-
ok: true,
|
|
3214
|
-
data: {
|
|
3215
|
-
fixed: false
|
|
3216
|
-
}
|
|
3217
|
-
};
|
|
3218
|
-
}
|
|
3219
|
-
const {
|
|
3220
|
-
cwd,
|
|
3221
|
-
orgSlug,
|
|
3222
|
-
spinner
|
|
3223
|
-
} = fixConfig;
|
|
3224
|
-
spinner?.start();
|
|
3225
|
-
const sockSdkCResult = await utils.setupSdk();
|
|
3226
|
-
let lastCResult = sockSdkCResult;
|
|
3227
|
-
const sockSdk = sockSdkCResult.ok ? sockSdkCResult.data : undefined;
|
|
3228
|
-
const supportedFilesCResult = sockSdk ? await fetchSupportedScanFileNames() : undefined;
|
|
3229
|
-
if (supportedFilesCResult) {
|
|
3230
|
-
lastCResult = supportedFilesCResult;
|
|
3231
|
-
}
|
|
3232
|
-
const supportedFiles = supportedFilesCResult?.ok ? supportedFilesCResult.data : undefined;
|
|
3233
|
-
const packagePaths = supportedFiles ? await utils.getPackageFilesForScan(['.'], supportedFiles, {
|
|
3234
|
-
cwd
|
|
3235
|
-
}) : [];
|
|
3236
|
-
const uploadCResult = sockSdk ? await utils.handleApiCall(sockSdk?.uploadManifestFiles(orgSlug, packagePaths), {
|
|
3237
|
-
desc: 'upload manifests'
|
|
3238
|
-
}) : undefined;
|
|
3239
|
-
if (uploadCResult) {
|
|
3240
|
-
lastCResult = uploadCResult;
|
|
3241
|
-
}
|
|
3242
|
-
const tarHash = uploadCResult?.ok ? uploadCResult.data.tarHash : '';
|
|
3243
|
-
if (!tarHash) {
|
|
3244
|
-
spinner?.stop();
|
|
3245
|
-
return lastCResult;
|
|
3246
|
-
}
|
|
3247
|
-
const isAllOrAuto = ghsas.length === 1 && (ghsas[0] === 'all' || ghsas[0] === 'auto');
|
|
3248
|
-
const ids = isAllOrAuto ? ['all'] : ghsas;
|
|
3249
|
-
const fixCResult = ids.length ? await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...ids, ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3250
|
-
cwd,
|
|
3251
|
-
spinner
|
|
3252
|
-
}) : undefined;
|
|
3253
|
-
if (fixCResult) {
|
|
3254
|
-
lastCResult = fixCResult;
|
|
3255
|
-
}
|
|
3256
|
-
spinner?.stop();
|
|
3257
|
-
require$$8.debugDir('inspect', {
|
|
3258
|
-
lastCResult
|
|
3259
|
-
});
|
|
3260
|
-
return lastCResult.ok ? {
|
|
3261
|
-
ok: true,
|
|
3262
|
-
data: {
|
|
3263
|
-
fixed: true
|
|
3264
|
-
}
|
|
3265
|
-
} : lastCResult;
|
|
3266
|
-
}
|
|
3267
|
-
|
|
3268
3207
|
function formatBranchName(name) {
|
|
3269
3208
|
return name.replace(/[^-a-zA-Z0-9/._-]+/g, '+');
|
|
3270
3209
|
}
|
|
@@ -3352,34 +3291,6 @@ function getSocketPullRequestTitle(purl, newVersion, workspace) {
|
|
|
3352
3291
|
return `Bump ${fullName} from ${purlObj.version} to ${newVersion}${workspace ? ` in ${workspace}` : ''}`;
|
|
3353
3292
|
}
|
|
3354
3293
|
|
|
3355
|
-
function getPrsForPurl(fixEnv, partialPurl) {
|
|
3356
|
-
if (!fixEnv) {
|
|
3357
|
-
return [];
|
|
3358
|
-
}
|
|
3359
|
-
const prs = [];
|
|
3360
|
-
const partialPurlObj = utils.getPurlObject(partialPurl);
|
|
3361
|
-
const branchFullName = getSocketBranchFullNameComponent(partialPurlObj);
|
|
3362
|
-
const branchPurlType = getSocketBranchPurlTypeComponent(partialPurlObj);
|
|
3363
|
-
for (const pr of fixEnv.prs) {
|
|
3364
|
-
const parsedBranch = genericSocketBranchParser(pr.headRefName);
|
|
3365
|
-
if (branchPurlType === parsedBranch?.type && branchFullName === parsedBranch?.fullName) {
|
|
3366
|
-
prs.push(pr);
|
|
3367
|
-
}
|
|
3368
|
-
}
|
|
3369
|
-
if (require$$8.isDebug('notice,silly')) {
|
|
3370
|
-
const fullName = packages.resolvePackageName(partialPurlObj);
|
|
3371
|
-
if (prs.length) {
|
|
3372
|
-
require$$8.debugFn('notice', `found: ${prs.length} PRs for ${fullName}`);
|
|
3373
|
-
require$$8.debugDir('silly', {
|
|
3374
|
-
prs
|
|
3375
|
-
});
|
|
3376
|
-
} else if (fixEnv.prs.length) {
|
|
3377
|
-
require$$8.debugFn('notice', `miss: 0 PRs found for ${fullName}`);
|
|
3378
|
-
}
|
|
3379
|
-
}
|
|
3380
|
-
return prs;
|
|
3381
|
-
}
|
|
3382
|
-
|
|
3383
3294
|
let _octokit;
|
|
3384
3295
|
function getOctokit() {
|
|
3385
3296
|
if (_octokit === undefined) {
|
|
@@ -3420,19 +3331,6 @@ function getOctokitGraphql() {
|
|
|
3420
3331
|
}
|
|
3421
3332
|
return _octokitGraphql;
|
|
3422
3333
|
}
|
|
3423
|
-
async function cacheFetch(key, fetcher, ttlMs) {
|
|
3424
|
-
// Optionally disable cache.
|
|
3425
|
-
// Lazily access constants.ENV.DISABLE_GITHUB_CACHE.
|
|
3426
|
-
if (constants.ENV.DISABLE_GITHUB_CACHE) {
|
|
3427
|
-
return await fetcher();
|
|
3428
|
-
}
|
|
3429
|
-
let data = await readCache(key, ttlMs);
|
|
3430
|
-
if (!data) {
|
|
3431
|
-
data = await fetcher();
|
|
3432
|
-
await writeCache(key, data);
|
|
3433
|
-
}
|
|
3434
|
-
return data;
|
|
3435
|
-
}
|
|
3436
3334
|
async function readCache(key,
|
|
3437
3335
|
// 5 minute in milliseconds time to live (TTL).
|
|
3438
3336
|
ttlMs = 5 * 60 * 1000) {
|
|
@@ -3460,6 +3358,19 @@ async function writeCache(key, data) {
|
|
|
3460
3358
|
}
|
|
3461
3359
|
await fs$2.writeJson(cacheJsonPath, data);
|
|
3462
3360
|
}
|
|
3361
|
+
async function cacheFetch(key, fetcher, ttlMs) {
|
|
3362
|
+
// Optionally disable cache.
|
|
3363
|
+
// Lazily access constants.ENV.DISABLE_GITHUB_CACHE.
|
|
3364
|
+
if (constants.ENV.DISABLE_GITHUB_CACHE) {
|
|
3365
|
+
return await fetcher();
|
|
3366
|
+
}
|
|
3367
|
+
let data = await readCache(key, ttlMs);
|
|
3368
|
+
if (!data) {
|
|
3369
|
+
data = await fetcher();
|
|
3370
|
+
await writeCache(key, data);
|
|
3371
|
+
}
|
|
3372
|
+
return data;
|
|
3373
|
+
}
|
|
3463
3374
|
async function cleanupPrs(owner, repo, options) {
|
|
3464
3375
|
const contextualMatches = await getSocketPrsWithContext(owner, repo, options);
|
|
3465
3376
|
if (!contextualMatches.length) {
|
|
@@ -3501,7 +3412,7 @@ async function cleanupPrs(owner, repo, options) {
|
|
|
3501
3412
|
cachesToSave.set(context.cacheKey, context.data);
|
|
3502
3413
|
return null;
|
|
3503
3414
|
} catch (e) {
|
|
3504
|
-
require$$8.debugFn('error', `pr: failed to close ${prRef} for ${prToVersion}\n`, e?.message || '
|
|
3415
|
+
require$$8.debugFn('error', `pr: failed to close ${prRef} for ${prToVersion}\n`, e?.message || 'Unknown error');
|
|
3505
3416
|
}
|
|
3506
3417
|
}
|
|
3507
3418
|
// Update stale PRs.
|
|
@@ -3741,6 +3652,46 @@ async function openPr(owner, repo, branch, purl, newVersion, options) {
|
|
|
3741
3652
|
}
|
|
3742
3653
|
return null;
|
|
3743
3654
|
}
|
|
3655
|
+
async function openCoanaPr(owner, repo, branch, ghsaIds, options) {
|
|
3656
|
+
const {
|
|
3657
|
+
baseBranch = 'main'
|
|
3658
|
+
} = {
|
|
3659
|
+
__proto__: null,
|
|
3660
|
+
...options
|
|
3661
|
+
};
|
|
3662
|
+
const octokit = getOctokit();
|
|
3663
|
+
const vulnCount = ghsaIds.length;
|
|
3664
|
+
const prTitle = vulnCount === 1 ? `Fix for ${ghsaIds[0]}` : `Fixes for ${vulnCount} GHSAs`;
|
|
3665
|
+
let prBody = '';
|
|
3666
|
+
if (vulnCount === 1) {
|
|
3667
|
+
prBody = `[Socket](https://socket.dev/) fix for [${ghsaIds[0]}](https://github.com/advisories/${ghsaIds[0]}).`;
|
|
3668
|
+
} else {
|
|
3669
|
+
prBody = `[Socket](https://socket.dev/) fixes for ${vulnCount} GHSAs.\n\n**Fixed GHSAs:**\n${ghsaIds.map(id => `- [${id}](https://github.com/advisories/${id})`).join('\n')}`;
|
|
3670
|
+
}
|
|
3671
|
+
try {
|
|
3672
|
+
const octokitPullsCreateParams = {
|
|
3673
|
+
owner,
|
|
3674
|
+
repo,
|
|
3675
|
+
title: prTitle,
|
|
3676
|
+
head: branch,
|
|
3677
|
+
base: baseBranch,
|
|
3678
|
+
body: prBody
|
|
3679
|
+
};
|
|
3680
|
+
require$$8.debugDir('inspect', {
|
|
3681
|
+
octokitPullsCreateParams
|
|
3682
|
+
});
|
|
3683
|
+
return await octokit.pulls.create(octokitPullsCreateParams);
|
|
3684
|
+
} catch (e) {
|
|
3685
|
+
let message = `Failed to open pull request`;
|
|
3686
|
+
const errors = e instanceof vendor.RequestError ? e.response?.data?.['errors'] : undefined;
|
|
3687
|
+
if (Array.isArray(errors) && errors.length) {
|
|
3688
|
+
const details = errors.map(d => `- ${d.message?.trim() ?? `${d.resource}.${d.field} (${d.code})`}`).join('\n');
|
|
3689
|
+
message += `:\n${details}`;
|
|
3690
|
+
}
|
|
3691
|
+
require$$8.debugFn('error', message);
|
|
3692
|
+
}
|
|
3693
|
+
return null;
|
|
3694
|
+
}
|
|
3744
3695
|
async function setGitRemoteGithubRepoUrl(owner, repo, token, cwd = process.cwd()) {
|
|
3745
3696
|
const {
|
|
3746
3697
|
host
|
|
@@ -3823,26 +3774,282 @@ async function getFixEnv() {
|
|
|
3823
3774
|
};
|
|
3824
3775
|
}
|
|
3825
3776
|
|
|
3826
|
-
async function
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3777
|
+
async function coanaFix(fixConfig) {
|
|
3778
|
+
const {
|
|
3779
|
+
autoMerge,
|
|
3780
|
+
cwd,
|
|
3781
|
+
ghsas,
|
|
3782
|
+
limit,
|
|
3783
|
+
orgSlug,
|
|
3784
|
+
spinner
|
|
3785
|
+
} = fixConfig;
|
|
3786
|
+
const fixEnv = await getFixEnv();
|
|
3787
|
+
require$$8.debugDir('inspect', {
|
|
3788
|
+
fixEnv
|
|
3789
|
+
});
|
|
3790
|
+
spinner?.start();
|
|
3791
|
+
const sockSdkCResult = await utils.setupSdk();
|
|
3792
|
+
if (!sockSdkCResult.ok) {
|
|
3793
|
+
return sockSdkCResult;
|
|
3794
|
+
}
|
|
3795
|
+
const sockSdk = sockSdkCResult.data;
|
|
3796
|
+
const supportedFilesCResult = await fetchSupportedScanFileNames();
|
|
3797
|
+
if (!supportedFilesCResult.ok) {
|
|
3798
|
+
return supportedFilesCResult;
|
|
3799
|
+
}
|
|
3800
|
+
const supportedFiles = supportedFilesCResult.data;
|
|
3801
|
+
const scanFilepaths = await utils.getPackageFilesForScan(['.'], supportedFiles, {
|
|
3802
|
+
cwd
|
|
3803
|
+
});
|
|
3804
|
+
const uploadCResult = await utils.handleApiCall(sockSdk.uploadManifestFiles(orgSlug, scanFilepaths), {
|
|
3805
|
+
desc: 'upload manifests'
|
|
3806
|
+
});
|
|
3807
|
+
if (!uploadCResult.ok) {
|
|
3808
|
+
return uploadCResult;
|
|
3809
|
+
}
|
|
3810
|
+
const tarHash = uploadCResult.data.tarHash;
|
|
3811
|
+
if (!tarHash) {
|
|
3812
|
+
spinner?.stop();
|
|
3840
3813
|
return {
|
|
3841
|
-
|
|
3814
|
+
ok: false,
|
|
3815
|
+
message: 'No tar hash returned from Socket API upload-manifest-files endpoint',
|
|
3816
|
+
data: uploadCResult.data
|
|
3842
3817
|
};
|
|
3843
3818
|
}
|
|
3844
|
-
|
|
3845
|
-
|
|
3819
|
+
const isAll = ghsas.length === 1 && (ghsas[0] === 'all' || ghsas[0] === 'auto');
|
|
3820
|
+
const shouldOpenPrs = fixEnv.isCi && fixEnv.repoInfo;
|
|
3821
|
+
if (!shouldOpenPrs) {
|
|
3822
|
+
const ids = isAll ? ['all'] : ghsas.slice(0, limit);
|
|
3823
|
+
if (!ids.length) {
|
|
3824
|
+
spinner?.stop();
|
|
3825
|
+
return {
|
|
3826
|
+
ok: true,
|
|
3827
|
+
data: {
|
|
3828
|
+
fixed: false
|
|
3829
|
+
}
|
|
3830
|
+
};
|
|
3831
|
+
}
|
|
3832
|
+
const fixCResult = await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...(isAll ? ['all'] : ghsas), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3833
|
+
cwd,
|
|
3834
|
+
spinner
|
|
3835
|
+
});
|
|
3836
|
+
spinner?.stop();
|
|
3837
|
+
return fixCResult.ok ? {
|
|
3838
|
+
ok: true,
|
|
3839
|
+
data: {
|
|
3840
|
+
fixed: true
|
|
3841
|
+
}
|
|
3842
|
+
} : fixCResult;
|
|
3843
|
+
}
|
|
3844
|
+
let ids;
|
|
3845
|
+
if (isAll) {
|
|
3846
|
+
const foundCResult = await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3847
|
+
cwd,
|
|
3848
|
+
spinner
|
|
3849
|
+
});
|
|
3850
|
+
if (foundCResult.ok) {
|
|
3851
|
+
const foundIds = utils.cmdFlagValueToArray(/(?<=Vulnerabilities found:).*/.exec(foundCResult.data));
|
|
3852
|
+
ids = foundIds.slice(0, limit);
|
|
3853
|
+
}
|
|
3854
|
+
} else {
|
|
3855
|
+
ids = ghsas.slice(0, limit);
|
|
3856
|
+
}
|
|
3857
|
+
if (!ids?.length) {
|
|
3858
|
+
require$$8.debugFn('notice', 'miss: no GHSA IDs to process');
|
|
3859
|
+
}
|
|
3860
|
+
if (!fixEnv.repoInfo) {
|
|
3861
|
+
require$$8.debugFn('notice', 'miss: no repo info detected');
|
|
3862
|
+
}
|
|
3863
|
+
if (!ids?.length || !fixEnv.repoInfo) {
|
|
3864
|
+
spinner?.stop();
|
|
3865
|
+
return {
|
|
3866
|
+
ok: true,
|
|
3867
|
+
data: {
|
|
3868
|
+
fixed: false
|
|
3869
|
+
}
|
|
3870
|
+
};
|
|
3871
|
+
}
|
|
3872
|
+
const scanBaseNames = new Set(scanFilepaths.map(p => path.basename(p)));
|
|
3873
|
+
let count = 0;
|
|
3874
|
+
let overallFixed = false;
|
|
3875
|
+
|
|
3876
|
+
// Process each GHSA ID individually, similar to npm-fix/pnpm-fix.
|
|
3877
|
+
ghsaLoop: for (let i = 0, {
|
|
3878
|
+
length
|
|
3879
|
+
} = ids; i < length; i += 1) {
|
|
3880
|
+
const id = ids[i];
|
|
3881
|
+
require$$8.debugFn('notice', `Processing GHSA ID: ${id}`);
|
|
3882
|
+
|
|
3883
|
+
// Apply fix for single GHSA ID.
|
|
3884
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3885
|
+
const fixCResult = await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', id, ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3886
|
+
cwd,
|
|
3887
|
+
spinner
|
|
3888
|
+
});
|
|
3889
|
+
if (!fixCResult.ok) {
|
|
3890
|
+
logger.logger.error(`Update failed for ${id}: ${fixCResult.message || 'Unknown error'}`);
|
|
3891
|
+
continue ghsaLoop;
|
|
3892
|
+
}
|
|
3893
|
+
|
|
3894
|
+
// Check for modified files after applying the fix.
|
|
3895
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3896
|
+
const unstagedCResult = await utils.gitUnstagedModifiedFiles(cwd);
|
|
3897
|
+
const modifiedFiles = unstagedCResult.ok ? unstagedCResult.data.filter(relPath => scanBaseNames.has(path.basename(relPath))) : [];
|
|
3898
|
+
if (!modifiedFiles.length) {
|
|
3899
|
+
require$$8.debugFn('notice', `skip: no changes for ${id}`);
|
|
3900
|
+
continue ghsaLoop;
|
|
3901
|
+
}
|
|
3902
|
+
overallFixed = true;
|
|
3903
|
+
|
|
3904
|
+
// Create PR if in CI environment
|
|
3905
|
+
try {
|
|
3906
|
+
const branch = `socket/coana-fix/${id}`;
|
|
3907
|
+
|
|
3908
|
+
// Check if branch already exists
|
|
3909
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3910
|
+
if (await utils.gitRemoteBranchExists(branch, cwd)) {
|
|
3911
|
+
require$$8.debugFn('notice', `skip: remote branch "${branch}" exists`);
|
|
3912
|
+
continue ghsaLoop;
|
|
3913
|
+
}
|
|
3914
|
+
require$$8.debugFn('notice', `pr: creating for ${id}`);
|
|
3915
|
+
const pushed =
|
|
3916
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3917
|
+
(await utils.gitCreateBranch(branch, cwd)) && (
|
|
3918
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3919
|
+
await utils.gitCheckoutBranch(branch, cwd)) && (
|
|
3920
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3921
|
+
await utils.gitCommit(`fix: Apply Coana security fix for ${id}`, modifiedFiles, {
|
|
3922
|
+
cwd,
|
|
3923
|
+
email: fixEnv.gitEmail,
|
|
3924
|
+
user: fixEnv.gitUser
|
|
3925
|
+
})) && (
|
|
3926
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3927
|
+
await utils.gitPushBranch(branch, cwd));
|
|
3928
|
+
if (!pushed) {
|
|
3929
|
+
logger.logger.warn(`Push failed for ${id}, skipping PR creation.`);
|
|
3930
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3931
|
+
await utils.gitResetAndClean(fixEnv.baseBranch, cwd);
|
|
3932
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3933
|
+
await utils.gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
3934
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3935
|
+
await utils.gitDeleteBranch(branch, cwd);
|
|
3936
|
+
continue ghsaLoop;
|
|
3937
|
+
}
|
|
3938
|
+
|
|
3939
|
+
// Set up git remote.
|
|
3940
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3941
|
+
await setGitRemoteGithubRepoUrl(fixEnv.repoInfo.owner, fixEnv.repoInfo.repo, fixEnv.githubToken, cwd);
|
|
3942
|
+
|
|
3943
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3944
|
+
const prResponse = await openCoanaPr(fixEnv.repoInfo.owner, fixEnv.repoInfo.repo, branch,
|
|
3945
|
+
// Single GHSA ID.
|
|
3946
|
+
[id], {
|
|
3947
|
+
baseBranch: fixEnv.baseBranch,
|
|
3948
|
+
cwd
|
|
3949
|
+
});
|
|
3950
|
+
if (prResponse) {
|
|
3951
|
+
const {
|
|
3952
|
+
data
|
|
3953
|
+
} = prResponse;
|
|
3954
|
+
const prRef = `PR #${data.number}`;
|
|
3955
|
+
logger.logger.success(`Opened ${prRef} for ${id}.`);
|
|
3956
|
+
if (autoMerge) {
|
|
3957
|
+
logger.logger.indent();
|
|
3958
|
+
spinner?.indent();
|
|
3959
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3960
|
+
const {
|
|
3961
|
+
details,
|
|
3962
|
+
enabled
|
|
3963
|
+
} = await enablePrAutoMerge(data);
|
|
3964
|
+
if (enabled) {
|
|
3965
|
+
logger.logger.info(`Auto-merge enabled for ${prRef}.`);
|
|
3966
|
+
} else {
|
|
3967
|
+
const message = `Failed to enable auto-merge for ${prRef}${details ? `:\n${details.map(d => ` - ${d}`).join('\n')}` : '.'}`;
|
|
3968
|
+
logger.logger.error(message);
|
|
3969
|
+
}
|
|
3970
|
+
logger.logger.dedent();
|
|
3971
|
+
spinner?.dedent();
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
|
|
3975
|
+
// Reset back to base branch for next iteration.
|
|
3976
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3977
|
+
await utils.gitResetAndClean(branch, cwd);
|
|
3978
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3979
|
+
await utils.gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
3980
|
+
} catch (e) {
|
|
3981
|
+
logger.logger.warn(`Unexpected condition: Push failed for ${id}, skipping PR creation.`);
|
|
3982
|
+
require$$8.debugDir('inspect', {
|
|
3983
|
+
error: e
|
|
3984
|
+
});
|
|
3985
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3986
|
+
await utils.gitResetAndClean(fixEnv.baseBranch, cwd);
|
|
3987
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3988
|
+
await utils.gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
3989
|
+
}
|
|
3990
|
+
count += 1;
|
|
3991
|
+
require$$8.debugFn('notice', `Processed ${count}/${Math.min(limit, ids.length)} fixes`);
|
|
3992
|
+
if (count >= limit) {
|
|
3993
|
+
break ghsaLoop;
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
spinner?.stop();
|
|
3997
|
+
return {
|
|
3998
|
+
ok: true,
|
|
3999
|
+
data: {
|
|
4000
|
+
fixed: overallFixed
|
|
4001
|
+
}
|
|
4002
|
+
};
|
|
4003
|
+
}
|
|
4004
|
+
|
|
4005
|
+
function getPrsForPurl(fixEnv, partialPurl) {
|
|
4006
|
+
if (!fixEnv) {
|
|
4007
|
+
return [];
|
|
4008
|
+
}
|
|
4009
|
+
const prs = [];
|
|
4010
|
+
const partialPurlObj = utils.getPurlObject(partialPurl);
|
|
4011
|
+
const branchFullName = getSocketBranchFullNameComponent(partialPurlObj);
|
|
4012
|
+
const branchPurlType = getSocketBranchPurlTypeComponent(partialPurlObj);
|
|
4013
|
+
for (const pr of fixEnv.prs) {
|
|
4014
|
+
const parsedBranch = genericSocketBranchParser(pr.headRefName);
|
|
4015
|
+
if (branchPurlType === parsedBranch?.type && branchFullName === parsedBranch?.fullName) {
|
|
4016
|
+
prs.push(pr);
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
if (require$$8.isDebug('notice,silly')) {
|
|
4020
|
+
const fullName = packages.resolvePackageName(partialPurlObj);
|
|
4021
|
+
if (prs.length) {
|
|
4022
|
+
require$$8.debugFn('notice', `found: ${prs.length} PRs for ${fullName}`);
|
|
4023
|
+
require$$8.debugDir('silly', {
|
|
4024
|
+
prs
|
|
4025
|
+
});
|
|
4026
|
+
} else if (fixEnv.prs.length) {
|
|
4027
|
+
require$$8.debugFn('notice', `miss: 0 PRs found for ${fullName}`);
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
return prs;
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4033
|
+
async function getActualTree(cwd = process.cwd()) {
|
|
4034
|
+
try {
|
|
4035
|
+
// @npmcli/arborist DOES have partial support for pnpm structured node_modules
|
|
4036
|
+
// folders. However, support is iffy resulting in unhappy paths of errors and hangs.
|
|
4037
|
+
// So, to avoid unhappy paths, we restrict our usage to --dry-run loading of the
|
|
4038
|
+
// node_modules folder.
|
|
4039
|
+
const arb = new shadowNpmInject.Arborist({
|
|
4040
|
+
path: cwd,
|
|
4041
|
+
...shadowNpmInject.SAFE_NO_SAVE_ARBORIST_REIFY_OPTIONS_OVERRIDES
|
|
4042
|
+
});
|
|
4043
|
+
return {
|
|
4044
|
+
actualTree: await arb.loadActual()
|
|
4045
|
+
};
|
|
4046
|
+
} catch (e) {
|
|
4047
|
+
return {
|
|
4048
|
+
error: e
|
|
4049
|
+
};
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
|
|
3846
4053
|
const {
|
|
3847
4054
|
BUN: BUN$4,
|
|
3848
4055
|
NPM: NPM$6,
|
|
@@ -4415,7 +4622,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4415
4622
|
};
|
|
4416
4623
|
}
|
|
4417
4624
|
|
|
4418
|
-
const CMD_NAME$
|
|
4625
|
+
const CMD_NAME$s = 'socket fix';
|
|
4419
4626
|
function getFixAlertsMapOptions(options = {}) {
|
|
4420
4627
|
return {
|
|
4421
4628
|
__proto__: null,
|
|
@@ -4854,8 +5061,10 @@ async function handleFix({
|
|
|
4854
5061
|
}) {
|
|
4855
5062
|
if (ghsas.length) {
|
|
4856
5063
|
await outputFixResult(await coanaFix({
|
|
5064
|
+
autoMerge,
|
|
4857
5065
|
cwd,
|
|
4858
5066
|
ghsas,
|
|
5067
|
+
limit,
|
|
4859
5068
|
orgSlug,
|
|
4860
5069
|
spinner,
|
|
4861
5070
|
unknownFlags
|
|
@@ -4863,7 +5072,7 @@ async function handleFix({
|
|
|
4863
5072
|
return;
|
|
4864
5073
|
}
|
|
4865
5074
|
const pkgEnvCResult = await utils.detectAndValidatePackageEnvironment(cwd, {
|
|
4866
|
-
cmdName: CMD_NAME$
|
|
5075
|
+
cmdName: CMD_NAME$s,
|
|
4867
5076
|
logger: logger.logger
|
|
4868
5077
|
});
|
|
4869
5078
|
if (!pkgEnvCResult.ok) {
|
|
@@ -4922,24 +5131,24 @@ async function handleFix({
|
|
|
4922
5131
|
}
|
|
4923
5132
|
|
|
4924
5133
|
const {
|
|
4925
|
-
DRY_RUN_NOT_SAVING
|
|
5134
|
+
DRY_RUN_NOT_SAVING: DRY_RUN_NOT_SAVING$1
|
|
4926
5135
|
} = constants;
|
|
4927
|
-
const CMD_NAME$
|
|
5136
|
+
const CMD_NAME$r = 'fix';
|
|
4928
5137
|
const DEFAULT_LIMIT = 10;
|
|
4929
|
-
const description$
|
|
4930
|
-
const hidden$
|
|
5138
|
+
const description$x = 'Update dependencies with "fixable" Socket alerts';
|
|
5139
|
+
const hidden$q = false;
|
|
4931
5140
|
const cmdFix = {
|
|
4932
|
-
description: description$
|
|
4933
|
-
hidden: hidden$
|
|
4934
|
-
run: run$
|
|
5141
|
+
description: description$x,
|
|
5142
|
+
hidden: hidden$q,
|
|
5143
|
+
run: run$I
|
|
4935
5144
|
};
|
|
4936
|
-
async function run$
|
|
5145
|
+
async function run$I(argv, importMeta, {
|
|
4937
5146
|
parentName
|
|
4938
5147
|
}) {
|
|
4939
5148
|
const config = {
|
|
4940
|
-
commandName: CMD_NAME$
|
|
4941
|
-
description: description$
|
|
4942
|
-
hidden: hidden$
|
|
5149
|
+
commandName: CMD_NAME$r,
|
|
5150
|
+
description: description$x,
|
|
5151
|
+
hidden: hidden$q,
|
|
4943
5152
|
flags: {
|
|
4944
5153
|
...flags.commonFlags,
|
|
4945
5154
|
...flags.outputFlags,
|
|
@@ -5021,7 +5230,7 @@ Available styles:
|
|
|
5021
5230
|
$ ${command} [options] [CWD=.]
|
|
5022
5231
|
|
|
5023
5232
|
API Token Requirements
|
|
5024
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
5233
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$r}`)}
|
|
5025
5234
|
|
|
5026
5235
|
Options
|
|
5027
5236
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -5076,7 +5285,7 @@ Available styles:
|
|
|
5076
5285
|
return;
|
|
5077
5286
|
}
|
|
5078
5287
|
if (dryRun) {
|
|
5079
|
-
logger.logger.log(DRY_RUN_NOT_SAVING);
|
|
5288
|
+
logger.logger.log(DRY_RUN_NOT_SAVING$1);
|
|
5080
5289
|
return;
|
|
5081
5290
|
}
|
|
5082
5291
|
const orgSlugCResult = await utils.getDefaultOrgSlug();
|
|
@@ -5287,9 +5496,9 @@ const config$h = {
|
|
|
5287
5496
|
const cmdInstallCompletion = {
|
|
5288
5497
|
description: config$h.description,
|
|
5289
5498
|
hidden: config$h.hidden,
|
|
5290
|
-
run: run$
|
|
5499
|
+
run: run$H
|
|
5291
5500
|
};
|
|
5292
|
-
async function run$
|
|
5501
|
+
async function run$H(argv, importMeta, {
|
|
5293
5502
|
parentName
|
|
5294
5503
|
}) {
|
|
5295
5504
|
const cli = utils.meowOrExit({
|
|
@@ -5307,9 +5516,9 @@ async function run$G(argv, importMeta, {
|
|
|
5307
5516
|
await handleInstallCompletion(String(targetName));
|
|
5308
5517
|
}
|
|
5309
5518
|
|
|
5310
|
-
const description$
|
|
5519
|
+
const description$w = 'Install Socket CLI tab completion';
|
|
5311
5520
|
const cmdInstall = {
|
|
5312
|
-
description: description$
|
|
5521
|
+
description: description$w,
|
|
5313
5522
|
hidden: false,
|
|
5314
5523
|
async run(argv, importMeta, {
|
|
5315
5524
|
parentName
|
|
@@ -5318,7 +5527,7 @@ const cmdInstall = {
|
|
|
5318
5527
|
completion: cmdInstallCompletion
|
|
5319
5528
|
}, {
|
|
5320
5529
|
argv,
|
|
5321
|
-
description: description$
|
|
5530
|
+
description: description$w,
|
|
5322
5531
|
importMeta,
|
|
5323
5532
|
name: `${parentName} install`
|
|
5324
5533
|
});
|
|
@@ -5370,9 +5579,9 @@ const config$g = {
|
|
|
5370
5579
|
const cmdJson = {
|
|
5371
5580
|
description: config$g.description,
|
|
5372
5581
|
hidden: config$g.hidden,
|
|
5373
|
-
run: run$
|
|
5582
|
+
run: run$G
|
|
5374
5583
|
};
|
|
5375
|
-
async function run$
|
|
5584
|
+
async function run$G(argv, importMeta, {
|
|
5376
5585
|
parentName
|
|
5377
5586
|
}) {
|
|
5378
5587
|
const cli = utils.meowOrExit({
|
|
@@ -5532,21 +5741,21 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
|
|
|
5532
5741
|
const {
|
|
5533
5742
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$D
|
|
5534
5743
|
} = constants;
|
|
5535
|
-
const CMD_NAME$
|
|
5536
|
-
const description$
|
|
5537
|
-
const hidden$
|
|
5744
|
+
const CMD_NAME$q = 'login';
|
|
5745
|
+
const description$v = 'Setup Socket CLI with an API token and defaults';
|
|
5746
|
+
const hidden$p = false;
|
|
5538
5747
|
const cmdLogin = {
|
|
5539
|
-
description: description$
|
|
5540
|
-
hidden: hidden$
|
|
5541
|
-
run: run$
|
|
5748
|
+
description: description$v,
|
|
5749
|
+
hidden: hidden$p,
|
|
5750
|
+
run: run$F
|
|
5542
5751
|
};
|
|
5543
|
-
async function run$
|
|
5752
|
+
async function run$F(argv, importMeta, {
|
|
5544
5753
|
parentName
|
|
5545
5754
|
}) {
|
|
5546
5755
|
const config = {
|
|
5547
|
-
commandName: CMD_NAME$
|
|
5548
|
-
description: description$
|
|
5549
|
-
hidden: hidden$
|
|
5756
|
+
commandName: CMD_NAME$q,
|
|
5757
|
+
description: description$v,
|
|
5758
|
+
hidden: hidden$p,
|
|
5550
5759
|
flags: {
|
|
5551
5760
|
...flags.commonFlags,
|
|
5552
5761
|
apiBaseUrl: {
|
|
@@ -5563,7 +5772,7 @@ async function run$E(argv, importMeta, {
|
|
|
5563
5772
|
$ ${command} [options]
|
|
5564
5773
|
|
|
5565
5774
|
API Token Requirements
|
|
5566
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
5775
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$q}`)}
|
|
5567
5776
|
|
|
5568
5777
|
Logs into the Socket API by prompting for an API token
|
|
5569
5778
|
|
|
@@ -5637,9 +5846,9 @@ const config$f = {
|
|
|
5637
5846
|
const cmdLogout = {
|
|
5638
5847
|
description: config$f.description,
|
|
5639
5848
|
hidden: config$f.hidden,
|
|
5640
|
-
run: run$
|
|
5849
|
+
run: run$E
|
|
5641
5850
|
};
|
|
5642
|
-
async function run$
|
|
5851
|
+
async function run$E(argv, importMeta, {
|
|
5643
5852
|
parentName
|
|
5644
5853
|
}) {
|
|
5645
5854
|
const cli = utils.meowOrExit({
|
|
@@ -5951,9 +6160,9 @@ const config$e = {
|
|
|
5951
6160
|
const cmdManifestCdxgen = {
|
|
5952
6161
|
description: config$e.description,
|
|
5953
6162
|
hidden: config$e.hidden,
|
|
5954
|
-
run: run$
|
|
6163
|
+
run: run$D
|
|
5955
6164
|
};
|
|
5956
|
-
async function run$
|
|
6165
|
+
async function run$D(argv, importMeta, {
|
|
5957
6166
|
parentName
|
|
5958
6167
|
}) {
|
|
5959
6168
|
const cli = utils.meowOrExit({
|
|
@@ -6050,9 +6259,9 @@ const config$d = {
|
|
|
6050
6259
|
const cmdManifestAuto = {
|
|
6051
6260
|
description: config$d.description,
|
|
6052
6261
|
hidden: config$d.hidden,
|
|
6053
|
-
run: run$
|
|
6262
|
+
run: run$C
|
|
6054
6263
|
};
|
|
6055
|
-
async function run$
|
|
6264
|
+
async function run$C(argv, importMeta, {
|
|
6056
6265
|
parentName
|
|
6057
6266
|
}) {
|
|
6058
6267
|
const cli = utils.meowOrExit({
|
|
@@ -6165,9 +6374,9 @@ const config$c = {
|
|
|
6165
6374
|
const cmdManifestConda = {
|
|
6166
6375
|
description: config$c.description,
|
|
6167
6376
|
hidden: config$c.hidden,
|
|
6168
|
-
run: run$
|
|
6377
|
+
run: run$B
|
|
6169
6378
|
};
|
|
6170
|
-
async function run$
|
|
6379
|
+
async function run$B(argv, importMeta, {
|
|
6171
6380
|
parentName
|
|
6172
6381
|
}) {
|
|
6173
6382
|
const cli = utils.meowOrExit({
|
|
@@ -6324,9 +6533,9 @@ const config$b = {
|
|
|
6324
6533
|
const cmdManifestGradle = {
|
|
6325
6534
|
description: config$b.description,
|
|
6326
6535
|
hidden: config$b.hidden,
|
|
6327
|
-
run: run$
|
|
6536
|
+
run: run$A
|
|
6328
6537
|
};
|
|
6329
|
-
async function run$
|
|
6538
|
+
async function run$A(argv, importMeta, {
|
|
6330
6539
|
parentName
|
|
6331
6540
|
}) {
|
|
6332
6541
|
const cli = utils.meowOrExit({
|
|
@@ -6483,9 +6692,9 @@ const config$a = {
|
|
|
6483
6692
|
const cmdManifestKotlin = {
|
|
6484
6693
|
description: config$a.description,
|
|
6485
6694
|
hidden: config$a.hidden,
|
|
6486
|
-
run: run$
|
|
6695
|
+
run: run$z
|
|
6487
6696
|
};
|
|
6488
|
-
async function run$
|
|
6697
|
+
async function run$z(argv, importMeta, {
|
|
6489
6698
|
parentName
|
|
6490
6699
|
}) {
|
|
6491
6700
|
const cli = utils.meowOrExit({
|
|
@@ -6649,9 +6858,9 @@ const config$9 = {
|
|
|
6649
6858
|
const cmdManifestScala = {
|
|
6650
6859
|
description: config$9.description,
|
|
6651
6860
|
hidden: config$9.hidden,
|
|
6652
|
-
run: run$
|
|
6861
|
+
run: run$y
|
|
6653
6862
|
};
|
|
6654
|
-
async function run$
|
|
6863
|
+
async function run$y(argv, importMeta, {
|
|
6655
6864
|
parentName
|
|
6656
6865
|
}) {
|
|
6657
6866
|
const cli = utils.meowOrExit({
|
|
@@ -7213,9 +7422,9 @@ const config$8 = {
|
|
|
7213
7422
|
const cmdManifestSetup = {
|
|
7214
7423
|
description: config$8.description,
|
|
7215
7424
|
hidden: config$8.hidden,
|
|
7216
|
-
run: run$
|
|
7425
|
+
run: run$x
|
|
7217
7426
|
};
|
|
7218
|
-
async function run$
|
|
7427
|
+
async function run$x(argv, importMeta, {
|
|
7219
7428
|
parentName
|
|
7220
7429
|
}) {
|
|
7221
7430
|
const cli = utils.meowOrExit({
|
|
@@ -7249,9 +7458,9 @@ const config$7 = {
|
|
|
7249
7458
|
const cmdManifest = {
|
|
7250
7459
|
description: config$7.description,
|
|
7251
7460
|
hidden: config$7.hidden,
|
|
7252
|
-
run: run$
|
|
7461
|
+
run: run$w
|
|
7253
7462
|
};
|
|
7254
|
-
async function run$
|
|
7463
|
+
async function run$w(argv, importMeta, {
|
|
7255
7464
|
parentName
|
|
7256
7465
|
}) {
|
|
7257
7466
|
await utils.meowWithSubcommands({
|
|
@@ -7282,21 +7491,21 @@ const require$3 = require$$5.createRequire(require('node:url').pathToFileURL(__f
|
|
|
7282
7491
|
const {
|
|
7283
7492
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$u
|
|
7284
7493
|
} = constants;
|
|
7285
|
-
const CMD_NAME$
|
|
7286
|
-
const description$
|
|
7287
|
-
const hidden$
|
|
7494
|
+
const CMD_NAME$p = 'npm';
|
|
7495
|
+
const description$u = 'Run npm with the Socket wrapper';
|
|
7496
|
+
const hidden$o = false;
|
|
7288
7497
|
const cmdNpm = {
|
|
7289
|
-
description: description$
|
|
7290
|
-
hidden: hidden$
|
|
7291
|
-
run: run$
|
|
7498
|
+
description: description$u,
|
|
7499
|
+
hidden: hidden$o,
|
|
7500
|
+
run: run$v
|
|
7292
7501
|
};
|
|
7293
|
-
async function run$
|
|
7502
|
+
async function run$v(argv, importMeta, {
|
|
7294
7503
|
parentName
|
|
7295
7504
|
}) {
|
|
7296
7505
|
const config = {
|
|
7297
|
-
commandName: CMD_NAME$
|
|
7298
|
-
description: description$
|
|
7299
|
-
hidden: hidden$
|
|
7506
|
+
commandName: CMD_NAME$p,
|
|
7507
|
+
description: description$u,
|
|
7508
|
+
hidden: hidden$o,
|
|
7300
7509
|
flags: {
|
|
7301
7510
|
...flags.commonFlags
|
|
7302
7511
|
},
|
|
@@ -7305,7 +7514,7 @@ async function run$u(argv, importMeta, {
|
|
|
7305
7514
|
$ ${command} ...
|
|
7306
7515
|
|
|
7307
7516
|
API Token Requirements
|
|
7308
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
7517
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$p}`)}
|
|
7309
7518
|
|
|
7310
7519
|
Note: Everything after "npm" is passed to the npm command.
|
|
7311
7520
|
Only the \`--dry-run\` and \`--help\` flags are caught here.
|
|
@@ -7338,21 +7547,21 @@ const require$2 = require$$5.createRequire(require('node:url').pathToFileURL(__f
|
|
|
7338
7547
|
const {
|
|
7339
7548
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$t
|
|
7340
7549
|
} = constants;
|
|
7341
|
-
const CMD_NAME$
|
|
7342
|
-
const description$
|
|
7343
|
-
const hidden$
|
|
7550
|
+
const CMD_NAME$o = 'npx';
|
|
7551
|
+
const description$t = 'Run npx with the Socket wrapper';
|
|
7552
|
+
const hidden$n = false;
|
|
7344
7553
|
const cmdNpx = {
|
|
7345
|
-
description: description$
|
|
7346
|
-
hidden: hidden$
|
|
7347
|
-
run: run$
|
|
7554
|
+
description: description$t,
|
|
7555
|
+
hidden: hidden$n,
|
|
7556
|
+
run: run$u
|
|
7348
7557
|
};
|
|
7349
|
-
async function run$
|
|
7558
|
+
async function run$u(argv, importMeta, {
|
|
7350
7559
|
parentName
|
|
7351
7560
|
}) {
|
|
7352
7561
|
const config = {
|
|
7353
|
-
commandName: CMD_NAME$
|
|
7354
|
-
description: description$
|
|
7355
|
-
hidden: hidden$
|
|
7562
|
+
commandName: CMD_NAME$o,
|
|
7563
|
+
description: description$t,
|
|
7564
|
+
hidden: hidden$n,
|
|
7356
7565
|
flags: {
|
|
7357
7566
|
...flags.commonFlags
|
|
7358
7567
|
},
|
|
@@ -7361,7 +7570,7 @@ async function run$t(argv, importMeta, {
|
|
|
7361
7570
|
$ ${command} ...
|
|
7362
7571
|
|
|
7363
7572
|
API Token Requirements
|
|
7364
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
7573
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$o}`)}
|
|
7365
7574
|
|
|
7366
7575
|
Note: Everything after "npx" is passed to the npx command.
|
|
7367
7576
|
Only the \`--dry-run\` and \`--help\` flags are caught here.
|
|
@@ -7415,9 +7624,9 @@ const config$6 = {
|
|
|
7415
7624
|
const cmdOops = {
|
|
7416
7625
|
description: config$6.description,
|
|
7417
7626
|
hidden: config$6.hidden,
|
|
7418
|
-
run: run$
|
|
7627
|
+
run: run$t
|
|
7419
7628
|
};
|
|
7420
|
-
async function run$
|
|
7629
|
+
async function run$t(argv, importMeta, {
|
|
7421
7630
|
parentName
|
|
7422
7631
|
}) {
|
|
7423
7632
|
const cli = utils.meowOrExit({
|
|
@@ -7758,7 +7967,7 @@ async function listPackages(pkgEnvDetails, options) {
|
|
|
7758
7967
|
}
|
|
7759
7968
|
}
|
|
7760
7969
|
|
|
7761
|
-
const CMD_NAME$
|
|
7970
|
+
const CMD_NAME$n = 'socket optimize';
|
|
7762
7971
|
|
|
7763
7972
|
const {
|
|
7764
7973
|
BUN,
|
|
@@ -7933,7 +8142,7 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
7933
8142
|
npmExecPath === NPM && !state.warnedPnpmWorkspaceRequiresNpm) {
|
|
7934
8143
|
state.warnedPnpmWorkspaceRequiresNpm = true;
|
|
7935
8144
|
spinner?.stop();
|
|
7936
|
-
logger?.warn(utils.cmdPrefixMessage(CMD_NAME$
|
|
8145
|
+
logger?.warn(utils.cmdPrefixMessage(CMD_NAME$n, `${agent} workspace support requires \`npm ls\`, falling back to \`${agent} list\``));
|
|
7937
8146
|
spinner?.start();
|
|
7938
8147
|
}
|
|
7939
8148
|
const overridesDataObjects = [];
|
|
@@ -8164,7 +8373,7 @@ async function applyOptimization(pkgEnvDetails, {
|
|
|
8164
8373
|
const pkgJsonChanged = addedCount > 0 || updatedCount > 0;
|
|
8165
8374
|
if (pkgJsonChanged || pkgEnvDetails.features.npmBuggyOverrides) {
|
|
8166
8375
|
const result = await updateLockfile(pkgEnvDetails, {
|
|
8167
|
-
cmdName: CMD_NAME$
|
|
8376
|
+
cmdName: CMD_NAME$n,
|
|
8168
8377
|
logger: logger.logger,
|
|
8169
8378
|
spinner
|
|
8170
8379
|
});
|
|
@@ -8226,7 +8435,7 @@ async function handleOptimize({
|
|
|
8226
8435
|
prod
|
|
8227
8436
|
}) {
|
|
8228
8437
|
const pkgEnvCResult = await utils.detectAndValidatePackageEnvironment(cwd, {
|
|
8229
|
-
cmdName: CMD_NAME$
|
|
8438
|
+
cmdName: CMD_NAME$n,
|
|
8230
8439
|
logger: logger.logger,
|
|
8231
8440
|
prod
|
|
8232
8441
|
});
|
|
@@ -8251,7 +8460,7 @@ async function handleOptimize({
|
|
|
8251
8460
|
await outputOptimizeResult({
|
|
8252
8461
|
ok: false,
|
|
8253
8462
|
message: 'Unsupported',
|
|
8254
|
-
cause: utils.cmdPrefixMessage(CMD_NAME$
|
|
8463
|
+
cause: utils.cmdPrefixMessage(CMD_NAME$n, `${agent} v${agentVersion} does not support overrides.`)
|
|
8255
8464
|
}, outputKind);
|
|
8256
8465
|
return;
|
|
8257
8466
|
}
|
|
@@ -8265,21 +8474,21 @@ async function handleOptimize({
|
|
|
8265
8474
|
const {
|
|
8266
8475
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$r
|
|
8267
8476
|
} = constants;
|
|
8268
|
-
const CMD_NAME$
|
|
8269
|
-
const description$
|
|
8270
|
-
const hidden$
|
|
8477
|
+
const CMD_NAME$m = 'optimize';
|
|
8478
|
+
const description$s = 'Optimize dependencies with @socketregistry overrides';
|
|
8479
|
+
const hidden$m = false;
|
|
8271
8480
|
const cmdOptimize = {
|
|
8272
|
-
description: description$
|
|
8273
|
-
hidden: hidden$
|
|
8274
|
-
run: run$
|
|
8481
|
+
description: description$s,
|
|
8482
|
+
hidden: hidden$m,
|
|
8483
|
+
run: run$s
|
|
8275
8484
|
};
|
|
8276
|
-
async function run$
|
|
8485
|
+
async function run$s(argv, importMeta, {
|
|
8277
8486
|
parentName
|
|
8278
8487
|
}) {
|
|
8279
8488
|
const config = {
|
|
8280
|
-
commandName: CMD_NAME$
|
|
8281
|
-
description: description$
|
|
8282
|
-
hidden: hidden$
|
|
8489
|
+
commandName: CMD_NAME$m,
|
|
8490
|
+
description: description$s,
|
|
8491
|
+
hidden: hidden$m,
|
|
8283
8492
|
flags: {
|
|
8284
8493
|
...flags.commonFlags,
|
|
8285
8494
|
pin: {
|
|
@@ -8298,7 +8507,7 @@ async function run$r(argv, importMeta, {
|
|
|
8298
8507
|
$ ${command} [options] [CWD=.]
|
|
8299
8508
|
|
|
8300
8509
|
API Token Requirements
|
|
8301
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
8510
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$m}`)}
|
|
8302
8511
|
|
|
8303
8512
|
Options
|
|
8304
8513
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -8444,21 +8653,21 @@ async function handleDependencies({
|
|
|
8444
8653
|
const {
|
|
8445
8654
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$q
|
|
8446
8655
|
} = constants;
|
|
8447
|
-
const CMD_NAME$
|
|
8448
|
-
const description$
|
|
8449
|
-
const hidden$
|
|
8656
|
+
const CMD_NAME$l = 'dependencies';
|
|
8657
|
+
const description$r = 'Search for any dependency that is being used in your organization';
|
|
8658
|
+
const hidden$l = false;
|
|
8450
8659
|
const cmdOrganizationDependencies = {
|
|
8451
|
-
description: description$
|
|
8452
|
-
hidden: hidden$
|
|
8453
|
-
run: run$
|
|
8660
|
+
description: description$r,
|
|
8661
|
+
hidden: hidden$l,
|
|
8662
|
+
run: run$r
|
|
8454
8663
|
};
|
|
8455
|
-
async function run$
|
|
8664
|
+
async function run$r(argv, importMeta, {
|
|
8456
8665
|
parentName
|
|
8457
8666
|
}) {
|
|
8458
8667
|
const config = {
|
|
8459
|
-
commandName: CMD_NAME$
|
|
8460
|
-
description: description$
|
|
8461
|
-
hidden: hidden$
|
|
8668
|
+
commandName: CMD_NAME$l,
|
|
8669
|
+
description: description$r,
|
|
8670
|
+
hidden: hidden$l,
|
|
8462
8671
|
flags: {
|
|
8463
8672
|
...flags.commonFlags,
|
|
8464
8673
|
limit: {
|
|
@@ -8478,7 +8687,7 @@ async function run$q(argv, importMeta, {
|
|
|
8478
8687
|
${command} [options]
|
|
8479
8688
|
|
|
8480
8689
|
API Token Requirements
|
|
8481
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
8690
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$l}`)}
|
|
8482
8691
|
|
|
8483
8692
|
Options
|
|
8484
8693
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -8581,21 +8790,21 @@ async function handleLicensePolicy(orgSlug, outputKind) {
|
|
|
8581
8790
|
const {
|
|
8582
8791
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$p
|
|
8583
8792
|
} = constants;
|
|
8584
|
-
const CMD_NAME$
|
|
8585
|
-
const description$
|
|
8586
|
-
const hidden$
|
|
8793
|
+
const CMD_NAME$k = 'license';
|
|
8794
|
+
const description$q = 'Retrieve the license policy of an organization';
|
|
8795
|
+
const hidden$k = false;
|
|
8587
8796
|
const cmdOrganizationPolicyLicense = {
|
|
8588
|
-
description: description$
|
|
8589
|
-
hidden: hidden$
|
|
8590
|
-
run: run$
|
|
8797
|
+
description: description$q,
|
|
8798
|
+
hidden: hidden$k,
|
|
8799
|
+
run: run$q
|
|
8591
8800
|
};
|
|
8592
|
-
async function run$
|
|
8801
|
+
async function run$q(argv, importMeta, {
|
|
8593
8802
|
parentName
|
|
8594
8803
|
}) {
|
|
8595
8804
|
const config = {
|
|
8596
|
-
commandName: CMD_NAME$
|
|
8597
|
-
description: description$
|
|
8598
|
-
hidden: hidden$
|
|
8805
|
+
commandName: CMD_NAME$k,
|
|
8806
|
+
description: description$q,
|
|
8807
|
+
hidden: hidden$k,
|
|
8599
8808
|
flags: {
|
|
8600
8809
|
...flags.commonFlags,
|
|
8601
8810
|
...flags.outputFlags,
|
|
@@ -8614,7 +8823,7 @@ async function run$p(argv, importMeta, {
|
|
|
8614
8823
|
$ ${command} [options]
|
|
8615
8824
|
|
|
8616
8825
|
API Token Requirements
|
|
8617
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
8826
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$k}`)}
|
|
8618
8827
|
|
|
8619
8828
|
Options
|
|
8620
8829
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -8718,21 +8927,21 @@ async function handleSecurityPolicy(orgSlug, outputKind) {
|
|
|
8718
8927
|
const {
|
|
8719
8928
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$o
|
|
8720
8929
|
} = constants;
|
|
8721
|
-
const CMD_NAME$
|
|
8722
|
-
const description$
|
|
8723
|
-
const hidden$
|
|
8930
|
+
const CMD_NAME$j = 'security';
|
|
8931
|
+
const description$p = 'Retrieve the security policy of an organization';
|
|
8932
|
+
const hidden$j = true;
|
|
8724
8933
|
const cmdOrganizationPolicySecurity = {
|
|
8725
|
-
description: description$
|
|
8726
|
-
hidden: hidden$
|
|
8727
|
-
run: run$
|
|
8934
|
+
description: description$p,
|
|
8935
|
+
hidden: hidden$j,
|
|
8936
|
+
run: run$p
|
|
8728
8937
|
};
|
|
8729
|
-
async function run$
|
|
8938
|
+
async function run$p(argv, importMeta, {
|
|
8730
8939
|
parentName
|
|
8731
8940
|
}) {
|
|
8732
8941
|
const config = {
|
|
8733
|
-
commandName: CMD_NAME$
|
|
8734
|
-
description: description$
|
|
8735
|
-
hidden: hidden$
|
|
8942
|
+
commandName: CMD_NAME$j,
|
|
8943
|
+
description: description$p,
|
|
8944
|
+
hidden: hidden$j,
|
|
8736
8945
|
flags: {
|
|
8737
8946
|
...flags.commonFlags,
|
|
8738
8947
|
...flags.outputFlags,
|
|
@@ -8751,7 +8960,7 @@ async function run$o(argv, importMeta, {
|
|
|
8751
8960
|
$ ${command} [options]
|
|
8752
8961
|
|
|
8753
8962
|
API Token Requirements
|
|
8754
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
8963
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$j}`)}
|
|
8755
8964
|
|
|
8756
8965
|
Options
|
|
8757
8966
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -8856,21 +9065,21 @@ async function handleOrganizationList(outputKind = 'text') {
|
|
|
8856
9065
|
const {
|
|
8857
9066
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$n
|
|
8858
9067
|
} = constants;
|
|
8859
|
-
const CMD_NAME$
|
|
8860
|
-
const description$
|
|
8861
|
-
const hidden$
|
|
9068
|
+
const CMD_NAME$i = 'list';
|
|
9069
|
+
const description$o = 'List organizations associated with the Socket API token';
|
|
9070
|
+
const hidden$i = false;
|
|
8862
9071
|
const cmdOrganizationList = {
|
|
8863
|
-
description: description$
|
|
8864
|
-
hidden: hidden$
|
|
8865
|
-
run: run$
|
|
9072
|
+
description: description$o,
|
|
9073
|
+
hidden: hidden$i,
|
|
9074
|
+
run: run$o
|
|
8866
9075
|
};
|
|
8867
|
-
async function run$
|
|
9076
|
+
async function run$o(argv, importMeta, {
|
|
8868
9077
|
parentName
|
|
8869
9078
|
}) {
|
|
8870
9079
|
const config = {
|
|
8871
|
-
commandName: CMD_NAME$
|
|
8872
|
-
description: description$
|
|
8873
|
-
hidden: hidden$
|
|
9080
|
+
commandName: CMD_NAME$i,
|
|
9081
|
+
description: description$o,
|
|
9082
|
+
hidden: hidden$i,
|
|
8874
9083
|
flags: {
|
|
8875
9084
|
...flags.commonFlags,
|
|
8876
9085
|
...flags.outputFlags
|
|
@@ -8880,7 +9089,7 @@ async function run$n(argv, importMeta, {
|
|
|
8880
9089
|
$ ${command} [options]
|
|
8881
9090
|
|
|
8882
9091
|
API Token Requirements
|
|
8883
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
9092
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$i}`)}
|
|
8884
9093
|
|
|
8885
9094
|
Options
|
|
8886
9095
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -8924,9 +9133,9 @@ async function run$n(argv, importMeta, {
|
|
|
8924
9133
|
await handleOrganizationList(outputKind);
|
|
8925
9134
|
}
|
|
8926
9135
|
|
|
8927
|
-
const description$
|
|
9136
|
+
const description$n = 'Organization policy details';
|
|
8928
9137
|
const cmdOrganizationPolicy = {
|
|
8929
|
-
description: description$
|
|
9138
|
+
description: description$n,
|
|
8930
9139
|
// Hidden because it was broken all this time (nobody could be using it)
|
|
8931
9140
|
// and we're not sure if it's useful to anyone in its current state.
|
|
8932
9141
|
// Until we do, we'll hide this to keep the help tidier.
|
|
@@ -8940,7 +9149,7 @@ const cmdOrganizationPolicy = {
|
|
|
8940
9149
|
license: cmdOrganizationPolicyLicense
|
|
8941
9150
|
}, {
|
|
8942
9151
|
argv,
|
|
8943
|
-
description: description$
|
|
9152
|
+
description: description$n,
|
|
8944
9153
|
defaultSub: 'list',
|
|
8945
9154
|
// Backwards compat
|
|
8946
9155
|
importMeta,
|
|
@@ -9020,9 +9229,9 @@ const config$5 = {
|
|
|
9020
9229
|
const cmdOrganizationQuota = {
|
|
9021
9230
|
description: config$5.description,
|
|
9022
9231
|
hidden: config$5.hidden,
|
|
9023
|
-
run: run$
|
|
9232
|
+
run: run$n
|
|
9024
9233
|
};
|
|
9025
|
-
async function run$
|
|
9234
|
+
async function run$n(argv, importMeta, {
|
|
9026
9235
|
parentName
|
|
9027
9236
|
}) {
|
|
9028
9237
|
const cli = utils.meowOrExit({
|
|
@@ -9057,9 +9266,9 @@ async function run$m(argv, importMeta, {
|
|
|
9057
9266
|
await handleQuota(outputKind);
|
|
9058
9267
|
}
|
|
9059
9268
|
|
|
9060
|
-
const description$
|
|
9269
|
+
const description$m = 'Manage Socket organization account details';
|
|
9061
9270
|
const cmdOrganization = {
|
|
9062
|
-
description: description$
|
|
9271
|
+
description: description$m,
|
|
9063
9272
|
hidden: false,
|
|
9064
9273
|
async run(argv, importMeta, {
|
|
9065
9274
|
parentName
|
|
@@ -9088,7 +9297,7 @@ const cmdOrganization = {
|
|
|
9088
9297
|
}
|
|
9089
9298
|
},
|
|
9090
9299
|
argv,
|
|
9091
|
-
description: description$
|
|
9300
|
+
description: description$m,
|
|
9092
9301
|
importMeta,
|
|
9093
9302
|
name: `${parentName} organization`
|
|
9094
9303
|
});
|
|
@@ -9316,21 +9525,21 @@ function parsePackageSpecifiers(ecosystem, pkgs) {
|
|
|
9316
9525
|
const {
|
|
9317
9526
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$l
|
|
9318
9527
|
} = constants;
|
|
9319
|
-
const CMD_NAME$
|
|
9320
|
-
const description$
|
|
9321
|
-
const hidden$
|
|
9528
|
+
const CMD_NAME$h = 'score';
|
|
9529
|
+
const description$l = 'Look up score for one package which reflects all of its transitive dependencies as well';
|
|
9530
|
+
const hidden$h = false;
|
|
9322
9531
|
const cmdPackageScore = {
|
|
9323
|
-
description: description$
|
|
9324
|
-
hidden: hidden$
|
|
9325
|
-
run: run$
|
|
9532
|
+
description: description$l,
|
|
9533
|
+
hidden: hidden$h,
|
|
9534
|
+
run: run$m
|
|
9326
9535
|
};
|
|
9327
|
-
async function run$
|
|
9536
|
+
async function run$m(argv, importMeta, {
|
|
9328
9537
|
parentName
|
|
9329
9538
|
}) {
|
|
9330
9539
|
const config = {
|
|
9331
|
-
commandName: CMD_NAME$
|
|
9332
|
-
description: description$
|
|
9333
|
-
hidden: hidden$
|
|
9540
|
+
commandName: CMD_NAME$h,
|
|
9541
|
+
description: description$l,
|
|
9542
|
+
hidden: hidden$h,
|
|
9334
9543
|
flags: {
|
|
9335
9544
|
...flags.commonFlags,
|
|
9336
9545
|
...flags.outputFlags
|
|
@@ -9340,7 +9549,7 @@ async function run$l(argv, importMeta, {
|
|
|
9340
9549
|
$ ${command} [options] <<ECOSYSTEM> <NAME> | <PURL>>
|
|
9341
9550
|
|
|
9342
9551
|
API Token Requirements
|
|
9343
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
9552
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$h}`)}
|
|
9344
9553
|
|
|
9345
9554
|
Options
|
|
9346
9555
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -9701,28 +9910,28 @@ async function handlePurlsShallowScore({
|
|
|
9701
9910
|
const {
|
|
9702
9911
|
DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$k
|
|
9703
9912
|
} = constants;
|
|
9704
|
-
const CMD_NAME$
|
|
9705
|
-
const description$
|
|
9706
|
-
const hidden$
|
|
9913
|
+
const CMD_NAME$g = 'shallow';
|
|
9914
|
+
const description$k = 'Look up info regarding one or more packages but not their transitives';
|
|
9915
|
+
const hidden$g = false;
|
|
9707
9916
|
const cmdPackageShallow = {
|
|
9708
|
-
description: description$
|
|
9709
|
-
hidden: hidden$
|
|
9917
|
+
description: description$k,
|
|
9918
|
+
hidden: hidden$g,
|
|
9710
9919
|
alias: {
|
|
9711
9920
|
shallowScore: {
|
|
9712
|
-
description: description$
|
|
9921
|
+
description: description$k,
|
|
9713
9922
|
hidden: true,
|
|
9714
9923
|
argv: []
|
|
9715
9924
|
}
|
|
9716
9925
|
},
|
|
9717
|
-
run: run$
|
|
9926
|
+
run: run$l
|
|
9718
9927
|
};
|
|
9719
|
-
async function run$
|
|
9928
|
+
async function run$l(argv, importMeta, {
|
|
9720
9929
|
parentName
|
|
9721
9930
|
}) {
|
|
9722
9931
|
const config = {
|
|
9723
|
-
commandName: CMD_NAME$
|
|
9724
|
-
description: description$
|
|
9725
|
-
hidden: hidden$
|
|
9932
|
+
commandName: CMD_NAME$g,
|
|
9933
|
+
description: description$k,
|
|
9934
|
+
hidden: hidden$g,
|
|
9726
9935
|
flags: {
|
|
9727
9936
|
...flags.commonFlags,
|
|
9728
9937
|
...flags.outputFlags
|
|
@@ -9732,7 +9941,7 @@ async function run$k(argv, importMeta, {
|
|
|
9732
9941
|
$ ${command} [options] <<ECOSYSTEM> <PKGNAME> [<PKGNAME> ...] | <PURL> [<PURL> ...]>
|
|
9733
9942
|
|
|
9734
9943
|
API Token Requirements
|
|
9735
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
9944
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$g}`)}
|
|
9736
9945
|
|
|
9737
9946
|
Options
|
|
9738
9947
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -9806,9 +10015,9 @@ async function run$k(argv, importMeta, {
|
|
|
9806
10015
|
});
|
|
9807
10016
|
}
|
|
9808
10017
|
|
|
9809
|
-
const description$
|
|
10018
|
+
const description$j = 'Look up published package details';
|
|
9810
10019
|
const cmdPackage = {
|
|
9811
|
-
description: description$
|
|
10020
|
+
description: description$j,
|
|
9812
10021
|
hidden: false,
|
|
9813
10022
|
async run(argv, importMeta, {
|
|
9814
10023
|
parentName
|
|
@@ -9819,19 +10028,166 @@ const cmdPackage = {
|
|
|
9819
10028
|
}, {
|
|
9820
10029
|
aliases: {
|
|
9821
10030
|
deep: {
|
|
9822
|
-
description: description$
|
|
10031
|
+
description: description$j,
|
|
9823
10032
|
hidden: true,
|
|
9824
10033
|
argv: ['score']
|
|
9825
10034
|
}
|
|
9826
10035
|
},
|
|
9827
10036
|
argv,
|
|
9828
|
-
description: description$
|
|
10037
|
+
description: description$j,
|
|
9829
10038
|
importMeta,
|
|
9830
10039
|
name: `${parentName} package`
|
|
9831
10040
|
});
|
|
9832
10041
|
}
|
|
9833
10042
|
};
|
|
9834
10043
|
|
|
10044
|
+
async function outputPatchResult(result, outputKind) {
|
|
10045
|
+
if (!result.ok) {
|
|
10046
|
+
process.exitCode = result.code ?? 1;
|
|
10047
|
+
}
|
|
10048
|
+
if (outputKind === 'json') {
|
|
10049
|
+
logger.logger.log(utils.serializeResultJson(result));
|
|
10050
|
+
return;
|
|
10051
|
+
}
|
|
10052
|
+
if (!result.ok) {
|
|
10053
|
+
logger.logger.fail(utils.failMsgWithBadge(result.message, result.cause));
|
|
10054
|
+
return;
|
|
10055
|
+
}
|
|
10056
|
+
const {
|
|
10057
|
+
patchedPackages
|
|
10058
|
+
} = result.data;
|
|
10059
|
+
if (patchedPackages.length > 0) {
|
|
10060
|
+
logger.logger.success(`Successfully processed patches for ${patchedPackages.length} package(s):`);
|
|
10061
|
+
for (const pkg of patchedPackages) {
|
|
10062
|
+
logger.logger.success(pkg);
|
|
10063
|
+
}
|
|
10064
|
+
} else {
|
|
10065
|
+
logger.logger.info('No packages found requiring patches');
|
|
10066
|
+
}
|
|
10067
|
+
logger.logger.log('');
|
|
10068
|
+
logger.logger.success('Patch command completed!');
|
|
10069
|
+
}
|
|
10070
|
+
|
|
10071
|
+
async function handlePatch({
|
|
10072
|
+
outputKind,
|
|
10073
|
+
packages,
|
|
10074
|
+
spinner
|
|
10075
|
+
}) {
|
|
10076
|
+
spinner.start('Analyzing dependencies for security patches...');
|
|
10077
|
+
try {
|
|
10078
|
+
// TODO: Implement actual patch logic
|
|
10079
|
+
// This is a stub implementation
|
|
10080
|
+
const result = {
|
|
10081
|
+
ok: true,
|
|
10082
|
+
data: {
|
|
10083
|
+
patchedPackages: packages.length > 0 ? packages : ['example-package']
|
|
10084
|
+
}
|
|
10085
|
+
};
|
|
10086
|
+
spinner.stop();
|
|
10087
|
+
logger.logger.log('');
|
|
10088
|
+
if (packages.length > 0) {
|
|
10089
|
+
logger.logger.info(`Checking patches for: ${packages.join(', ')}`);
|
|
10090
|
+
} else {
|
|
10091
|
+
logger.logger.info('Scanning all dependencies for available patches');
|
|
10092
|
+
}
|
|
10093
|
+
logger.logger.log('');
|
|
10094
|
+
await outputPatchResult(result, outputKind);
|
|
10095
|
+
} catch (e) {
|
|
10096
|
+
spinner.stop();
|
|
10097
|
+
const result = {
|
|
10098
|
+
ok: false,
|
|
10099
|
+
code: 1,
|
|
10100
|
+
message: 'Failed to apply patches',
|
|
10101
|
+
cause: e?.message || 'Unknown error'
|
|
10102
|
+
};
|
|
10103
|
+
await outputPatchResult(result, outputKind);
|
|
10104
|
+
}
|
|
10105
|
+
}
|
|
10106
|
+
|
|
10107
|
+
const {
|
|
10108
|
+
DRY_RUN_NOT_SAVING
|
|
10109
|
+
} = constants;
|
|
10110
|
+
const CMD_NAME$f = 'patch';
|
|
10111
|
+
const description$i = 'Apply CVE patches to dependencies';
|
|
10112
|
+
const hidden$f = true;
|
|
10113
|
+
const cmdPatch = {
|
|
10114
|
+
description: description$i,
|
|
10115
|
+
hidden: hidden$f,
|
|
10116
|
+
run: run$k
|
|
10117
|
+
};
|
|
10118
|
+
async function run$k(argv, importMeta, {
|
|
10119
|
+
parentName
|
|
10120
|
+
}) {
|
|
10121
|
+
const config = {
|
|
10122
|
+
commandName: CMD_NAME$f,
|
|
10123
|
+
description: description$i,
|
|
10124
|
+
hidden: hidden$f,
|
|
10125
|
+
flags: {
|
|
10126
|
+
...flags.commonFlags,
|
|
10127
|
+
...flags.outputFlags,
|
|
10128
|
+
package: {
|
|
10129
|
+
type: 'string',
|
|
10130
|
+
default: [],
|
|
10131
|
+
description: 'Specify packages to patch, as either a comma separated value or as multiple flags',
|
|
10132
|
+
isMultiple: true,
|
|
10133
|
+
shortFlag: 'p'
|
|
10134
|
+
}
|
|
10135
|
+
},
|
|
10136
|
+
help: (command, config) => `
|
|
10137
|
+
Usage
|
|
10138
|
+
$ ${command} [options] [CWD=.]
|
|
10139
|
+
|
|
10140
|
+
API Token Requirements
|
|
10141
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$f}`)}
|
|
10142
|
+
|
|
10143
|
+
Options
|
|
10144
|
+
${utils.getFlagListOutput(config.flags)}
|
|
10145
|
+
|
|
10146
|
+
Examples
|
|
10147
|
+
$ ${command}
|
|
10148
|
+
$ ${command} --package lodash
|
|
10149
|
+
$ ${command} ./proj/tree --package lodash,react
|
|
10150
|
+
`
|
|
10151
|
+
};
|
|
10152
|
+
const cli = utils.meowOrExit({
|
|
10153
|
+
allowUnknownFlags: false,
|
|
10154
|
+
argv,
|
|
10155
|
+
config,
|
|
10156
|
+
importMeta,
|
|
10157
|
+
parentName
|
|
10158
|
+
});
|
|
10159
|
+
const dryRun = !!cli.flags['dryRun'];
|
|
10160
|
+
const outputKind = utils.getOutputKind(cli.flags['json'], cli.flags['markdown']);
|
|
10161
|
+
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
10162
|
+
nook: true,
|
|
10163
|
+
test: !cli.flags['json'] || !cli.flags['markdown'],
|
|
10164
|
+
message: 'The json and markdown flags cannot be both set, pick one',
|
|
10165
|
+
fail: 'omit one'
|
|
10166
|
+
});
|
|
10167
|
+
if (!wasValidInput) {
|
|
10168
|
+
return;
|
|
10169
|
+
}
|
|
10170
|
+
if (dryRun) {
|
|
10171
|
+
logger.logger.log(DRY_RUN_NOT_SAVING);
|
|
10172
|
+
return;
|
|
10173
|
+
}
|
|
10174
|
+
let [cwd = '.'] = cli.input;
|
|
10175
|
+
// Note: path.resolve vs .join:
|
|
10176
|
+
// If given path is absolute then cwd should not affect it.
|
|
10177
|
+
cwd = path.resolve(process.cwd(), cwd);
|
|
10178
|
+
|
|
10179
|
+
// Lazily access constants.spinner.
|
|
10180
|
+
const {
|
|
10181
|
+
spinner
|
|
10182
|
+
} = constants;
|
|
10183
|
+
const packages = Array.isArray(cli.flags['package']) ? cli.flags['package'].flatMap(p => String(p).split(',')) : String(cli.flags['package'] || '').split(',').filter(Boolean);
|
|
10184
|
+
await handlePatch({
|
|
10185
|
+
outputKind,
|
|
10186
|
+
packages,
|
|
10187
|
+
spinner
|
|
10188
|
+
});
|
|
10189
|
+
}
|
|
10190
|
+
|
|
9835
10191
|
async function runRawNpm(argv) {
|
|
9836
10192
|
const spawnPromise = spawn.spawn(utils.getNpmBinPath(), argv, {
|
|
9837
10193
|
// Lazily access constants.WIN32.
|
|
@@ -12093,7 +12449,7 @@ async function testAndDownloadManifestFile({
|
|
|
12093
12449
|
const supportedFilesCResult = await fetchSupportedScanFileNames();
|
|
12094
12450
|
const supportedFiles = supportedFilesCResult.ok ? supportedFilesCResult.data : undefined;
|
|
12095
12451
|
if (!supportedFiles || !utils.isReportSupportedFile(file, supportedFiles)) {
|
|
12096
|
-
require$$8.debugFn('notice', '
|
|
12452
|
+
require$$8.debugFn('notice', 'skip: not a known pattern');
|
|
12097
12453
|
// Not an error.
|
|
12098
12454
|
return {
|
|
12099
12455
|
ok: true,
|
|
@@ -14934,6 +15290,7 @@ const rootCommands = {
|
|
|
14934
15290
|
optimize: cmdOptimize,
|
|
14935
15291
|
organization: cmdOrganization,
|
|
14936
15292
|
package: cmdPackage,
|
|
15293
|
+
patch: cmdPatch,
|
|
14937
15294
|
'raw-npm': cmdRawNpm,
|
|
14938
15295
|
'raw-npx': cmdRawNpx,
|
|
14939
15296
|
repository: cmdRepository,
|
|
@@ -15103,5 +15460,5 @@ void (async () => {
|
|
|
15103
15460
|
await utils.captureException(e);
|
|
15104
15461
|
}
|
|
15105
15462
|
})();
|
|
15106
|
-
//# debugId=
|
|
15463
|
+
//# debugId=293e0fae-5f8d-4051-915d-b3c213feafed
|
|
15107
15464
|
//# sourceMappingURL=cli.js.map
|