socket 1.0.2 → 1.0.3
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 +39 -23
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/types/commands/fix/handle-fix.d.mts +5 -10
- 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/package/output-purls-shallow-score.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-reach-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/output-scan-reach.d.mts +1 -1
- package/dist/types/commands/scan/output-scan-reach.d.mts.map +1 -1
- package/dist/types/utils/fail-msg-with-badge.d.mts +1 -1
- package/dist/types/utils/fail-msg-with-badge.d.mts.map +1 -1
- package/dist/utils.js +5 -3
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +85080 -79950
- package/package.json +3 -1
- package/dist/types/commands/scan/scan-reachability.d.mts +0 -3
- package/dist/types/commands/scan/scan-reachability.d.mts.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ var fs$1 = require('node:fs');
|
|
|
14
14
|
var path = require('node:path');
|
|
15
15
|
var spawn = require('../external/@socketsecurity/registry/lib/spawn');
|
|
16
16
|
var arrays = require('../external/@socketsecurity/registry/lib/arrays');
|
|
17
|
+
var words = require('../external/@socketsecurity/registry/lib/words');
|
|
17
18
|
var registry = require('../external/@socketsecurity/registry');
|
|
18
19
|
var npm = require('../external/@socketsecurity/registry/lib/npm');
|
|
19
20
|
var packages = require('../external/@socketsecurity/registry/lib/packages');
|
|
@@ -24,7 +25,6 @@ var regexps = require('../external/@socketsecurity/registry/lib/regexps');
|
|
|
24
25
|
var shadowNpmInject = require('./shadow-npm-inject.js');
|
|
25
26
|
var fs$2 = require('../external/@socketsecurity/registry/lib/fs');
|
|
26
27
|
var objects = require('../external/@socketsecurity/registry/lib/objects');
|
|
27
|
-
var words = require('../external/@socketsecurity/registry/lib/words');
|
|
28
28
|
var shadowNpmBin = require('./shadow-npm-bin.js');
|
|
29
29
|
var require$$7 = require('../external/@socketsecurity/registry/lib/promises');
|
|
30
30
|
var require$$1 = require('node:util');
|
|
@@ -4236,9 +4236,24 @@ async function npmFix(pkgEnvDetails, options) {
|
|
|
4236
4236
|
limit: Math.max(limit, openPrs.length)
|
|
4237
4237
|
}));
|
|
4238
4238
|
} else {
|
|
4239
|
+
const npmPath = path.resolve(fs$1.realpathSync(pkgEnvDetails.agentExecPath), '../..');
|
|
4240
|
+
const config = new vendor.libExports$2({
|
|
4241
|
+
argv: [],
|
|
4242
|
+
cwd: process.cwd(),
|
|
4243
|
+
definitions: vendor.definitionsExports.definitions,
|
|
4244
|
+
// Lazily access constants.execPath.
|
|
4245
|
+
execPath: constants.execPath,
|
|
4246
|
+
env: process.env,
|
|
4247
|
+
flatten: vendor.definitionsExports.flatten,
|
|
4248
|
+
npmPath,
|
|
4249
|
+
platform: process.platform,
|
|
4250
|
+
shorthands: vendor.definitionsExports.shorthands
|
|
4251
|
+
});
|
|
4252
|
+
await config.load();
|
|
4239
4253
|
const arb = new shadowNpmInject.Arborist({
|
|
4240
4254
|
path: pkgEnvDetails.pkgPath,
|
|
4241
|
-
...shadowNpmInject.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES
|
|
4255
|
+
...shadowNpmInject.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES,
|
|
4256
|
+
config
|
|
4242
4257
|
});
|
|
4243
4258
|
actualTree = await arb.reify();
|
|
4244
4259
|
// Calling arb.reify() creates the arb.diff object, nulls-out arb.idealTree,
|
|
@@ -4471,7 +4486,7 @@ const {
|
|
|
4471
4486
|
NPM: NPM$7,
|
|
4472
4487
|
PNPM: PNPM$6
|
|
4473
4488
|
} = constants;
|
|
4474
|
-
async function handleFix({
|
|
4489
|
+
async function handleFix(argv, {
|
|
4475
4490
|
autoMerge,
|
|
4476
4491
|
cwd,
|
|
4477
4492
|
ghsas,
|
|
@@ -4490,7 +4505,7 @@ async function handleFix({
|
|
|
4490
4505
|
const {
|
|
4491
4506
|
spinner
|
|
4492
4507
|
} = constants;
|
|
4493
|
-
spinner.start();
|
|
4508
|
+
spinner.start('Fetching GHSA IDs...');
|
|
4494
4509
|
if (ghsasCount === 1 && ghsas[0] === 'auto') {
|
|
4495
4510
|
const autoCResult = await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd], {
|
|
4496
4511
|
cwd,
|
|
@@ -4504,16 +4519,21 @@ async function handleFix({
|
|
|
4504
4519
|
ghsasCount = 0;
|
|
4505
4520
|
}
|
|
4506
4521
|
}
|
|
4507
|
-
spinner.stop();
|
|
4508
4522
|
if (ghsasCount) {
|
|
4509
|
-
spinner.
|
|
4510
|
-
await outputFixResult(await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--apply-fixes-to', ...ghsas], {
|
|
4523
|
+
spinner.info(`Found ${ghsasCount} GHSA ${words.pluralize('ID', ghsasCount)}.`);
|
|
4524
|
+
await outputFixResult(await utils.spawnCoana(['compute-fixes-and-upgrade-purls', cwd, '--apply-fixes-to', ...ghsas, ...argv], {
|
|
4511
4525
|
cwd,
|
|
4512
4526
|
spinner
|
|
4513
4527
|
}), outputKind);
|
|
4514
4528
|
spinner.stop();
|
|
4515
4529
|
return;
|
|
4516
4530
|
}
|
|
4531
|
+
spinner.infoAndStop('No GHSA IDs found.');
|
|
4532
|
+
await outputFixResult({
|
|
4533
|
+
ok: true,
|
|
4534
|
+
data: ''
|
|
4535
|
+
}, outputKind);
|
|
4536
|
+
return;
|
|
4517
4537
|
}
|
|
4518
4538
|
const pkgEnvCResult = await utils.detectAndValidatePackageEnvironment(cwd, {
|
|
4519
4539
|
cmdName: CMD_NAME$1,
|
|
@@ -4529,8 +4549,8 @@ async function handleFix({
|
|
|
4529
4549
|
if (!pkgEnvDetails) {
|
|
4530
4550
|
await outputFixResult({
|
|
4531
4551
|
ok: false,
|
|
4532
|
-
message: 'No package found',
|
|
4533
|
-
cause: `No valid package environment
|
|
4552
|
+
message: 'No package found.',
|
|
4553
|
+
cause: `No valid package environment found for project path: ${cwd}`
|
|
4534
4554
|
}, outputKind);
|
|
4535
4555
|
return;
|
|
4536
4556
|
}
|
|
@@ -4541,7 +4561,7 @@ async function handleFix({
|
|
|
4541
4561
|
if (agent !== NPM$7 && agent !== PNPM$6) {
|
|
4542
4562
|
await outputFixResult({
|
|
4543
4563
|
ok: false,
|
|
4544
|
-
message: 'Not supported',
|
|
4564
|
+
message: 'Not supported.',
|
|
4545
4565
|
cause: `${agent} is not supported by this command at the moment.`
|
|
4546
4566
|
}, outputKind);
|
|
4547
4567
|
return;
|
|
@@ -4691,7 +4711,7 @@ async function run$H(argv, importMeta, {
|
|
|
4691
4711
|
const limit = (cli.flags['limit'] ? parseInt(String(cli.flags['limit'] || ''), 10) : Infinity) || Infinity;
|
|
4692
4712
|
const purls = utils.cmdFlagValueToArray(cli.flags['purl']);
|
|
4693
4713
|
const testScript = String(cli.flags['testScript'] || 'test');
|
|
4694
|
-
await handleFix({
|
|
4714
|
+
await handleFix(argv, {
|
|
4695
4715
|
autoMerge,
|
|
4696
4716
|
cwd,
|
|
4697
4717
|
ghsas,
|
|
@@ -8837,7 +8857,7 @@ function formatReportCard(artifact, color) {
|
|
|
8837
8857
|
};
|
|
8838
8858
|
const alertString = getAlertString(artifact.alerts, !color);
|
|
8839
8859
|
if (!artifact.ecosystem) {
|
|
8840
|
-
|
|
8860
|
+
debug.debugLog('miss: Artifact ecosystem', artifact);
|
|
8841
8861
|
}
|
|
8842
8862
|
const purl = `pkg:${artifact.ecosystem}/${artifact.name}${artifact.version ? '@' + artifact.version : ''}`;
|
|
8843
8863
|
return ['Package: ' + (color ? vendor.yoctocolorsCjsExports.bold(purl) : purl), '', ...Object.entries(scoreResult).map(score => `- ${score[0]}:`.padEnd(20, ' ') + ` ${formatScore(score[1], !color, true)}`), alertString].join('\n');
|
|
@@ -12265,7 +12285,7 @@ async function run$7(argv, importMeta, {
|
|
|
12265
12285
|
await handleOrgScanMetadata(orgSlug, scanId, outputKind);
|
|
12266
12286
|
}
|
|
12267
12287
|
|
|
12268
|
-
async function outputScanReach(result,
|
|
12288
|
+
async function outputScanReach(result, outputKind) {
|
|
12269
12289
|
if (!result.ok) {
|
|
12270
12290
|
process.exitCode = result.code ?? 1;
|
|
12271
12291
|
}
|
|
@@ -12277,29 +12297,25 @@ async function outputScanReach(result, cwd, outputKind) {
|
|
|
12277
12297
|
logger.logger.fail(utils.failMsgWithBadge(result.message, result.cause));
|
|
12278
12298
|
return;
|
|
12279
12299
|
}
|
|
12280
|
-
logger.logger.
|
|
12300
|
+
logger.logger.log('');
|
|
12301
|
+
logger.logger.success('Finished!');
|
|
12281
12302
|
}
|
|
12282
12303
|
|
|
12283
12304
|
const {
|
|
12284
12305
|
DOT_SOCKET_DOT_FACTS_JSON
|
|
12285
12306
|
} = constants;
|
|
12286
|
-
async function
|
|
12307
|
+
async function handleScanReach(argv, cwd, outputKind) {
|
|
12287
12308
|
// Lazily access constants.spinner.
|
|
12288
12309
|
const {
|
|
12289
12310
|
spinner
|
|
12290
12311
|
} = constants;
|
|
12291
|
-
spinner.start();
|
|
12312
|
+
spinner.start('Running reachability scan...');
|
|
12292
12313
|
const result = await utils.spawnCoana(['run', cwd, '--output-dir', cwd, '--socket-mode', DOT_SOCKET_DOT_FACTS_JSON, '--disable-report-submission', ...argv], {
|
|
12293
12314
|
cwd,
|
|
12294
12315
|
spinner
|
|
12295
12316
|
});
|
|
12296
12317
|
spinner.stop();
|
|
12297
|
-
|
|
12298
|
-
}
|
|
12299
|
-
|
|
12300
|
-
async function handleScanReach(argv, cwd, outputKind) {
|
|
12301
|
-
const result = await scanReachability(argv, cwd);
|
|
12302
|
-
await outputScanReach(result, cwd, outputKind);
|
|
12318
|
+
await outputScanReach(result, outputKind);
|
|
12303
12319
|
}
|
|
12304
12320
|
|
|
12305
12321
|
const {
|
|
@@ -14124,5 +14140,5 @@ void (async () => {
|
|
|
14124
14140
|
await utils.captureException(e);
|
|
14125
14141
|
}
|
|
14126
14142
|
})();
|
|
14127
|
-
//# debugId=
|
|
14143
|
+
//# debugId=7eb55598-7509-4018-b34f-5184fd83870f
|
|
14128
14144
|
//# sourceMappingURL=cli.js.map
|