@socketsecurity/cli-with-sentry 1.0.69 → 1.0.71
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 +169 -120
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -0
- package/dist/types/commands/fix/agent-fix.d.mts +3 -0
- package/dist/types/commands/fix/agent-fix.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 +6 -0
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -0
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/npm-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/pnpm-fix.d.mts.map +1 -1
- package/dist/types/utils/pnpm.d.mts.map +1 -1
- package/dist/utils.js +80 -80
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +2835 -493
- package/external/@coana-tech/cli/cli.mjs +657 -586
- package/external/@socketsecurity/registry/external/@socketregistry/packageurl-js.js +1 -1
- package/external/@socketsecurity/registry/external/cacache.js +1976 -295
- package/external/@socketsecurity/registry/external/libnpmpack.js +83273 -78270
- package/external/@socketsecurity/registry/external/npm-package-arg.js +58 -1
- package/external/@socketsecurity/registry/external/pacote.js +15839 -3934
- package/external/@socketsecurity/registry/manifest.json +14 -14
- package/package.json +12 -12
package/dist/cli.js
CHANGED
|
@@ -3002,6 +3002,83 @@ const cmdConfig = {
|
|
|
3002
3002
|
}
|
|
3003
3003
|
};
|
|
3004
3004
|
|
|
3005
|
+
async function coanaFix(fixConfig) {
|
|
3006
|
+
const {
|
|
3007
|
+
ghsas
|
|
3008
|
+
} = fixConfig;
|
|
3009
|
+
if (!ghsas.length) {
|
|
3010
|
+
return {
|
|
3011
|
+
ok: true,
|
|
3012
|
+
data: {
|
|
3013
|
+
fixed: false
|
|
3014
|
+
}
|
|
3015
|
+
};
|
|
3016
|
+
}
|
|
3017
|
+
const {
|
|
3018
|
+
cwd,
|
|
3019
|
+
orgSlug,
|
|
3020
|
+
spinner
|
|
3021
|
+
} = fixConfig;
|
|
3022
|
+
spinner?.start();
|
|
3023
|
+
const sockSdkCResult = await utils.setupSdk();
|
|
3024
|
+
let lastCResult = sockSdkCResult;
|
|
3025
|
+
const sockSdk = sockSdkCResult.ok ? sockSdkCResult.data : undefined;
|
|
3026
|
+
const supportedFilesCResult = sockSdk ? await fetchSupportedScanFileNames() : undefined;
|
|
3027
|
+
if (supportedFilesCResult) {
|
|
3028
|
+
lastCResult = supportedFilesCResult;
|
|
3029
|
+
}
|
|
3030
|
+
const supportedFiles = supportedFilesCResult?.ok ? supportedFilesCResult.data : undefined;
|
|
3031
|
+
const packagePaths = supportedFiles ? await utils.getPackageFilesForScan(['.'], supportedFiles, {
|
|
3032
|
+
cwd
|
|
3033
|
+
}) : [];
|
|
3034
|
+
const uploadCResult = sockSdk ? await utils.handleApiCall(sockSdk?.uploadManifestFiles(orgSlug, packagePaths), {
|
|
3035
|
+
desc: 'upload manifests'
|
|
3036
|
+
}) : undefined;
|
|
3037
|
+
if (uploadCResult) {
|
|
3038
|
+
lastCResult = uploadCResult;
|
|
3039
|
+
}
|
|
3040
|
+
const tarHash = uploadCResult?.ok ? uploadCResult.data.tarHash : '';
|
|
3041
|
+
if (!tarHash) {
|
|
3042
|
+
spinner?.stop();
|
|
3043
|
+
return lastCResult;
|
|
3044
|
+
}
|
|
3045
|
+
const spawnOptions = {
|
|
3046
|
+
cwd,
|
|
3047
|
+
spinner,
|
|
3048
|
+
env: {
|
|
3049
|
+
SOCKET_ORG_SLUG: orgSlug
|
|
3050
|
+
}
|
|
3051
|
+
};
|
|
3052
|
+
let ids = ghsas;
|
|
3053
|
+
if (ids.length === 1 && ids[0] === 'auto') {
|
|
3054
|
+
debug.debugFn('notice', 'resolve: GitHub security alerts.');
|
|
3055
|
+
const foundIdsCResult = tarHash ? await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash], spawnOptions) : undefined;
|
|
3056
|
+
if (foundIdsCResult) {
|
|
3057
|
+
lastCResult = foundIdsCResult;
|
|
3058
|
+
}
|
|
3059
|
+
if (foundIdsCResult?.ok) {
|
|
3060
|
+
ids = utils.cmdFlagValueToArray(/(?<=Vulnerabilities found: )[^\n]+/.exec(foundIdsCResult.data)?.[0]);
|
|
3061
|
+
debug.debugDir('inspect', {
|
|
3062
|
+
GitHubSecurityAlerts: ids
|
|
3063
|
+
});
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3066
|
+
const fixCResult = ids.length ? await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...ids, ...fixConfig.unknownFlags], spawnOptions) : undefined;
|
|
3067
|
+
if (fixCResult) {
|
|
3068
|
+
lastCResult = fixCResult;
|
|
3069
|
+
}
|
|
3070
|
+
spinner?.stop();
|
|
3071
|
+
debug.debugDir('inspect', {
|
|
3072
|
+
lastCResult
|
|
3073
|
+
});
|
|
3074
|
+
return lastCResult.ok ? {
|
|
3075
|
+
ok: true,
|
|
3076
|
+
data: {
|
|
3077
|
+
fixed: true
|
|
3078
|
+
}
|
|
3079
|
+
} : lastCResult;
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3005
3082
|
function formatBranchName(name) {
|
|
3006
3083
|
return name.replace(/[^-a-zA-Z0-9/._-]+/g, '+');
|
|
3007
3084
|
}
|
|
@@ -3775,11 +3852,13 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
3775
3852
|
// Skip to next package.
|
|
3776
3853
|
continue infoEntriesLoop;
|
|
3777
3854
|
}
|
|
3855
|
+
debug.debugDir('inspect', {
|
|
3856
|
+
infos
|
|
3857
|
+
});
|
|
3778
3858
|
const availableVersions = Object.keys(packument.versions);
|
|
3779
3859
|
const prs = getPrsForPurl(fixEnv, infoEntry[0]);
|
|
3780
|
-
const vulnVersions = new Set();
|
|
3781
3860
|
const warningsForAfter = new Set();
|
|
3782
|
-
|
|
3861
|
+
let changed = false;
|
|
3783
3862
|
// eslint-disable-next-line no-unused-labels
|
|
3784
3863
|
for (let j = 0, {
|
|
3785
3864
|
length: length_j
|
|
@@ -3852,7 +3931,6 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
3852
3931
|
});
|
|
3853
3932
|
const newVersionPackument = newVersion ? packument.versions[newVersion] : undefined;
|
|
3854
3933
|
if (!(newVersion && newVersionPackument)) {
|
|
3855
|
-
vulnVersions.add(oldVersion);
|
|
3856
3934
|
warningsForAfter.add(`${oldId} not updated: requires >=${firstPatchedVersionIdentifier}`);
|
|
3857
3935
|
continue infosLoop;
|
|
3858
3936
|
}
|
|
@@ -3916,13 +3994,12 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
3916
3994
|
}
|
|
3917
3995
|
continue infosLoop;
|
|
3918
3996
|
}
|
|
3997
|
+
spinner?.start();
|
|
3919
3998
|
if (!hasAnnouncedWorkspace) {
|
|
3920
3999
|
hasAnnouncedWorkspace = true;
|
|
3921
4000
|
workspaceLogCallCount = logger.logger.logCallCount;
|
|
3922
4001
|
}
|
|
3923
|
-
vulnVersions.add(oldVersion);
|
|
3924
4002
|
const newId = `${name}@${utils.applyRange(refRange, newVersion, rangeStyle)}`;
|
|
3925
|
-
spinner?.start();
|
|
3926
4003
|
spinner?.info(`Installing ${newId} in ${workspace}.`);
|
|
3927
4004
|
let error;
|
|
3928
4005
|
let errored = false;
|
|
@@ -4084,6 +4161,8 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4084
4161
|
message: 'Update failed',
|
|
4085
4162
|
cause: `Update failed for ${oldId} in ${workspace}${error ? '; ' + error : ''}`
|
|
4086
4163
|
};
|
|
4164
|
+
} else {
|
|
4165
|
+
changed = true;
|
|
4087
4166
|
}
|
|
4088
4167
|
debug.debugFn('notice', 'increment: count', count + 1);
|
|
4089
4168
|
if (++count >= limit) {
|
|
@@ -4100,7 +4179,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4100
4179
|
for (const warningText of warningsForAfter) {
|
|
4101
4180
|
logger.logger.warn(warningText);
|
|
4102
4181
|
}
|
|
4103
|
-
if (!
|
|
4182
|
+
if (!changed && !warningsForAfter.size) {
|
|
4104
4183
|
logger.logger.info('No vulnerable versions found.');
|
|
4105
4184
|
}
|
|
4106
4185
|
if (!isLastInfoEntry) {
|
|
@@ -4146,7 +4225,33 @@ async function install$1(pkgEnvDetails, options) {
|
|
|
4146
4225
|
...options
|
|
4147
4226
|
};
|
|
4148
4227
|
const useDebug = debug.isDebug('stdio');
|
|
4149
|
-
const args = [
|
|
4228
|
+
const args = [
|
|
4229
|
+
// If "true", npm does not run scripts specified in package.json files.
|
|
4230
|
+
// Note that commands explicitly intended to run a particular script, such
|
|
4231
|
+
// as `npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run` will
|
|
4232
|
+
// still run their intended script if `ignore-scripts` is set, but they will
|
|
4233
|
+
// not run any pre- or post-scripts.
|
|
4234
|
+
// https://docs.npmjs.com/cli/v11/commands/npm-install#ignore-scripts
|
|
4235
|
+
'--ignore-scripts',
|
|
4236
|
+
// When "true" submit audit reports alongside the current npm command to the
|
|
4237
|
+
// default registry and all registries configured for scopes. See the
|
|
4238
|
+
// documentation for `npm audit` for details on what is submitted.
|
|
4239
|
+
// https://docs.npmjs.com/cli/v11/commands/npm-install#audit
|
|
4240
|
+
'--no-audit',
|
|
4241
|
+
// When "true" displays the message at the end of each `npm install` acknowledging
|
|
4242
|
+
// the number of dependencies looking for funding. See `npm fund` for details.
|
|
4243
|
+
// https://docs.npmjs.com/cli/v11/commands/npm-install#fund
|
|
4244
|
+
'--no-fund',
|
|
4245
|
+
// When set to "true", npm will display a progress bar during time intensive
|
|
4246
|
+
// operations, if `process.stderr` is a TTY. Set to "false" to suppress the
|
|
4247
|
+
// progress bar.
|
|
4248
|
+
// https://docs.npmjs.com/cli/v8/using-npm/config#progress
|
|
4249
|
+
'--no-progress',
|
|
4250
|
+
// What level of logs to report. All logs are written to a debug log, with
|
|
4251
|
+
// the path to that file printed if the execution of a command fails. The
|
|
4252
|
+
// default is "notice".
|
|
4253
|
+
// https://docs.npmjs.com/cli/v8/using-npm/config#loglevel
|
|
4254
|
+
...(useDebug ? [] : ['--silent']), ...(extraArgs ?? [])];
|
|
4150
4255
|
const quotedCmd = `\`${pkgEnvDetails.agent} install ${args.join(' ')}\``;
|
|
4151
4256
|
debug.debugFn('stdio', `spawn: ${quotedCmd}`);
|
|
4152
4257
|
const isSpinning = spinner?.isSpinning;
|
|
@@ -4293,6 +4398,9 @@ async function install(pkgEnvDetails, options) {
|
|
|
4293
4398
|
...options
|
|
4294
4399
|
};
|
|
4295
4400
|
const args = [
|
|
4401
|
+
// Do not execute any scripts defined in the project package.json and its dependencies.
|
|
4402
|
+
// https://pnpm.io/9.x/cli/install#--ignore-scripts
|
|
4403
|
+
'--ignore-scripts',
|
|
4296
4404
|
// Enable pnpm updates to pnpm-lock.yaml in CI environments.
|
|
4297
4405
|
// https://pnpm.io/cli/install#--frozen-lockfile
|
|
4298
4406
|
'--no-frozen-lockfile',
|
|
@@ -4341,9 +4449,7 @@ async function pnpmFix(pkgEnvDetails, fixConfig) {
|
|
|
4341
4449
|
} = fixConfig;
|
|
4342
4450
|
spinner?.start();
|
|
4343
4451
|
let actualTree;
|
|
4344
|
-
let
|
|
4345
|
-
lockSrc
|
|
4346
|
-
} = pkgEnvDetails;
|
|
4452
|
+
let lockSrc = pkgEnvDetails.lockSrc;
|
|
4347
4453
|
let lockfile = utils.parsePnpmLockfile(lockSrc);
|
|
4348
4454
|
// Update pnpm-lock.yaml if its version is older than what the installed pnpm
|
|
4349
4455
|
// produces.
|
|
@@ -4353,10 +4459,9 @@ async function pnpmFix(pkgEnvDetails, fixConfig) {
|
|
|
4353
4459
|
cwd,
|
|
4354
4460
|
spinner
|
|
4355
4461
|
});
|
|
4356
|
-
|
|
4357
|
-
if (
|
|
4462
|
+
lockSrc = maybeActualTree ? await utils.readLockfile(pkgEnvDetails.lockPath) : null;
|
|
4463
|
+
if (lockSrc && maybeActualTree) {
|
|
4358
4464
|
actualTree = maybeActualTree;
|
|
4359
|
-
lockSrc = maybeLockSrc;
|
|
4360
4465
|
lockfile = utils.parsePnpmLockfile(lockSrc);
|
|
4361
4466
|
} else {
|
|
4362
4467
|
lockfile = null;
|
|
@@ -4390,16 +4495,17 @@ async function pnpmFix(pkgEnvDetails, fixConfig) {
|
|
|
4390
4495
|
}
|
|
4391
4496
|
let revertData;
|
|
4392
4497
|
let revertOverrides;
|
|
4393
|
-
let revertOverridesSrc;
|
|
4498
|
+
let revertOverridesSrc = '';
|
|
4394
4499
|
return await agentFix(pkgEnvDetails, actualTree, alertsMap, install, {
|
|
4395
4500
|
async beforeInstall(editablePkgJson, packument, oldVersion, newVersion, vulnerableVersionRange, options) {
|
|
4396
|
-
const isWorkspaceRoot = editablePkgJson.
|
|
4501
|
+
const isWorkspaceRoot = editablePkgJson.filename === pkgEnvDetails.editablePkgJson.filename;
|
|
4397
4502
|
// Get current overrides for revert logic.
|
|
4398
4503
|
const {
|
|
4399
4504
|
overrides: oldOverrides
|
|
4400
4505
|
} = getOverridesDataPnpm(pkgEnvDetails, editablePkgJson.content);
|
|
4401
4506
|
const oldPnpmSection = editablePkgJson.content[PNPM$6];
|
|
4402
4507
|
const overrideKey = `${packument.name}@${vulnerableVersionRange}`;
|
|
4508
|
+
lockSrc = await utils.readLockfile(pkgEnvDetails.lockPath);
|
|
4403
4509
|
revertOverrides = undefined;
|
|
4404
4510
|
revertOverridesSrc = utils.extractOverridesFromPnpmLockSrc(lockSrc);
|
|
4405
4511
|
if (isWorkspaceRoot) {
|
|
@@ -4452,8 +4558,9 @@ async function pnpmFix(pkgEnvDetails, fixConfig) {
|
|
|
4452
4558
|
await editablePkgJson.save({
|
|
4453
4559
|
ignoreWhitespace: true
|
|
4454
4560
|
});
|
|
4561
|
+
lockSrc = await utils.readLockfile(pkgEnvDetails.lockPath);
|
|
4455
4562
|
const updatedOverridesContent = utils.extractOverridesFromPnpmLockSrc(lockSrc);
|
|
4456
|
-
if (updatedOverridesContent
|
|
4563
|
+
if (updatedOverridesContent) {
|
|
4457
4564
|
lockSrc = lockSrc.replace(updatedOverridesContent, revertOverridesSrc);
|
|
4458
4565
|
await fs$1.promises.writeFile(pkgEnvDetails.lockPath, lockSrc, 'utf8');
|
|
4459
4566
|
}
|
|
@@ -4482,70 +4589,14 @@ async function handleFix({
|
|
|
4482
4589
|
testScript,
|
|
4483
4590
|
unknownFlags
|
|
4484
4591
|
}) {
|
|
4485
|
-
if (ghsas.length
|
|
4486
|
-
|
|
4487
|
-
const sockSdkCResult = await utils.setupSdk();
|
|
4488
|
-
lastCResult = sockSdkCResult;
|
|
4489
|
-
const sockSdk = sockSdkCResult.ok ? sockSdkCResult.data : undefined;
|
|
4490
|
-
const supportedFilesCResult = sockSdk ? await fetchSupportedScanFileNames() : undefined;
|
|
4491
|
-
if (supportedFilesCResult) {
|
|
4492
|
-
lastCResult = supportedFilesCResult;
|
|
4493
|
-
}
|
|
4494
|
-
const supportedFiles = supportedFilesCResult?.ok ? supportedFilesCResult.data : undefined;
|
|
4495
|
-
const packagePaths = supportedFiles ? await utils.getPackageFilesForScan(['.'], supportedFiles, {
|
|
4496
|
-
cwd
|
|
4497
|
-
}) : [];
|
|
4498
|
-
const uploadCResult = sockSdk ? await utils.handleApiCall(sockSdk?.uploadManifestFiles(orgSlug, packagePaths), {
|
|
4499
|
-
desc: 'upload manifests'
|
|
4500
|
-
}) : undefined;
|
|
4501
|
-
if (uploadCResult) {
|
|
4502
|
-
lastCResult = uploadCResult;
|
|
4503
|
-
}
|
|
4504
|
-
const tarHash = uploadCResult?.ok ? uploadCResult.data.tarHash : '';
|
|
4505
|
-
const idsOutputCResult = tarHash ? await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash], {
|
|
4506
|
-
cwd,
|
|
4507
|
-
spinner,
|
|
4508
|
-
env: {
|
|
4509
|
-
SOCKET_ORG_SLUG: orgSlug
|
|
4510
|
-
}
|
|
4511
|
-
}) : undefined;
|
|
4512
|
-
if (idsOutputCResult) {
|
|
4513
|
-
lastCResult = idsOutputCResult;
|
|
4514
|
-
}
|
|
4515
|
-
const idsOutput = idsOutputCResult?.ok ? idsOutputCResult.data : '';
|
|
4516
|
-
const ids = utils.cmdFlagValueToArray(/(?<=Vulnerabilities found: )[^\n]+/.exec(idsOutput)?.[0]);
|
|
4517
|
-
const fixCResult = ids.length ? await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...ids, ...unknownFlags], {
|
|
4592
|
+
if (ghsas.length) {
|
|
4593
|
+
await outputFixResult(await coanaFix({
|
|
4518
4594
|
cwd,
|
|
4595
|
+
ghsas,
|
|
4596
|
+
orgSlug,
|
|
4519
4597
|
spinner,
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
}
|
|
4523
|
-
}) : undefined;
|
|
4524
|
-
if (fixCResult) {
|
|
4525
|
-
lastCResult = fixCResult;
|
|
4526
|
-
}
|
|
4527
|
-
// const fixCResult = await spawnCoana(
|
|
4528
|
-
// [
|
|
4529
|
-
// cwd,
|
|
4530
|
-
// '--socket-mode',
|
|
4531
|
-
// DOT_SOCKET_DOT_FACTS_JSON,
|
|
4532
|
-
// '--manifests-tar-hash',
|
|
4533
|
-
// tarHash,
|
|
4534
|
-
// ...unknownFlags,
|
|
4535
|
-
// ],
|
|
4536
|
-
// { cwd, spinner, env: { SOCKET_ORG_SLUG: orgSlug } },
|
|
4537
|
-
// )
|
|
4538
|
-
debug.debugDir('inspect', {
|
|
4539
|
-
lastCResult
|
|
4540
|
-
});
|
|
4541
|
-
if (!lastCResult.ok) {
|
|
4542
|
-
await outputFixResult(lastCResult, outputKind);
|
|
4543
|
-
return;
|
|
4544
|
-
}
|
|
4545
|
-
await outputFixResult({
|
|
4546
|
-
ok: true,
|
|
4547
|
-
data: ''
|
|
4548
|
-
}, outputKind);
|
|
4598
|
+
unknownFlags
|
|
4599
|
+
}), outputKind);
|
|
4549
4600
|
return;
|
|
4550
4601
|
}
|
|
4551
4602
|
const pkgEnvCResult = await utils.detectAndValidatePackageEnvironment(cwd, {
|
|
@@ -4590,14 +4641,17 @@ async function handleFix({
|
|
|
4590
4641
|
await outputFixResult(await fixer(pkgEnvDetails, {
|
|
4591
4642
|
autoMerge,
|
|
4592
4643
|
cwd,
|
|
4644
|
+
ghsas,
|
|
4593
4645
|
limit,
|
|
4594
4646
|
minSatisfying,
|
|
4647
|
+
orgSlug,
|
|
4595
4648
|
prCheck,
|
|
4596
4649
|
purls,
|
|
4597
4650
|
rangeStyle,
|
|
4598
4651
|
spinner,
|
|
4599
4652
|
test,
|
|
4600
|
-
testScript
|
|
4653
|
+
testScript,
|
|
4654
|
+
unknownFlags
|
|
4601
4655
|
}), outputKind);
|
|
4602
4656
|
}
|
|
4603
4657
|
|
|
@@ -4709,16 +4763,29 @@ async function run$H(argv, importMeta, {
|
|
|
4709
4763
|
importMeta,
|
|
4710
4764
|
parentName
|
|
4711
4765
|
});
|
|
4712
|
-
const
|
|
4713
|
-
autopilot,
|
|
4714
|
-
json,
|
|
4715
|
-
markdown
|
|
4716
|
-
} = cli.flags;
|
|
4717
|
-
const outputKind = utils.getOutputKind(json, markdown);
|
|
4766
|
+
const outputKind = utils.getOutputKind(cli.flags['json'], cli.flags['markdown']);
|
|
4718
4767
|
let rangeStyle = cli.flags['rangeStyle'];
|
|
4719
4768
|
if (!rangeStyle) {
|
|
4720
4769
|
rangeStyle = 'preserve';
|
|
4721
4770
|
}
|
|
4771
|
+
const rawPurls = utils.cmdFlagValueToArray(cli.flags['purl']);
|
|
4772
|
+
const purls = [];
|
|
4773
|
+
for (const purl of rawPurls) {
|
|
4774
|
+
let version;
|
|
4775
|
+
try {
|
|
4776
|
+
version = vendor.packageurlJsExports$1.PackageURL.fromString(purl)?.version;
|
|
4777
|
+
} catch {}
|
|
4778
|
+
if (version) {
|
|
4779
|
+
purls.push(purl);
|
|
4780
|
+
} else {
|
|
4781
|
+
logger.logger.warn(`--purl ${purl} is missing a version and will be ignored.`);
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
if (rawPurls.length !== purls.length && !purls.length) {
|
|
4785
|
+
process.exitCode = 1;
|
|
4786
|
+
logger.logger.fail('No valid --purl values provided.');
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4722
4789
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
4723
4790
|
test: utils.RangeStyles.includes(rangeStyle),
|
|
4724
4791
|
message: `Expecting range style of ${arrays.joinOr(utils.RangeStyles)}`,
|
|
@@ -4732,49 +4799,31 @@ async function run$H(argv, importMeta, {
|
|
|
4732
4799
|
logger.logger.log(DRY_RUN_NOT_SAVING);
|
|
4733
4800
|
return;
|
|
4734
4801
|
}
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
} = cli;
|
|
4802
|
+
const orgSlugCResult = await utils.getDefaultOrgSlug();
|
|
4803
|
+
if (!orgSlugCResult.ok) {
|
|
4804
|
+
process.exitCode = orgSlugCResult.code ?? 1;
|
|
4805
|
+
logger.logger.fail('Unable to resolve a Socket account organization.\nEnsure a Socket API token is specified for the organization using the SOCKET_CLI_API_TOKEN environment variable.');
|
|
4806
|
+
return;
|
|
4807
|
+
}
|
|
4808
|
+
const orgSlug = orgSlugCResult.data;
|
|
4743
4809
|
let [cwd = '.'] = cli.input;
|
|
4744
4810
|
// Note: path.resolve vs .join:
|
|
4745
4811
|
// If given path is absolute then cwd should not affect it.
|
|
4746
4812
|
cwd = path.resolve(process.cwd(), cwd);
|
|
4747
4813
|
let autoMerge = Boolean(cli.flags['autoMerge']);
|
|
4748
4814
|
let test = Boolean(cli.flags['test']);
|
|
4749
|
-
if (autopilot) {
|
|
4815
|
+
if (cli.flags['autopilot']) {
|
|
4750
4816
|
autoMerge = true;
|
|
4751
4817
|
test = true;
|
|
4752
4818
|
}
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
const
|
|
4761
|
-
const purls = [];
|
|
4762
|
-
for (const purl of rawPurls) {
|
|
4763
|
-
let version;
|
|
4764
|
-
try {
|
|
4765
|
-
version = vendor.packageurlJsExports$1.PackageURL.fromString(purl)?.version;
|
|
4766
|
-
} catch {}
|
|
4767
|
-
if (version) {
|
|
4768
|
-
purls.push(purl);
|
|
4769
|
-
} else {
|
|
4770
|
-
logger.logger.warn(`--purl ${purl} is missing a version and will be ignored.`);
|
|
4771
|
-
}
|
|
4772
|
-
}
|
|
4773
|
-
if (rawPurls.length !== purls.length && !purls.length) {
|
|
4774
|
-
process.exitCode = 1;
|
|
4775
|
-
logger.logger.fail('No valid --purl values provided.');
|
|
4776
|
-
return;
|
|
4777
|
-
}
|
|
4819
|
+
|
|
4820
|
+
// Lazily access constants.spinner.
|
|
4821
|
+
const {
|
|
4822
|
+
spinner
|
|
4823
|
+
} = constants;
|
|
4824
|
+
// We patched in this feature with `npx custompatch meow` at
|
|
4825
|
+
// socket-cli/patches/meow#13.2.0.patch.
|
|
4826
|
+
const unknownFlags = cli.unknownFlags ?? [];
|
|
4778
4827
|
const ghsas = utils.cmdFlagValueToArray(cli.flags['ghsa']);
|
|
4779
4828
|
const limit = (cli.flags['limit'] ? parseInt(String(cli.flags['limit'] || ''), 10) : Infinity) || Infinity;
|
|
4780
4829
|
const maxSatisfying = Boolean(cli.flags['maxSatisfying']);
|
|
@@ -14545,5 +14594,5 @@ void (async () => {
|
|
|
14545
14594
|
await utils.captureException(e);
|
|
14546
14595
|
}
|
|
14547
14596
|
})();
|
|
14548
|
-
//# debugId=
|
|
14597
|
+
//# debugId=6e0fd7c6-a2c8-49d0-90ec-61ff85e89df9
|
|
14549
14598
|
//# sourceMappingURL=cli.js.map
|