@socketsecurity/cli 0.14.40 → 0.14.42
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/constants.d.ts +17 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/module-sync/cli.js +105 -164
- package/dist/module-sync/npm-injection.js +238 -309
- package/dist/module-sync/npm-paths.d.ts +14 -0
- package/dist/module-sync/{path-resolve.js → npm-paths.js} +149 -21
- package/dist/module-sync/path-resolve.d.ts +4 -5
- package/dist/module-sync/settings.d.ts +6 -1
- package/dist/module-sync/shadow-bin.js +9 -13
- package/dist/module-sync/socket-url.d.ts +17 -1
- package/dist/module-sync/socket-url.js +85 -6
- package/dist/require/cli.js +105 -164
- package/dist/require/npm-paths.js +3 -0
- package/dist/require/vendor.js +4 -16
- package/package.json +29 -21
- package/dist/require/path-resolve.js +0 -3
package/dist/require/cli.js
CHANGED
|
@@ -24,13 +24,12 @@ var constants = require('./constants.js');
|
|
|
24
24
|
var spinner = require('@socketsecurity/registry/lib/spinner');
|
|
25
25
|
var spawn = _socketInterop(require('@npmcli/promise-spawn'));
|
|
26
26
|
var objects = require('@socketsecurity/registry/lib/objects');
|
|
27
|
-
var
|
|
27
|
+
var npmPaths = require('./npm-paths.js');
|
|
28
28
|
var registryConstants = require('@socketsecurity/registry/lib/constants');
|
|
29
29
|
var socketUrl = require('./socket-url.js');
|
|
30
30
|
var terminalLink = _socketInterop(require('terminal-link'));
|
|
31
31
|
var isInteractive = require('@socketregistry/is-interactive/index.cjs');
|
|
32
32
|
var prompts = require('@socketsecurity/registry/lib/prompts');
|
|
33
|
-
var fs$1 = require('node:fs/promises');
|
|
34
33
|
var npa = _socketInterop(require('npm-package-arg'));
|
|
35
34
|
var semver = _socketInterop(require('semver'));
|
|
36
35
|
var tinyglobby = _socketInterop(require('tinyglobby'));
|
|
@@ -43,12 +42,14 @@ var strings = require('@socketsecurity/registry/lib/strings');
|
|
|
43
42
|
var browserslist = _socketInterop(require('browserslist'));
|
|
44
43
|
var which = _socketInterop(require('which'));
|
|
45
44
|
var index_cjs = require('@socketregistry/hyrious__bun.lockb/index.cjs');
|
|
45
|
+
var sorts = require('@socketsecurity/registry/lib/sorts');
|
|
46
46
|
var betterAjvErrors = _socketInterop(require('@apideck/better-ajv-errors'));
|
|
47
47
|
var config = require('@socketsecurity/config');
|
|
48
48
|
var os = require('node:os');
|
|
49
49
|
var readline = require('node:readline');
|
|
50
50
|
var readline$1 = require('node:readline/promises');
|
|
51
51
|
var chalkTable = _socketInterop(require('chalk-table'));
|
|
52
|
+
var fs$1 = require('node:fs/promises');
|
|
52
53
|
var ScreenWidget = _socketInterop(require('blessed/lib/widgets/screen'));
|
|
53
54
|
var GridLayout = _socketInterop(require('blessed-contrib/lib/layout/grid'));
|
|
54
55
|
var BarChart = _socketInterop(require('blessed-contrib/lib/widget/charts/bar'));
|
|
@@ -222,24 +223,30 @@ const {
|
|
|
222
223
|
} = constants;
|
|
223
224
|
function shadowNpmInstall(opts) {
|
|
224
225
|
const {
|
|
225
|
-
flags = [],
|
|
226
|
+
flags: flags_ = [],
|
|
226
227
|
ipc,
|
|
227
228
|
...spawnOptions
|
|
228
229
|
} = {
|
|
229
230
|
__proto__: null,
|
|
230
231
|
...opts
|
|
231
232
|
};
|
|
233
|
+
const flags = flags_.filter(f => f !== '--audit' && f !== '--fund' && f !== '--progress' && f !== '--no-audit' && f !== '--no-fund' && f !== '--no-progress');
|
|
232
234
|
const useIpc = objects.isObject(ipc);
|
|
233
|
-
const useDebug =
|
|
234
|
-
const
|
|
235
|
+
const useDebug = npmPaths.isDebug();
|
|
236
|
+
const spawnPromise = spawn(
|
|
235
237
|
// Lazily access constants.execPath.
|
|
236
238
|
constants.execPath, [
|
|
237
|
-
// Lazily access constants.
|
|
238
|
-
|
|
239
|
-
//
|
|
240
|
-
|
|
241
|
-
//
|
|
242
|
-
|
|
239
|
+
// Lazily access constants.nodeNoWarningsFlags.
|
|
240
|
+
...constants.nodeNoWarningsFlags, '--require',
|
|
241
|
+
// Lazily access constants.distPath.
|
|
242
|
+
path.join(constants.distPath, 'npm-injection.js'), npmPaths.getNpmBinPath(), 'install',
|
|
243
|
+
// Even though the '--silent' flag is passed npm will still run through
|
|
244
|
+
// code paths for 'audit' and 'fund' unless '--no-audit' and '--no-fund'
|
|
245
|
+
// flags are passed.
|
|
246
|
+
'--no-audit', '--no-fund',
|
|
247
|
+
// Add `--no-progress` flags to fix input being swallowed by the spinner
|
|
248
|
+
// when running the command with recent versions of npm.
|
|
249
|
+
'--no-progress', ...(useDebug || flags.some(f => f.startsWith('--loglevel') || f === '-d' || f === '--dd' || f === '--ddd' || f === '-q' || f === '--quiet' || f === '-s' || f === '--silent') ? [] : ['--silent']), ...flags], {
|
|
243
250
|
signal: abortSignal$3,
|
|
244
251
|
// Set stdio to include 'ipc'.
|
|
245
252
|
// See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166
|
|
@@ -256,9 +263,9 @@ function shadowNpmInstall(opts) {
|
|
|
256
263
|
}
|
|
257
264
|
});
|
|
258
265
|
if (useIpc) {
|
|
259
|
-
|
|
266
|
+
spawnPromise.process.send(ipc);
|
|
260
267
|
}
|
|
261
|
-
return
|
|
268
|
+
return spawnPromise;
|
|
262
269
|
}
|
|
263
270
|
|
|
264
271
|
const {
|
|
@@ -333,47 +340,6 @@ const validationFlags = {
|
|
|
333
340
|
}
|
|
334
341
|
};
|
|
335
342
|
|
|
336
|
-
const {
|
|
337
|
-
API_V0_URL
|
|
338
|
-
} = constants;
|
|
339
|
-
function handleUnsuccessfulApiResponse(_name, result, spinner) {
|
|
340
|
-
// SocketSdkErrorType['error'] is not typed.
|
|
341
|
-
const resultErrorMessage = result.error?.message;
|
|
342
|
-
const message = typeof resultErrorMessage === 'string' ? resultErrorMessage : 'No error message returned';
|
|
343
|
-
if (result.status === 401 || result.status === 403) {
|
|
344
|
-
spinner.stop();
|
|
345
|
-
throw new socketUrl.AuthError(message);
|
|
346
|
-
}
|
|
347
|
-
spinner.error(`${colors.bgRed(colors.white('API returned an error:'))} ${message}`);
|
|
348
|
-
process$1.exit(1);
|
|
349
|
-
}
|
|
350
|
-
async function handleApiCall(value, description) {
|
|
351
|
-
let result;
|
|
352
|
-
try {
|
|
353
|
-
result = await value;
|
|
354
|
-
} catch (cause) {
|
|
355
|
-
throw new ponyCause.ErrorWithCause(`Failed ${description}`, {
|
|
356
|
-
cause
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
return result;
|
|
360
|
-
}
|
|
361
|
-
async function handleAPIError(code) {
|
|
362
|
-
if (code === 400) {
|
|
363
|
-
return 'One of the options passed might be incorrect.';
|
|
364
|
-
} else if (code === 403) {
|
|
365
|
-
return 'You might be trying to access an organization that is not linked to the API key you are logged in with.';
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
async function queryAPI(path, apiKey) {
|
|
369
|
-
return await fetch(`${API_V0_URL}/${path}`, {
|
|
370
|
-
method: 'GET',
|
|
371
|
-
headers: {
|
|
372
|
-
Authorization: `Basic ${btoa(`${apiKey}:${apiKey}`)}`
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
|
|
377
343
|
function objectSome(obj) {
|
|
378
344
|
for (const key in obj) {
|
|
379
345
|
if (obj[key]) {
|
|
@@ -390,31 +356,6 @@ function pick(input, keys) {
|
|
|
390
356
|
return result;
|
|
391
357
|
}
|
|
392
358
|
|
|
393
|
-
function getFlagListOutput(list, indent, {
|
|
394
|
-
keyPrefix = '--',
|
|
395
|
-
padName
|
|
396
|
-
} = {}) {
|
|
397
|
-
return getHelpListOutput({
|
|
398
|
-
...list
|
|
399
|
-
}, indent, {
|
|
400
|
-
keyPrefix,
|
|
401
|
-
padName
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
function getHelpListOutput(list, indent, {
|
|
405
|
-
keyPrefix = '',
|
|
406
|
-
padName = 18
|
|
407
|
-
} = {}) {
|
|
408
|
-
let result = '';
|
|
409
|
-
const names = Object.keys(list).sort();
|
|
410
|
-
for (const name of names) {
|
|
411
|
-
const rawDescription = list[name];
|
|
412
|
-
const description = (typeof rawDescription === 'object' ? rawDescription.description : rawDescription) || '';
|
|
413
|
-
result += ''.padEnd(indent) + (keyPrefix + name).padEnd(padName) + description + '\n';
|
|
414
|
-
}
|
|
415
|
-
return result.trim();
|
|
416
|
-
}
|
|
417
|
-
|
|
418
359
|
function stringJoinWithSeparateFinalSeparator(list, separator = ' and ') {
|
|
419
360
|
const values = list.filter(Boolean);
|
|
420
361
|
const {
|
|
@@ -430,6 +371,7 @@ function stringJoinWithSeparateFinalSeparator(list, separator = ' and ') {
|
|
|
430
371
|
return `${values.join(', ')}${separator}${finalValue}`;
|
|
431
372
|
}
|
|
432
373
|
|
|
374
|
+
// Ordered from most severe to least.
|
|
433
375
|
const SEVERITIES_BY_ORDER = ['critical', 'high', 'middle', 'low'];
|
|
434
376
|
function getDesiredSeverities(lowestToInclude) {
|
|
435
377
|
const result = [];
|
|
@@ -471,6 +413,72 @@ function getSeverityCount(issues, lowestToInclude) {
|
|
|
471
413
|
return severityCount;
|
|
472
414
|
}
|
|
473
415
|
|
|
416
|
+
const {
|
|
417
|
+
API_V0_URL
|
|
418
|
+
} = constants;
|
|
419
|
+
function handleUnsuccessfulApiResponse(_name, result, spinner) {
|
|
420
|
+
// SocketSdkErrorType['error'] is not typed.
|
|
421
|
+
const resultErrorMessage = result.error?.message;
|
|
422
|
+
const message = typeof resultErrorMessage === 'string' ? resultErrorMessage : 'No error message returned';
|
|
423
|
+
if (result.status === 401 || result.status === 403) {
|
|
424
|
+
spinner.stop();
|
|
425
|
+
throw new socketUrl.AuthError(message);
|
|
426
|
+
}
|
|
427
|
+
spinner.error(`${colors.bgRed(colors.white('API returned an error:'))} ${message}`);
|
|
428
|
+
process$1.exit(1);
|
|
429
|
+
}
|
|
430
|
+
async function handleApiCall(value, description) {
|
|
431
|
+
let result;
|
|
432
|
+
try {
|
|
433
|
+
result = await value;
|
|
434
|
+
} catch (cause) {
|
|
435
|
+
throw new ponyCause.ErrorWithCause(`Failed ${description}`, {
|
|
436
|
+
cause
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
return result;
|
|
440
|
+
}
|
|
441
|
+
async function handleAPIError(code) {
|
|
442
|
+
if (code === 400) {
|
|
443
|
+
return 'One of the options passed might be incorrect.';
|
|
444
|
+
} else if (code === 403) {
|
|
445
|
+
return 'You might be trying to access an organization that is not linked to the API key you are logged in with.';
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
async function queryAPI(path, apiKey) {
|
|
449
|
+
return await fetch(`${API_V0_URL}/${path}`, {
|
|
450
|
+
method: 'GET',
|
|
451
|
+
headers: {
|
|
452
|
+
Authorization: `Basic ${btoa(`${apiKey}:${apiKey}`)}`
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function getFlagListOutput(list, indent, {
|
|
458
|
+
keyPrefix = '--',
|
|
459
|
+
padName
|
|
460
|
+
} = {}) {
|
|
461
|
+
return getHelpListOutput({
|
|
462
|
+
...list
|
|
463
|
+
}, indent, {
|
|
464
|
+
keyPrefix,
|
|
465
|
+
padName
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
function getHelpListOutput(list, indent, {
|
|
469
|
+
keyPrefix = '',
|
|
470
|
+
padName = 18
|
|
471
|
+
} = {}) {
|
|
472
|
+
let result = '';
|
|
473
|
+
const names = Object.keys(list).sort();
|
|
474
|
+
for (const name of names) {
|
|
475
|
+
const rawDescription = list[name];
|
|
476
|
+
const description = (typeof rawDescription === 'object' ? rawDescription.description : rawDescription) || '';
|
|
477
|
+
result += ''.padEnd(indent) + (keyPrefix + name).padEnd(padName) + description + '\n';
|
|
478
|
+
}
|
|
479
|
+
return result.trim();
|
|
480
|
+
}
|
|
481
|
+
|
|
474
482
|
const {
|
|
475
483
|
NPM: NPM$4
|
|
476
484
|
} = registryConstants;
|
|
@@ -832,48 +840,6 @@ const npx = {
|
|
|
832
840
|
}
|
|
833
841
|
};
|
|
834
842
|
|
|
835
|
-
function existsSync(filepath) {
|
|
836
|
-
try {
|
|
837
|
-
return filepath ? fs.existsSync(filepath) : false;
|
|
838
|
-
} catch {}
|
|
839
|
-
return false;
|
|
840
|
-
}
|
|
841
|
-
async function findUp(name, {
|
|
842
|
-
cwd = process$1.cwd()
|
|
843
|
-
}) {
|
|
844
|
-
let dir = path.resolve(cwd);
|
|
845
|
-
const {
|
|
846
|
-
root
|
|
847
|
-
} = path.parse(dir);
|
|
848
|
-
const names = [name].flat();
|
|
849
|
-
while (dir && dir !== root) {
|
|
850
|
-
for (const name of names) {
|
|
851
|
-
const filePath = path.join(dir, name);
|
|
852
|
-
try {
|
|
853
|
-
// eslint-disable-next-line no-await-in-loop
|
|
854
|
-
const stats = await fs.promises.stat(filePath);
|
|
855
|
-
if (stats.isFile()) {
|
|
856
|
-
return filePath;
|
|
857
|
-
}
|
|
858
|
-
} catch {}
|
|
859
|
-
}
|
|
860
|
-
dir = path.dirname(dir);
|
|
861
|
-
}
|
|
862
|
-
return undefined;
|
|
863
|
-
}
|
|
864
|
-
async function readFileBinary(filepath, options) {
|
|
865
|
-
return await fs.promises.readFile(filepath, {
|
|
866
|
-
...options,
|
|
867
|
-
encoding: 'binary'
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
async function readFileUtf8(filepath, options) {
|
|
871
|
-
return await fs.promises.readFile(filepath, {
|
|
872
|
-
...options,
|
|
873
|
-
encoding: 'utf8'
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
|
-
|
|
877
843
|
const {
|
|
878
844
|
BINARY_LOCK_EXT,
|
|
879
845
|
BUN: BUN$1,
|
|
@@ -886,12 +852,6 @@ const {
|
|
|
886
852
|
YARN_CLASSIC: YARN_CLASSIC$1
|
|
887
853
|
} = constants;
|
|
888
854
|
const AGENTS = [BUN$1, NPM$2, PNPM$1, YARN_BERRY$1, YARN_CLASSIC$1, VLT$1];
|
|
889
|
-
const {
|
|
890
|
-
compare: alphanumericComparator
|
|
891
|
-
} = new Intl.Collator(undefined, {
|
|
892
|
-
numeric: true,
|
|
893
|
-
sensitivity: 'base'
|
|
894
|
-
});
|
|
895
855
|
const binByAgent = {
|
|
896
856
|
__proto__: null,
|
|
897
857
|
[BUN$1]: BUN$1,
|
|
@@ -949,8 +909,8 @@ const readLockFileByAgent = (() => {
|
|
|
949
909
|
return undefined;
|
|
950
910
|
};
|
|
951
911
|
}
|
|
952
|
-
const binaryReader = wrapReader(readFileBinary);
|
|
953
|
-
const defaultReader = wrapReader(async lockPath => await readFileUtf8(lockPath));
|
|
912
|
+
const binaryReader = wrapReader(socketUrl.readFileBinary);
|
|
913
|
+
const defaultReader = wrapReader(async lockPath => await socketUrl.readFileUtf8(lockPath));
|
|
954
914
|
return {
|
|
955
915
|
[BUN$1]: wrapReader(async (lockPath, agentExecPath) => {
|
|
956
916
|
const ext = path.extname(lockPath);
|
|
@@ -982,15 +942,15 @@ async function detect({
|
|
|
982
942
|
cwd = process$1.cwd(),
|
|
983
943
|
onUnknown
|
|
984
944
|
} = {}) {
|
|
985
|
-
let lockPath = await findUp(Object.keys(LOCKS), {
|
|
945
|
+
let lockPath = await socketUrl.findUp(Object.keys(LOCKS), {
|
|
986
946
|
cwd
|
|
987
947
|
});
|
|
988
948
|
let lockBasename = lockPath ? path.basename(lockPath) : undefined;
|
|
989
949
|
const isHiddenLockFile = lockBasename === '.package-lock.json';
|
|
990
|
-
const pkgJsonPath = lockPath ? path.resolve(lockPath, `${isHiddenLockFile ? '../' : ''}../package.json`) : await findUp('package.json', {
|
|
950
|
+
const pkgJsonPath = lockPath ? path.resolve(lockPath, `${isHiddenLockFile ? '../' : ''}../package.json`) : await socketUrl.findUp('package.json', {
|
|
991
951
|
cwd
|
|
992
952
|
});
|
|
993
|
-
const pkgPath = existsSync(pkgJsonPath) ? path.dirname(pkgJsonPath) : undefined;
|
|
953
|
+
const pkgPath = pkgJsonPath && fs.existsSync(pkgJsonPath) ? path.dirname(pkgJsonPath) : undefined;
|
|
994
954
|
const editablePkgJson = pkgPath ? await packages.readPackageJson(pkgPath, {
|
|
995
955
|
editable: true
|
|
996
956
|
}) : undefined;
|
|
@@ -1047,7 +1007,7 @@ async function detect({
|
|
|
1047
1007
|
}
|
|
1048
1008
|
const browserslistQuery = pkgJson['browserslist'];
|
|
1049
1009
|
if (Array.isArray(browserslistQuery)) {
|
|
1050
|
-
const browserslistTargets = browserslist(browserslistQuery).map(s => s.toLowerCase()).sort(
|
|
1010
|
+
const browserslistTargets = browserslist(browserslistQuery).map(s => s.toLowerCase()).sort(sorts.naturalCompare);
|
|
1051
1011
|
const browserslistNodeTargets = browserslistTargets.filter(v => v.startsWith('node ')).map(v => v.slice(5 /*'node '.length*/));
|
|
1052
1012
|
if (!targets.browser && browserslistTargets.length) {
|
|
1053
1013
|
targets.browser = browserslistTargets.length !== browserslistNodeTargets.length;
|
|
@@ -1473,11 +1433,11 @@ async function getWorkspaceGlobs(agent, pkgPath, pkgJson) {
|
|
|
1473
1433
|
let workspacePatterns;
|
|
1474
1434
|
if (agent === PNPM) {
|
|
1475
1435
|
for (const workspacePath of [path.join(pkgPath, `${PNPM_WORKSPACE}.yaml`), path.join(pkgPath, `${PNPM_WORKSPACE}.yml`)]) {
|
|
1476
|
-
|
|
1436
|
+
// eslint-disable-next-line no-await-in-loop
|
|
1437
|
+
const yml = await socketUrl.safeReadFile(workspacePath, 'utf8');
|
|
1438
|
+
if (yml) {
|
|
1477
1439
|
try {
|
|
1478
|
-
workspacePatterns = yaml.parse(
|
|
1479
|
-
// eslint-disable-next-line no-await-in-loop
|
|
1480
|
-
await fs$1.readFile(workspacePath, 'utf8'))?.packages;
|
|
1440
|
+
workspacePatterns = yaml.parse(yml)?.packages;
|
|
1481
1441
|
} catch {}
|
|
1482
1442
|
if (workspacePatterns) {
|
|
1483
1443
|
break;
|
|
@@ -1962,16 +1922,7 @@ async function setupCommand$j(name, description, argv, importMeta) {
|
|
|
1962
1922
|
cli.showHelp();
|
|
1963
1923
|
return;
|
|
1964
1924
|
}
|
|
1965
|
-
const {
|
|
1966
|
-
path: binPath
|
|
1967
|
-
} = await pathResolve.findBinPathDetails(binName$1);
|
|
1968
|
-
if (!binPath) {
|
|
1969
|
-
// The exit code 127 indicates that the command or binary being executed
|
|
1970
|
-
// could not be found.
|
|
1971
|
-
console.error(`Socket unable to locate ${binName$1}; ensure it is available in the PATH environment variable.`);
|
|
1972
|
-
process$1.exit(127);
|
|
1973
|
-
}
|
|
1974
|
-
const spawnPromise = spawn(binPath, argv, {
|
|
1925
|
+
const spawnPromise = spawn(npmPaths.getNpmBinPath(), argv, {
|
|
1975
1926
|
signal: abortSignal$1,
|
|
1976
1927
|
stdio: 'inherit'
|
|
1977
1928
|
});
|
|
@@ -2030,16 +1981,7 @@ async function setupCommand$i(name, description, argv, importMeta) {
|
|
|
2030
1981
|
cli.showHelp();
|
|
2031
1982
|
return;
|
|
2032
1983
|
}
|
|
2033
|
-
const {
|
|
2034
|
-
path: binPath
|
|
2035
|
-
} = await pathResolve.findBinPathDetails(binName);
|
|
2036
|
-
if (!binPath) {
|
|
2037
|
-
// The exit code 127 indicates that the command or binary being executed
|
|
2038
|
-
// could not be found.
|
|
2039
|
-
console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable.`);
|
|
2040
|
-
process$1.exit(127);
|
|
2041
|
-
}
|
|
2042
|
-
const spawnPromise = spawn(binPath, argv, {
|
|
1984
|
+
const spawnPromise = spawn(npmPaths.getNpxBinPath(), argv, {
|
|
2043
1985
|
signal: abortSignal,
|
|
2044
1986
|
stdio: 'inherit'
|
|
2045
1987
|
});
|
|
@@ -2216,7 +2158,6 @@ const create$2 = {
|
|
|
2216
2158
|
}));
|
|
2217
2159
|
if (reportData) {
|
|
2218
2160
|
formatReportDataOutput(reportData, {
|
|
2219
|
-
includeAllIssues,
|
|
2220
2161
|
name,
|
|
2221
2162
|
outputJson,
|
|
2222
2163
|
outputMarkdown,
|
|
@@ -2328,7 +2269,7 @@ async function setupCommand$g(name, description, argv, importMeta) {
|
|
|
2328
2269
|
cause
|
|
2329
2270
|
});
|
|
2330
2271
|
});
|
|
2331
|
-
const packagePaths = await
|
|
2272
|
+
const packagePaths = await npmPaths.getPackageFiles(cwd, cli.input, config$1, supportedFiles);
|
|
2332
2273
|
return {
|
|
2333
2274
|
config: config$1,
|
|
2334
2275
|
cwd,
|
|
@@ -2346,7 +2287,7 @@ async function createReport(packagePaths, {
|
|
|
2346
2287
|
cwd,
|
|
2347
2288
|
dryRun
|
|
2348
2289
|
}) {
|
|
2349
|
-
|
|
2290
|
+
npmPaths.debugLog('Uploading:', packagePaths.join(`\n${npmPaths.logSymbols.info} Uploading: `));
|
|
2350
2291
|
if (dryRun) {
|
|
2351
2292
|
return;
|
|
2352
2293
|
}
|
|
@@ -2716,7 +2657,7 @@ async function setupCommand$e(name, description, argv, importMeta) {
|
|
|
2716
2657
|
cause
|
|
2717
2658
|
});
|
|
2718
2659
|
});
|
|
2719
|
-
const packagePaths = await
|
|
2660
|
+
const packagePaths = await npmPaths.getPackageFilesFullScans(cwd, cli.input, supportedFiles);
|
|
2720
2661
|
const {
|
|
2721
2662
|
branch: branchName,
|
|
2722
2663
|
repo: repoName
|
|
@@ -3831,7 +3772,7 @@ const dependencies = {
|
|
|
3831
3772
|
}) {
|
|
3832
3773
|
const name = parentName + ' dependencies';
|
|
3833
3774
|
const input = setupCommand$3(name, dependencies.description, argv, importMeta);
|
|
3834
|
-
{
|
|
3775
|
+
if (input) {
|
|
3835
3776
|
await searchDeps(input);
|
|
3836
3777
|
}
|
|
3837
3778
|
}
|
|
@@ -4399,7 +4340,7 @@ const threatFeed = {
|
|
|
4399
4340
|
}) {
|
|
4400
4341
|
const name = `${parentName} threat-feed`;
|
|
4401
4342
|
const input = setupCommand(name, threatFeed.description, argv, importMeta);
|
|
4402
|
-
{
|
|
4343
|
+
if (input) {
|
|
4403
4344
|
const apiKey = socketUrl.getDefaultToken();
|
|
4404
4345
|
if (!apiKey) {
|
|
4405
4346
|
throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
@@ -4620,7 +4561,7 @@ void (async () => {
|
|
|
4620
4561
|
} else {
|
|
4621
4562
|
errorTitle = 'Unexpected error with no details';
|
|
4622
4563
|
}
|
|
4623
|
-
console.error(`${
|
|
4564
|
+
console.error(`${npmPaths.logSymbols.error} ${colors.bgRed(colors.white(errorTitle + ':'))} ${errorMessage}`);
|
|
4624
4565
|
if (errorBody) {
|
|
4625
4566
|
console.error(`\n${errorBody}`);
|
|
4626
4567
|
}
|
package/dist/require/vendor.js
CHANGED
|
@@ -1707,22 +1707,15 @@ function redent(string, count = 0, options = {}) {
|
|
|
1707
1707
|
}
|
|
1708
1708
|
const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {};
|
|
1709
1709
|
var debug_1 = debug$1;
|
|
1710
|
-
const SEMVER_SPEC_VERSION = '2.0.0';
|
|
1711
1710
|
const MAX_LENGTH$1 = 256;
|
|
1712
1711
|
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
1713
1712
|
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
1714
1713
|
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
|
|
1715
|
-
const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
|
|
1716
1714
|
var constants$1 = {
|
|
1717
1715
|
MAX_LENGTH: MAX_LENGTH$1,
|
|
1718
1716
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
1719
1717
|
MAX_SAFE_BUILD_LENGTH,
|
|
1720
|
-
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1
|
|
1721
|
-
RELEASE_TYPES,
|
|
1722
|
-
SEMVER_SPEC_VERSION,
|
|
1723
|
-
FLAG_INCLUDE_PRERELEASE: 0b001,
|
|
1724
|
-
FLAG_LOOSE: 0b010
|
|
1725
|
-
};
|
|
1718
|
+
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1};
|
|
1726
1719
|
var re$1 = {
|
|
1727
1720
|
exports: {}
|
|
1728
1721
|
};
|
|
@@ -1828,11 +1821,8 @@ const compareIdentifiers$1 = (a, b) => {
|
|
|
1828
1821
|
}
|
|
1829
1822
|
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
1830
1823
|
};
|
|
1831
|
-
const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
|
|
1832
1824
|
var identifiers = {
|
|
1833
|
-
compareIdentifiers: compareIdentifiers$1
|
|
1834
|
-
rcompareIdentifiers
|
|
1835
|
-
};
|
|
1825
|
+
compareIdentifiers: compareIdentifiers$1};
|
|
1836
1826
|
const debug = debug_1;
|
|
1837
1827
|
const {
|
|
1838
1828
|
MAX_LENGTH,
|
|
@@ -4694,9 +4684,9 @@ function versionIncluded(nodeVersion, specifierValue) {
|
|
|
4694
4684
|
if (typeof specifierValue === 'boolean') {
|
|
4695
4685
|
return specifierValue;
|
|
4696
4686
|
}
|
|
4697
|
-
var current =
|
|
4687
|
+
var current = process.versions && process.versions.node ;
|
|
4698
4688
|
if (typeof current !== 'string') {
|
|
4699
|
-
throw new TypeError(
|
|
4689
|
+
throw new TypeError('Unable to determine current node version' );
|
|
4700
4690
|
}
|
|
4701
4691
|
if (specifierValue && typeof specifierValue === 'object') {
|
|
4702
4692
|
for (var i = 0; i < specifierValue.length; ++i) {
|
|
@@ -6765,7 +6755,6 @@ function getSupportLevel$1(stream) {
|
|
|
6765
6755
|
return translateLevel$1(level);
|
|
6766
6756
|
}
|
|
6767
6757
|
var supportsColor_1$1 = {
|
|
6768
|
-
supportsColor: getSupportLevel$1,
|
|
6769
6758
|
stdout: getSupportLevel$1(process.stdout),
|
|
6770
6759
|
stderr: getSupportLevel$1(process.stderr)
|
|
6771
6760
|
};
|
|
@@ -7391,7 +7380,6 @@ function getSupportLevel(stream) {
|
|
|
7391
7380
|
return translateLevel(level);
|
|
7392
7381
|
}
|
|
7393
7382
|
var supportsColor_1 = {
|
|
7394
|
-
supportsColor: getSupportLevel,
|
|
7395
7383
|
stdout: getSupportLevel(process.stdout),
|
|
7396
7384
|
stderr: getSupportLevel(process.stderr)
|
|
7397
7385
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/cli",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.42",
|
|
4
4
|
"description": "CLI tool for Socket.dev",
|
|
5
5
|
"homepage": "http://github.com/SocketDev/socket-cli",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,6 +43,9 @@
|
|
|
43
43
|
"check:lint": "eslint --report-unused-disable-directives .",
|
|
44
44
|
"check:tsc": "tsc",
|
|
45
45
|
"check:type-coverage": "type-coverage --detail --strict --at-least 95 --ignore-files 'test/*'",
|
|
46
|
+
"clean": "run-p --aggregate-output clean:*",
|
|
47
|
+
"clean:dist": "del-cli 'dist' 'test/dist'",
|
|
48
|
+
"clean:node_modules": "del-cli '**/node_modules'",
|
|
46
49
|
"knip:dependencies": "knip --dependencies",
|
|
47
50
|
"knip:exports": "knip --include exports,duplicates",
|
|
48
51
|
"lint": "oxlint -c=./.oxlintrc.json --ignore-path=./.prettierignore --tsconfig=./tsconfig.json .",
|
|
@@ -53,18 +56,20 @@
|
|
|
53
56
|
"test-ci": "run-s build:* test:*",
|
|
54
57
|
"test:unit": "tap-run",
|
|
55
58
|
"test:coverage:c8": "c8 --reporter=none node --test 'test/socket-npm.test.cjs'",
|
|
56
|
-
"test:coverage:merge": "cp -r .tap/coverage/*.json coverage/tmp && c8 --reporter=lcov --reporter=text --include 'dist/{module-sync,require}/*.js' --exclude 'dist/require/vendor.js' report"
|
|
59
|
+
"test:coverage:merge": "cp -r .tap/coverage/*.json coverage/tmp && c8 --reporter=lcov --reporter=text --include 'dist/{module-sync,require}/*.js' --exclude 'dist/require/vendor.js' report",
|
|
60
|
+
"update": "run-p --aggregate-output update:**",
|
|
61
|
+
"update:deps": "npx npm-check-updates"
|
|
57
62
|
},
|
|
58
63
|
"dependencies": {
|
|
59
64
|
"@apideck/better-ajv-errors": "^0.3.6",
|
|
60
|
-
"@cyclonedx/cdxgen": "^11.1.
|
|
65
|
+
"@cyclonedx/cdxgen": "^11.1.7",
|
|
61
66
|
"@npmcli/promise-spawn": "^8.0.2",
|
|
62
|
-
"@socketregistry/hyrious__bun.lockb": "^1.0.
|
|
67
|
+
"@socketregistry/hyrious__bun.lockb": "^1.0.12",
|
|
63
68
|
"@socketregistry/indent-string": "^1.0.9",
|
|
64
69
|
"@socketregistry/is-interactive": "^1.0.1",
|
|
65
70
|
"@socketregistry/is-unicode-supported": "^1.0.0",
|
|
66
71
|
"@socketsecurity/config": "^2.1.3",
|
|
67
|
-
"@socketsecurity/registry": "^1.0.
|
|
72
|
+
"@socketsecurity/registry": "^1.0.81",
|
|
68
73
|
"@socketsecurity/sdk": "^1.4.5",
|
|
69
74
|
"blessed": "^0.1.81",
|
|
70
75
|
"blessed-contrib": "^4.11.0",
|
|
@@ -79,7 +84,7 @@
|
|
|
79
84
|
"npm-package-arg": "^12.0.1",
|
|
80
85
|
"open": "^10.1.0",
|
|
81
86
|
"pony-cause": "^2.1.11",
|
|
82
|
-
"semver": "^7.
|
|
87
|
+
"semver": "^7.7.0",
|
|
83
88
|
"synp": "^1.9.14",
|
|
84
89
|
"terminal-link": "2.1.1",
|
|
85
90
|
"tiny-updater": "^3.5.3",
|
|
@@ -90,16 +95,16 @@
|
|
|
90
95
|
"yoctocolors-cjs": "^2.1.2"
|
|
91
96
|
},
|
|
92
97
|
"devDependencies": {
|
|
93
|
-
"@babel/core": "^7.26.
|
|
98
|
+
"@babel/core": "^7.26.7",
|
|
94
99
|
"@babel/plugin-proposal-export-default-from": "^7.25.9",
|
|
95
100
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
96
101
|
"@babel/plugin-transform-export-namespace-from": "^7.25.9",
|
|
97
102
|
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
98
|
-
"@babel/preset-env": "^7.26.
|
|
103
|
+
"@babel/preset-env": "^7.26.7",
|
|
99
104
|
"@babel/preset-typescript": "^7.26.0",
|
|
100
|
-
"@babel/runtime": "^7.26.
|
|
101
|
-
"@eslint/compat": "^1.2.
|
|
102
|
-
"@eslint/js": "^9.
|
|
105
|
+
"@babel/runtime": "^7.26.7",
|
|
106
|
+
"@eslint/compat": "^1.2.6",
|
|
107
|
+
"@eslint/js": "^9.19.0",
|
|
103
108
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
104
109
|
"@rollup/plugin-json": "^6.1.0",
|
|
105
110
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
@@ -111,7 +116,7 @@
|
|
|
111
116
|
"@types/micromatch": "^4.0.9",
|
|
112
117
|
"@types/mocha": "^10.0.10",
|
|
113
118
|
"@types/mock-fs": "^4.13.4",
|
|
114
|
-
"@types/node": "^22.
|
|
119
|
+
"@types/node": "^22.13.0",
|
|
115
120
|
"@types/npmcli__arborist": "^6.3.0",
|
|
116
121
|
"@types/npmcli__promise-spawn": "^6.0.3",
|
|
117
122
|
"@types/proc-log": "^3.0.4",
|
|
@@ -119,34 +124,36 @@
|
|
|
119
124
|
"@types/update-notifier": "^6.0.8",
|
|
120
125
|
"@types/which": "^3.0.4",
|
|
121
126
|
"@types/yargs-parser": "^21.0.3",
|
|
122
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
123
|
-
"@typescript-eslint/parser": "^8.
|
|
127
|
+
"@typescript-eslint/eslint-plugin": "^8.22.0",
|
|
128
|
+
"@typescript-eslint/parser": "^8.22.0",
|
|
124
129
|
"c8": "^10.1.3",
|
|
125
130
|
"custompatch": "^1.1.4",
|
|
126
|
-
"
|
|
127
|
-
"eslint
|
|
131
|
+
"del-cli": "^6.0.0",
|
|
132
|
+
"eslint": "^9.19.0",
|
|
133
|
+
"eslint-import-resolver-oxc": "^0.10.1",
|
|
128
134
|
"eslint-plugin-depend": "^0.12.0",
|
|
129
135
|
"eslint-plugin-import-x": "^4.6.1",
|
|
130
136
|
"eslint-plugin-n": "^17.15.1",
|
|
131
137
|
"eslint-plugin-sort-destructure-keys": "^2.0.0",
|
|
132
138
|
"eslint-plugin-unicorn": "^56.0.1",
|
|
133
139
|
"husky": "^9.1.7",
|
|
134
|
-
"knip": "^5.
|
|
140
|
+
"knip": "^5.43.6",
|
|
135
141
|
"magic-string": "^0.30.17",
|
|
136
142
|
"mock-fs": "^5.4.1",
|
|
137
|
-
"nock": "^
|
|
143
|
+
"nock": "^14.0.0",
|
|
138
144
|
"npm-run-all2": "^7.0.2",
|
|
139
|
-
"oxlint": "0.15.
|
|
145
|
+
"oxlint": "0.15.9",
|
|
140
146
|
"prettier": "3.4.2",
|
|
141
147
|
"read-package-up": "^11.0.0",
|
|
142
|
-
"rollup": "4.
|
|
148
|
+
"rollup": "4.34.1",
|
|
143
149
|
"rollup-plugin-ts": "^3.4.5",
|
|
144
150
|
"type-coverage": "^2.29.7",
|
|
145
151
|
"typescript": "5.4.5",
|
|
146
|
-
"typescript-eslint": "^8.
|
|
152
|
+
"typescript-eslint": "^8.22.0",
|
|
147
153
|
"unplugin-purge-polyfills": "^0.0.7"
|
|
148
154
|
},
|
|
149
155
|
"overrides": {
|
|
156
|
+
"@socketregistry/packageurl-js": "npm:@socketregistry/packageurl-js@^1",
|
|
150
157
|
"aggregate-error": "npm:@socketregistry/aggregate-error@^1",
|
|
151
158
|
"es-define-property": "npm:@socketregistry/es-define-property@^1",
|
|
152
159
|
"function-bind": "npm:@socketregistry/function-bind@^1",
|
|
@@ -173,6 +180,7 @@
|
|
|
173
180
|
"yaml": "$yaml"
|
|
174
181
|
},
|
|
175
182
|
"resolutions": {
|
|
183
|
+
"@socketregistry/packageurl-js": "npm:@socketregistry/packageurl-js@^1",
|
|
176
184
|
"aggregate-error": "npm:@socketregistry/aggregate-error@^1",
|
|
177
185
|
"es-define-property": "npm:@socketregistry/es-define-property@^1",
|
|
178
186
|
"function-bind": "npm:@socketregistry/function-bind@^1",
|