socket 0.14.41 → 0.14.43
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 +29 -36
- package/dist/module-sync/npm-injection.js +60 -91
- 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/shadow-bin.js +15 -15
- package/dist/module-sync/socket-url.js +4 -4
- package/dist/require/cli.js +29 -36
- package/dist/require/npm-paths.js +3 -0
- package/dist/require/vendor.js +4 -16
- package/package.json +9 -7
- package/dist/require/path-resolve.js +0 -3
package/dist/constants.d.ts
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import registryConstants from '@socketsecurity/registry/lib/constants';
|
|
2
2
|
type RegistryEnv = typeof registryConstants.ENV;
|
|
3
|
-
type
|
|
3
|
+
type RegistryInternals = (typeof registryConstants)['Symbol(kInternalsSymbol)'];
|
|
4
|
+
type Internals = Omit<RegistryInternals, 'getIPC'> & Readonly<{
|
|
5
|
+
getIPC: {
|
|
6
|
+
(): Promise<IPC>;
|
|
7
|
+
<K extends keyof IPC | undefined>(key?: K): Promise<K extends keyof IPC ? IPC[K] : IPC>;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
10
|
+
type ENV = RegistryEnv & Readonly<{
|
|
11
|
+
SOCKET_CLI_DEBUG: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
type IPC = Readonly<{
|
|
4
14
|
SOCKET_CLI_FIX_PACKAGE_LOCK_FILE: boolean;
|
|
5
15
|
SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE: boolean;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
16
|
+
}>;
|
|
17
|
+
type Constants = Omit<typeof registryConstants, 'Symbol(kInternalsSymbol)' | 'ENV' | 'IPC'> & {
|
|
18
|
+
readonly 'Symbol(kInternalsSymbol)': Internals;
|
|
9
19
|
readonly API_V0_URL: 'https://api.socket.dev/v0';
|
|
10
20
|
readonly BABEL_RUNTIME: '@babel/runtime';
|
|
11
21
|
readonly BINARY_LOCK_EXT: '.lockb';
|
|
12
22
|
readonly BUN: 'bun';
|
|
13
|
-
readonly ENV:
|
|
14
|
-
SOCKET_CLI_DEBUG: boolean;
|
|
15
|
-
};
|
|
23
|
+
readonly ENV: ENV;
|
|
16
24
|
readonly DIST_TYPE: 'module-sync' | 'require';
|
|
17
|
-
readonly IPC:
|
|
25
|
+
readonly IPC: IPC;
|
|
18
26
|
readonly LOCK_EXT: '.lock';
|
|
19
27
|
readonly MODULE_SYNC: 'module-sync';
|
|
20
28
|
readonly NPM_REGISTRY_URL: 'https://registry.npmjs.org';
|
|
@@ -38,7 +46,7 @@ type Constants = {
|
|
|
38
46
|
readonly rootPkgJsonPath: string;
|
|
39
47
|
readonly shadowBinPath: string;
|
|
40
48
|
readonly synpBinPath: string;
|
|
41
|
-
}
|
|
49
|
+
};
|
|
42
50
|
declare const constants: Constants;
|
|
43
51
|
export { constants as default };
|
|
44
52
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAIA,OAAO,iBAAiB,MAAM,wCAAwC,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAIA,OAAO,iBAAiB,MAAM,wCAAwC,CAAA;AAWtE,KAAK,WAAW,GAAG,OAAO,iBAAiB,CAAC,GAAG,CAAA;AAE/C,KAAK,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,0BAA0B,CAAC,CAAA;AAE/E,KAAK,SAAS,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAChD,QAAQ,CAAC;IACP,MAAM,EAAE;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;QAChB,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,SAAS,EAC9B,GAAG,CAAC,EAAE,CAAC,GACN,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAA;KAC/C,CAAA;CACF,CAAC,CAAA;AAEJ,KAAK,GAAG,GAAG,WAAW,GACpB,QAAQ,CAAC;IACP,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAC,CAAA;AAEJ,KAAK,GAAG,GAAG,QAAQ,CAAC;IAClB,gCAAgC,EAAE,OAAO,CAAA;IACzC,gDAAgD,EAAE,OAAO,CAAA;CAC1D,CAAC,CAAA;AAEF,KAAK,SAAS,GAAG,IAAI,CACnB,OAAO,iBAAiB,EACxB,0BAA0B,GAAG,KAAK,GAAG,KAAK,CAC3C,GAAG;IACF,QAAQ,CAAC,0BAA0B,EAAE,SAAS,CAAA;IAC9C,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAA;IAChD,QAAQ,CAAC,aAAa,EAAE,gBAAgB,CAAA;IACxC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAA;IAClC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAA;IACnB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;IACjB,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,CAAA;IAC7C,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;IACjB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAA;IACnC,QAAQ,CAAC,gBAAgB,EAAE,4BAA4B,CAAA;IACvD,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,CAAA;IAC7C,QAAQ,CAAC,gCAAgC,EAAE,kCAAkC,CAAA;IAC7E,QAAQ,CAAC,qBAAqB,EAAE,gDAAgD,CAAA;IAChF,QAAQ,CAAC,gDAAgD,EAAE,kDAAkD,CAAA;IAC7G,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAA;IACjC,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAA;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B,CAAA;AAyED,QAAA,MAAM,SAAS,WAiDd,CAAA"}
|
package/dist/module-sync/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ 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 meow = _socketInterop(require('meow'));
|
|
29
29
|
var registryConstants = require('@socketsecurity/registry/lib/constants');
|
|
30
30
|
var socketUrl = require('./socket-url.js');
|
|
@@ -225,24 +225,36 @@ const {
|
|
|
225
225
|
} = constants;
|
|
226
226
|
function shadowNpmInstall(opts) {
|
|
227
227
|
const {
|
|
228
|
-
flags = [],
|
|
228
|
+
flags: flags_ = [],
|
|
229
229
|
ipc,
|
|
230
230
|
...spawnOptions
|
|
231
231
|
} = {
|
|
232
232
|
__proto__: null,
|
|
233
233
|
...opts
|
|
234
234
|
};
|
|
235
|
+
const flags = flags_.filter(f => f !== '--audit' && f !== '--fund' && f !== '--progress' && f !== '--no-audit' && f !== '--no-fund' && f !== '--no-progress');
|
|
235
236
|
const useIpc = objects.isObject(ipc);
|
|
236
|
-
const useDebug =
|
|
237
|
-
const
|
|
237
|
+
const useDebug = npmPaths.isDebug();
|
|
238
|
+
const spawnPromise = spawn(
|
|
238
239
|
// Lazily access constants.execPath.
|
|
239
240
|
constants.execPath, [
|
|
240
|
-
// Lazily access constants.
|
|
241
|
-
|
|
241
|
+
// Lazily access constants.nodeNoWarningsFlags.
|
|
242
|
+
...constants.nodeNoWarningsFlags, '--require',
|
|
243
|
+
// Lazily access constants.distPath.
|
|
244
|
+
path.join(constants.distPath, 'npm-injection.js'), npmPaths.getNpmBinPath(), 'install',
|
|
242
245
|
// Even though the '--silent' flag is passed npm will still run through
|
|
243
246
|
// code paths for 'audit' and 'fund' unless '--no-audit' and '--no-fund'
|
|
244
247
|
// flags are passed.
|
|
245
|
-
|
|
248
|
+
'--no-audit', '--no-fund',
|
|
249
|
+
// Add `--no-progress` flags to fix input being swallowed by the spinner
|
|
250
|
+
// when running the command with recent versions of npm.
|
|
251
|
+
'--no-progress', ...(useDebug ||
|
|
252
|
+
// Detect loglevel flags:
|
|
253
|
+
flags.some(f =>
|
|
254
|
+
// https://docs.npmjs.com/cli/v11/using-npm/logging#setting-log-levels
|
|
255
|
+
f.startsWith('--loglevel') ||
|
|
256
|
+
// https://docs.npmjs.com/cli/v11/using-npm/logging#aliases
|
|
257
|
+
f === '-d' || f === '--dd' || f === '--ddd' || f === '-q' || f === '--quiet' || f === '-s' || f === '--silent') ? [] : ['--silent']), ...flags], {
|
|
246
258
|
signal: abortSignal$3,
|
|
247
259
|
// Set stdio to include 'ipc'.
|
|
248
260
|
// See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166
|
|
@@ -259,9 +271,9 @@ function shadowNpmInstall(opts) {
|
|
|
259
271
|
}
|
|
260
272
|
});
|
|
261
273
|
if (useIpc) {
|
|
262
|
-
|
|
274
|
+
spawnPromise.process.send(ipc);
|
|
263
275
|
}
|
|
264
|
-
return
|
|
276
|
+
return spawnPromise;
|
|
265
277
|
}
|
|
266
278
|
|
|
267
279
|
const {
|
|
@@ -1918,16 +1930,7 @@ async function setupCommand$j(name, description, argv, importMeta) {
|
|
|
1918
1930
|
cli.showHelp();
|
|
1919
1931
|
return;
|
|
1920
1932
|
}
|
|
1921
|
-
const {
|
|
1922
|
-
path: binPath
|
|
1923
|
-
} = await pathResolve.findBinPathDetails(binName$1);
|
|
1924
|
-
if (!binPath) {
|
|
1925
|
-
// The exit code 127 indicates that the command or binary being executed
|
|
1926
|
-
// could not be found.
|
|
1927
|
-
console.error(`Socket unable to locate ${binName$1}; ensure it is available in the PATH environment variable.`);
|
|
1928
|
-
process$1.exit(127);
|
|
1929
|
-
}
|
|
1930
|
-
const spawnPromise = spawn(binPath, argv, {
|
|
1933
|
+
const spawnPromise = spawn(npmPaths.getNpmBinPath(), argv, {
|
|
1931
1934
|
signal: abortSignal$1,
|
|
1932
1935
|
stdio: 'inherit'
|
|
1933
1936
|
});
|
|
@@ -1986,16 +1989,7 @@ async function setupCommand$i(name, description, argv, importMeta) {
|
|
|
1986
1989
|
cli.showHelp();
|
|
1987
1990
|
return;
|
|
1988
1991
|
}
|
|
1989
|
-
const {
|
|
1990
|
-
path: binPath
|
|
1991
|
-
} = await pathResolve.findBinPathDetails(binName);
|
|
1992
|
-
if (!binPath) {
|
|
1993
|
-
// The exit code 127 indicates that the command or binary being executed
|
|
1994
|
-
// could not be found.
|
|
1995
|
-
console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable.`);
|
|
1996
|
-
process$1.exit(127);
|
|
1997
|
-
}
|
|
1998
|
-
const spawnPromise = spawn(binPath, argv, {
|
|
1992
|
+
const spawnPromise = spawn(npmPaths.getNpxBinPath(), argv, {
|
|
1999
1993
|
signal: abortSignal,
|
|
2000
1994
|
stdio: 'inherit'
|
|
2001
1995
|
});
|
|
@@ -2172,7 +2166,6 @@ const create$2 = {
|
|
|
2172
2166
|
}));
|
|
2173
2167
|
if (reportData) {
|
|
2174
2168
|
formatReportDataOutput(reportData, {
|
|
2175
|
-
includeAllIssues,
|
|
2176
2169
|
name,
|
|
2177
2170
|
outputJson,
|
|
2178
2171
|
outputMarkdown,
|
|
@@ -2284,7 +2277,7 @@ async function setupCommand$g(name, description, argv, importMeta) {
|
|
|
2284
2277
|
cause
|
|
2285
2278
|
});
|
|
2286
2279
|
});
|
|
2287
|
-
const packagePaths = await
|
|
2280
|
+
const packagePaths = await npmPaths.getPackageFiles(cwd, cli.input, config$1, supportedFiles);
|
|
2288
2281
|
return {
|
|
2289
2282
|
config: config$1,
|
|
2290
2283
|
cwd,
|
|
@@ -2302,7 +2295,7 @@ async function createReport(packagePaths, {
|
|
|
2302
2295
|
cwd,
|
|
2303
2296
|
dryRun
|
|
2304
2297
|
}) {
|
|
2305
|
-
|
|
2298
|
+
npmPaths.debugLog('Uploading:', packagePaths.join(`\n${npmPaths.logSymbols.info} Uploading: `));
|
|
2306
2299
|
if (dryRun) {
|
|
2307
2300
|
return;
|
|
2308
2301
|
}
|
|
@@ -2672,7 +2665,7 @@ async function setupCommand$e(name, description, argv, importMeta) {
|
|
|
2672
2665
|
cause
|
|
2673
2666
|
});
|
|
2674
2667
|
});
|
|
2675
|
-
const packagePaths = await
|
|
2668
|
+
const packagePaths = await npmPaths.getPackageFilesFullScans(cwd, cli.input, supportedFiles);
|
|
2676
2669
|
const {
|
|
2677
2670
|
branch: branchName,
|
|
2678
2671
|
repo: repoName
|
|
@@ -3787,7 +3780,7 @@ const dependencies = {
|
|
|
3787
3780
|
}) {
|
|
3788
3781
|
const name = parentName + ' dependencies';
|
|
3789
3782
|
const input = setupCommand$3(name, dependencies.description, argv, importMeta);
|
|
3790
|
-
{
|
|
3783
|
+
if (input) {
|
|
3791
3784
|
await searchDeps(input);
|
|
3792
3785
|
}
|
|
3793
3786
|
}
|
|
@@ -4355,7 +4348,7 @@ const threatFeed = {
|
|
|
4355
4348
|
}) {
|
|
4356
4349
|
const name = `${parentName} threat-feed`;
|
|
4357
4350
|
const input = setupCommand(name, threatFeed.description, argv, importMeta);
|
|
4358
|
-
{
|
|
4351
|
+
if (input) {
|
|
4359
4352
|
const apiKey = socketUrl.getDefaultToken();
|
|
4360
4353
|
if (!apiKey) {
|
|
4361
4354
|
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.');
|
|
@@ -4576,7 +4569,7 @@ void (async () => {
|
|
|
4576
4569
|
} else {
|
|
4577
4570
|
errorTitle = 'Unexpected error with no details';
|
|
4578
4571
|
}
|
|
4579
|
-
console.error(`${
|
|
4572
|
+
console.error(`${npmPaths.logSymbols.error} ${colors.bgRed(colors.white(errorTitle + ':'))} ${errorMessage}`);
|
|
4580
4573
|
if (errorBody) {
|
|
4581
4574
|
console.error(`\n${errorBody}`);
|
|
4582
4575
|
}
|
|
@@ -24,14 +24,12 @@ var https = require('node:https');
|
|
|
24
24
|
var readline = require('node:readline');
|
|
25
25
|
var socketUrl = require('./socket-url.js');
|
|
26
26
|
var promises = require('node:timers/promises');
|
|
27
|
-
var
|
|
28
|
-
var fs = require('node:fs');
|
|
27
|
+
var npmPaths = require('./npm-paths.js');
|
|
29
28
|
var npa = _socketInterop(require('npm-package-arg'));
|
|
30
29
|
|
|
31
30
|
const {
|
|
32
31
|
LOOP_SENTINEL: LOOP_SENTINEL$2,
|
|
33
|
-
NPM_REGISTRY_URL: NPM_REGISTRY_URL$1
|
|
34
|
-
SOCKET_CLI_FIX_PACKAGE_LOCK_FILE: SOCKET_CLI_FIX_PACKAGE_LOCK_FILE$1
|
|
32
|
+
NPM_REGISTRY_URL: NPM_REGISTRY_URL$1
|
|
35
33
|
} = constants;
|
|
36
34
|
function getUrlOrigin(input) {
|
|
37
35
|
try {
|
|
@@ -41,8 +39,7 @@ function getUrlOrigin(input) {
|
|
|
41
39
|
}
|
|
42
40
|
function getPackagesToQueryFromDiff(diff_, options) {
|
|
43
41
|
const {
|
|
44
|
-
|
|
45
|
-
includeUnchanged = constants.IPC[SOCKET_CLI_FIX_PACKAGE_LOCK_FILE$1],
|
|
42
|
+
includeUnchanged = false,
|
|
46
43
|
includeUnknownOrigin = false
|
|
47
44
|
} = {
|
|
48
45
|
__proto__: null,
|
|
@@ -155,7 +152,7 @@ function isArtifactAlertCveFixable(alert) {
|
|
|
155
152
|
const {
|
|
156
153
|
type
|
|
157
154
|
} = alert;
|
|
158
|
-
return (type === 'cve' || type === 'mediumCVE' || type === 'mildCVE' || type === 'criticalCVE') && !!alert.props?.['firstPatchedVersionIdentifier'];
|
|
155
|
+
return (type === 'cve' || type === 'mediumCVE' || type === 'mildCVE' || type === 'criticalCVE') && !!alert.props?.['firstPatchedVersionIdentifier'] && !!alert.props?.['vulnerableVersionRange'];
|
|
159
156
|
}
|
|
160
157
|
function isArtifactAlertFixable(alert) {
|
|
161
158
|
return alert.type === 'socketUpgradeAvailable' || isArtifactAlertCveFixable(alert);
|
|
@@ -374,31 +371,7 @@ void (async () => {
|
|
|
374
371
|
_uxLookup = createAlertUXLookup(settings);
|
|
375
372
|
})();
|
|
376
373
|
|
|
377
|
-
const
|
|
378
|
-
NODE_MODULES,
|
|
379
|
-
SOCKET_CLI_ISSUES_URL
|
|
380
|
-
} = constants;
|
|
381
|
-
const npmEntrypoint = fs.realpathSync.native(process.argv[1]);
|
|
382
|
-
const npmRootPath = pathResolve.findRoot(path.dirname(npmEntrypoint));
|
|
383
|
-
if (npmRootPath === undefined) {
|
|
384
|
-
console.error(`Unable to find npm CLI install directory.
|
|
385
|
-
Searched parent directories of ${npmEntrypoint}.
|
|
386
|
-
|
|
387
|
-
This is may be a bug with socket-npm related to changes to the npm CLI.
|
|
388
|
-
Please report to ${SOCKET_CLI_ISSUES_URL}.`);
|
|
389
|
-
// The exit code 127 indicates that the command or binary being executed
|
|
390
|
-
// could not be found.
|
|
391
|
-
process.exit(127);
|
|
392
|
-
}
|
|
393
|
-
const npmNmPath = path.join(npmRootPath, NODE_MODULES);
|
|
394
|
-
const arboristPkgPath = path.join(npmNmPath, '@npmcli/arborist');
|
|
395
|
-
const arboristClassPath = path.join(arboristPkgPath, 'lib/arborist/index.js');
|
|
396
|
-
const arboristDepValidPath = path.join(arboristPkgPath, 'lib/dep-valid.js');
|
|
397
|
-
const arboristEdgeClassPath = path.join(arboristPkgPath, 'lib/edge.js');
|
|
398
|
-
const arboristNodeClassPath = path.join(arboristPkgPath, 'lib/node.js');
|
|
399
|
-
const arboristOverrideSetClassPath = path.join(arboristPkgPath, 'lib/override-set.js');
|
|
400
|
-
|
|
401
|
-
const depValid = require(arboristDepValidPath);
|
|
374
|
+
const depValid = require(npmPaths.getArboristDepValidPath());
|
|
402
375
|
|
|
403
376
|
const {
|
|
404
377
|
UNDEFINED_TOKEN
|
|
@@ -428,6 +401,7 @@ function tryRequire(...ids) {
|
|
|
428
401
|
let _log = UNDEFINED_TOKEN;
|
|
429
402
|
function getLogger() {
|
|
430
403
|
if (_log === UNDEFINED_TOKEN) {
|
|
404
|
+
const npmNmPath = npmPaths.getNpmNodeModulesPath();
|
|
431
405
|
_log = tryRequire([path.join(npmNmPath, 'proc-log/lib/index.js'),
|
|
432
406
|
// The proc-log DefinitelyTyped definition is incorrect. The type definition
|
|
433
407
|
// is really that of its export log.
|
|
@@ -439,7 +413,7 @@ function getLogger() {
|
|
|
439
413
|
const {
|
|
440
414
|
LOOP_SENTINEL: LOOP_SENTINEL$1
|
|
441
415
|
} = constants;
|
|
442
|
-
const OverrideSet = require(
|
|
416
|
+
const OverrideSet = require(npmPaths.getArboristOverrideSetClassPath());
|
|
443
417
|
|
|
444
418
|
// Implementation code not related to patch https://github.com/npm/cli/pull/7025
|
|
445
419
|
// is based on https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/override-set.js:
|
|
@@ -576,7 +550,7 @@ class SafeOverrideSet extends OverrideSet {
|
|
|
576
550
|
}
|
|
577
551
|
}
|
|
578
552
|
|
|
579
|
-
const Node = require(
|
|
553
|
+
const Node = require(npmPaths.getArboristNodeClassPath());
|
|
580
554
|
|
|
581
555
|
// Implementation code not related to patch https://github.com/npm/cli/pull/7025
|
|
582
556
|
// is based on https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/node.js:
|
|
@@ -849,7 +823,7 @@ class SafeNode extends Node {
|
|
|
849
823
|
}
|
|
850
824
|
}
|
|
851
825
|
|
|
852
|
-
const Edge = require(
|
|
826
|
+
const Edge = require(npmPaths.getArboristEdgeClassPath());
|
|
853
827
|
|
|
854
828
|
// The Edge class makes heavy use of private properties which subclasses do NOT
|
|
855
829
|
// have access to. So we have to recreate any functionality that relies on those
|
|
@@ -1119,15 +1093,19 @@ const {
|
|
|
1119
1093
|
NPM_REGISTRY_URL,
|
|
1120
1094
|
SOCKET_CLI_FIX_PACKAGE_LOCK_FILE,
|
|
1121
1095
|
SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE,
|
|
1122
|
-
abortSignal
|
|
1096
|
+
abortSignal,
|
|
1097
|
+
kInternalsSymbol,
|
|
1098
|
+
[kInternalsSymbol]: {
|
|
1099
|
+
getIPC
|
|
1100
|
+
}
|
|
1123
1101
|
} = constants;
|
|
1124
1102
|
const formatter = new socketUrl.ColorOrMarkdown(false);
|
|
1125
|
-
function findBestPatchVersion(name, availableVersions, currentMajorVersion,
|
|
1103
|
+
function findBestPatchVersion(name, availableVersions, currentMajorVersion, vulnerableVersionRange, _firstPatchedVersionIdentifier) {
|
|
1126
1104
|
const manifestVersion = registry.getManifestData(NPM, name)?.version;
|
|
1127
1105
|
// Filter versions that are within the current major version and are not in the vulnerable range
|
|
1128
1106
|
const eligibleVersions = availableVersions.filter(version => {
|
|
1129
1107
|
const isSameMajor = semver.major(version) === currentMajorVersion;
|
|
1130
|
-
const isNotVulnerable = !semver.satisfies(version,
|
|
1108
|
+
const isNotVulnerable = !semver.satisfies(version, vulnerableVersionRange);
|
|
1131
1109
|
if (isSameMajor && isNotVulnerable) {
|
|
1132
1110
|
return true;
|
|
1133
1111
|
}
|
|
@@ -1273,7 +1251,7 @@ async function getPackagesAlerts(details, options) {
|
|
|
1273
1251
|
packageAlerts.push(...alerts);
|
|
1274
1252
|
}
|
|
1275
1253
|
} catch (e) {
|
|
1276
|
-
|
|
1254
|
+
npmPaths.debugLog(e);
|
|
1277
1255
|
} finally {
|
|
1278
1256
|
spinner$1?.stop();
|
|
1279
1257
|
}
|
|
@@ -1289,39 +1267,36 @@ function getTranslations() {
|
|
|
1289
1267
|
return _translations;
|
|
1290
1268
|
}
|
|
1291
1269
|
async function updateAdvisoryDependencies(arb, alerts) {
|
|
1292
|
-
let
|
|
1270
|
+
let patchDataByPkg;
|
|
1293
1271
|
for (const alert of alerts) {
|
|
1294
1272
|
if (!isArtifactAlertCveFixable(alert.raw)) {
|
|
1295
1273
|
continue;
|
|
1296
1274
|
}
|
|
1297
|
-
if (!
|
|
1298
|
-
|
|
1275
|
+
if (!patchDataByPkg) {
|
|
1276
|
+
patchDataByPkg = {};
|
|
1299
1277
|
}
|
|
1300
1278
|
const {
|
|
1301
1279
|
name
|
|
1302
1280
|
} = alert;
|
|
1303
|
-
if (!
|
|
1304
|
-
|
|
1305
|
-
}
|
|
1306
|
-
const
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
cwe: props?.cwes,
|
|
1314
|
-
cvss: props?.csvs,
|
|
1315
|
-
name
|
|
1281
|
+
if (!patchDataByPkg[name]) {
|
|
1282
|
+
patchDataByPkg[name] = [];
|
|
1283
|
+
}
|
|
1284
|
+
const {
|
|
1285
|
+
firstPatchedVersionIdentifier,
|
|
1286
|
+
vulnerableVersionRange
|
|
1287
|
+
} = alert.raw.props;
|
|
1288
|
+
patchDataByPkg[name].push({
|
|
1289
|
+
firstPatchedVersionIdentifier,
|
|
1290
|
+
vulnerableVersionRange
|
|
1316
1291
|
});
|
|
1317
1292
|
}
|
|
1318
|
-
if (!
|
|
1293
|
+
if (!patchDataByPkg) {
|
|
1319
1294
|
// No advisories to process.
|
|
1320
1295
|
return;
|
|
1321
1296
|
}
|
|
1322
1297
|
await arb.buildIdealTree();
|
|
1323
1298
|
const tree = arb.idealTree;
|
|
1324
|
-
for (const name of Object.keys(
|
|
1299
|
+
for (const name of Object.keys(patchDataByPkg)) {
|
|
1325
1300
|
const nodes = findPackageNodes(tree, name);
|
|
1326
1301
|
if (!nodes.length) {
|
|
1327
1302
|
continue;
|
|
@@ -1335,13 +1310,13 @@ async function updateAdvisoryDependencies(arb, alerts) {
|
|
|
1335
1310
|
} = node;
|
|
1336
1311
|
const majorVerNum = semver.major(version);
|
|
1337
1312
|
const availableVersions = packument ? Object.keys(packument.versions) : [];
|
|
1338
|
-
const
|
|
1339
|
-
for (const
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1313
|
+
const patchData = patchDataByPkg[name];
|
|
1314
|
+
for (const {
|
|
1315
|
+
firstPatchedVersionIdentifier,
|
|
1316
|
+
vulnerableVersionRange
|
|
1317
|
+
} of patchData) {
|
|
1343
1318
|
// Find the highest non-vulnerable version within the same major range
|
|
1344
|
-
const targetVersion = findBestPatchVersion(name, availableVersions, majorVerNum,
|
|
1319
|
+
const targetVersion = findBestPatchVersion(name, availableVersions, majorVerNum, vulnerableVersionRange);
|
|
1345
1320
|
const targetPackument = targetVersion ? packument.versions[targetVersion] : undefined;
|
|
1346
1321
|
// Check !targetVersion to make TypeScript happy.
|
|
1347
1322
|
if (!targetVersion || !targetPackument) {
|
|
@@ -1393,27 +1368,28 @@ async function updateAdvisoryDependencies(arb, alerts) {
|
|
|
1393
1368
|
}
|
|
1394
1369
|
}
|
|
1395
1370
|
}
|
|
1371
|
+
const kRiskyReify = Symbol('riskyReify');
|
|
1396
1372
|
async function reify(...args) {
|
|
1373
|
+
const IPC = await getIPC();
|
|
1374
|
+
const runningFixCommand = !!IPC[SOCKET_CLI_FIX_PACKAGE_LOCK_FILE];
|
|
1397
1375
|
// We are assuming `this[_diffTrees]()` has been called by `super.reify(...)`:
|
|
1398
1376
|
// https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/arborist/reify.js#L141
|
|
1399
|
-
|
|
1377
|
+
let needInfoOn = getPackagesToQueryFromDiff(this.diff, {
|
|
1378
|
+
includeUnchanged: runningFixCommand
|
|
1379
|
+
});
|
|
1400
1380
|
if (!needInfoOn.length) {
|
|
1401
1381
|
// Nothing to check, hmmm already installed or all private?
|
|
1402
1382
|
return await this[kRiskyReify](...args);
|
|
1403
1383
|
}
|
|
1404
|
-
|
|
1405
|
-
const {
|
|
1406
|
-
[SOCKET_CLI_FIX_PACKAGE_LOCK_FILE]: bypassConfirms,
|
|
1407
|
-
[SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE]: bypassAlerts
|
|
1408
|
-
} = constants.IPC;
|
|
1384
|
+
const runningOptimizeCommand = !!IPC[SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE];
|
|
1409
1385
|
const {
|
|
1410
1386
|
stderr: output,
|
|
1411
1387
|
stdin: input
|
|
1412
1388
|
} = process;
|
|
1413
|
-
let alerts =
|
|
1389
|
+
let alerts = runningOptimizeCommand ? [] : await getPackagesAlerts(needInfoOn, {
|
|
1414
1390
|
output
|
|
1415
1391
|
});
|
|
1416
|
-
if (alerts.length && !
|
|
1392
|
+
if (alerts.length && !runningFixCommand && !(await prompts.confirm({
|
|
1417
1393
|
message: 'Accept risks of installing these packages?',
|
|
1418
1394
|
default: false
|
|
1419
1395
|
}, {
|
|
@@ -1423,14 +1399,7 @@ async function reify(...args) {
|
|
|
1423
1399
|
}))) {
|
|
1424
1400
|
throw new Error('Socket npm exiting due to risks');
|
|
1425
1401
|
}
|
|
1426
|
-
if (!alerts.length || !
|
|
1427
|
-
message: 'Try to fix alerts?',
|
|
1428
|
-
default: true
|
|
1429
|
-
}, {
|
|
1430
|
-
input,
|
|
1431
|
-
output,
|
|
1432
|
-
signal: abortSignal
|
|
1433
|
-
}))) {
|
|
1402
|
+
if (!alerts.length || !runningFixCommand) {
|
|
1434
1403
|
return await this[kRiskyReify](...args);
|
|
1435
1404
|
}
|
|
1436
1405
|
const prev = new Set(alerts.map(a => a.key));
|
|
@@ -1441,28 +1410,28 @@ async function reify(...args) {
|
|
|
1441
1410
|
ret = await this[kRiskyReify](...args);
|
|
1442
1411
|
await this.loadActual();
|
|
1443
1412
|
await this.buildIdealTree();
|
|
1444
|
-
|
|
1413
|
+
needInfoOn = getPackagesToQueryFromDiff(this.diff, {
|
|
1445
1414
|
includeUnchanged: true
|
|
1446
|
-
})
|
|
1415
|
+
});
|
|
1416
|
+
alerts = (await getPackagesAlerts(needInfoOn, {
|
|
1447
1417
|
includeExisting: true,
|
|
1448
1418
|
includeUnfixable: true
|
|
1449
1419
|
})).filter(({
|
|
1450
1420
|
key
|
|
1451
1421
|
}) => {
|
|
1452
|
-
|
|
1453
|
-
|
|
1422
|
+
const unseen = !prev.has(key);
|
|
1423
|
+
if (unseen) {
|
|
1424
|
+
prev.add(key);
|
|
1454
1425
|
}
|
|
1455
|
-
|
|
1456
|
-
return true;
|
|
1426
|
+
return unseen;
|
|
1457
1427
|
});
|
|
1458
1428
|
}
|
|
1459
1429
|
/* eslint-enable no-await-in-loop */
|
|
1460
1430
|
return ret;
|
|
1461
1431
|
}
|
|
1462
1432
|
|
|
1463
|
-
const Arborist = require(
|
|
1433
|
+
const Arborist = require(npmPaths.getArboristClassPath());
|
|
1464
1434
|
const kCtorArgs = Symbol('ctorArgs');
|
|
1465
|
-
const kRiskyReify = Symbol('riskyReify');
|
|
1466
1435
|
|
|
1467
1436
|
// Implementation code not related to our custom behavior is based on
|
|
1468
1437
|
// https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/arborist/index.js:
|
|
@@ -1519,16 +1488,16 @@ function installSafeArborist() {
|
|
|
1519
1488
|
// Override '@npmcli/arborist' module exports with patched variants based on
|
|
1520
1489
|
// https://github.com/npm/cli/pull/7025.
|
|
1521
1490
|
const cache = require.cache;
|
|
1522
|
-
cache[
|
|
1491
|
+
cache[npmPaths.getArboristClassPath()] = {
|
|
1523
1492
|
exports: SafeArborist
|
|
1524
1493
|
};
|
|
1525
|
-
cache[
|
|
1494
|
+
cache[npmPaths.getArboristEdgeClassPath()] = {
|
|
1526
1495
|
exports: SafeEdge
|
|
1527
1496
|
};
|
|
1528
|
-
cache[
|
|
1497
|
+
cache[npmPaths.getArboristNodeClassPath()] = {
|
|
1529
1498
|
exports: SafeNode
|
|
1530
1499
|
};
|
|
1531
|
-
cache[
|
|
1500
|
+
cache[npmPaths.getArboristOverrideSetClassPath()] = {
|
|
1532
1501
|
exports: SafeOverrideSet
|
|
1533
1502
|
};
|
|
1534
1503
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare function directoryPatterns(): string[];
|
|
2
|
+
declare function getNpmBinPath(): string;
|
|
3
|
+
declare function isNpmBinPathShadowed(): boolean;
|
|
4
|
+
declare function getNpxBinPath(): string;
|
|
5
|
+
declare function isNpxBinPathShadowed(): boolean;
|
|
6
|
+
declare function getNpmPath(): string;
|
|
7
|
+
declare function getNpmNodeModulesPath(): string;
|
|
8
|
+
declare function getArboristPackagePath(): string;
|
|
9
|
+
declare function getArboristClassPath(): string;
|
|
10
|
+
declare function getArboristDepValidPath(): string;
|
|
11
|
+
declare function getArboristEdgeClassPath(): string;
|
|
12
|
+
declare function getArboristNodeClassPath(): string;
|
|
13
|
+
declare function getArboristOverrideSetClassPath(): string;
|
|
14
|
+
export { directoryPatterns, getNpmBinPath, isNpmBinPathShadowed, getNpxBinPath, isNpxBinPathShadowed, getNpmPath, getNpmNodeModulesPath, getArboristPackagePath, getArboristClassPath, getArboristDepValidPath, getArboristEdgeClassPath, getArboristNodeClassPath, getArboristOverrideSetClassPath };
|
|
@@ -12,6 +12,7 @@ function _socketInterop(e) {
|
|
|
12
12
|
var fs = require('node:fs');
|
|
13
13
|
var path = require('node:path');
|
|
14
14
|
var process = require('node:process');
|
|
15
|
+
var constants = require('./constants.js');
|
|
15
16
|
var ignore = _socketInterop(require('ignore'));
|
|
16
17
|
var micromatch = _socketInterop(require('micromatch'));
|
|
17
18
|
var tinyglobby = _socketInterop(require('tinyglobby'));
|
|
@@ -19,7 +20,6 @@ var which = _socketInterop(require('which'));
|
|
|
19
20
|
var colors = _socketInterop(require('yoctocolors-cjs'));
|
|
20
21
|
var isUnicodeSupported = require('@socketregistry/is-unicode-supported/index.cjs');
|
|
21
22
|
var spinner = require('@socketsecurity/registry/lib/spinner');
|
|
22
|
-
var constants = require('./constants.js');
|
|
23
23
|
|
|
24
24
|
const logSymbols = isUnicodeSupported() ? {
|
|
25
25
|
__proto__: null,
|
|
@@ -89,11 +89,11 @@ function directoryPatterns() {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
const {
|
|
92
|
-
NPM,
|
|
92
|
+
NPM: NPM$1,
|
|
93
93
|
shadowBinPath
|
|
94
94
|
} = constants;
|
|
95
95
|
async function filterGlobResultToSupportedFiles(entries, supportedFiles) {
|
|
96
|
-
const patterns = ['golang', NPM, 'pypi'].reduce((r, n) => {
|
|
96
|
+
const patterns = ['golang', NPM$1, 'pypi'].reduce((r, n) => {
|
|
97
97
|
const supported = supportedFiles[n];
|
|
98
98
|
r.push(...(supported ? Object.values(supported).map(p => `**/${p.pattern}`) : []));
|
|
99
99
|
return r;
|
|
@@ -181,25 +181,12 @@ function pathsToPatterns(paths) {
|
|
|
181
181
|
// TODO: Does not support `~/` paths.
|
|
182
182
|
return paths.map(p => p === '.' ? '**/*' : p);
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
let curPath = filepath;
|
|
186
|
-
while (true) {
|
|
187
|
-
if (path.basename(curPath) === NPM) {
|
|
188
|
-
return curPath;
|
|
189
|
-
}
|
|
190
|
-
const parent = path.dirname(curPath);
|
|
191
|
-
if (parent === curPath) {
|
|
192
|
-
return undefined;
|
|
193
|
-
}
|
|
194
|
-
curPath = parent;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
async function findBinPathDetails(binName) {
|
|
184
|
+
function findBinPathDetailsSync(binName) {
|
|
198
185
|
let shadowIndex = -1;
|
|
199
|
-
const bins =
|
|
186
|
+
const bins = which.sync(binName, {
|
|
200
187
|
all: true,
|
|
201
188
|
nothrow: true
|
|
202
|
-
})
|
|
189
|
+
}) ?? [];
|
|
203
190
|
const binPath = bins.find((binPath, i) => {
|
|
204
191
|
// Skip our bin directory if it's in the front.
|
|
205
192
|
if (fs.realpathSync(path.dirname(binPath)) === shadowBinPath) {
|
|
@@ -214,6 +201,19 @@ async function findBinPathDetails(binName) {
|
|
|
214
201
|
shadowed: shadowIndex !== -1
|
|
215
202
|
};
|
|
216
203
|
}
|
|
204
|
+
function findNpmPathSync(filepath) {
|
|
205
|
+
let curPath = filepath;
|
|
206
|
+
while (true) {
|
|
207
|
+
if (path.basename(curPath) === NPM$1) {
|
|
208
|
+
return curPath;
|
|
209
|
+
}
|
|
210
|
+
const parent = path.dirname(curPath);
|
|
211
|
+
if (parent === curPath) {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
curPath = parent;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
217
|
async function getPackageFiles(cwd, inputPaths, config, supportedFiles) {
|
|
218
218
|
debugLog(`Globbed resolving ${inputPaths.length} paths:`, inputPaths);
|
|
219
219
|
const entries = await globWithGitIgnore(pathsToPatterns(inputPaths), {
|
|
@@ -236,11 +236,139 @@ async function getPackageFilesFullScans(cwd, inputPaths, supportedFiles, debugLo
|
|
|
236
236
|
return packageFiles;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
const {
|
|
240
|
+
NODE_MODULES,
|
|
241
|
+
NPM,
|
|
242
|
+
NPX,
|
|
243
|
+
SOCKET_CLI_ISSUES_URL
|
|
244
|
+
} = constants;
|
|
245
|
+
function exitWithBinPathError(binName) {
|
|
246
|
+
console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable.`);
|
|
247
|
+
// The exit code 127 indicates that the command or binary being executed
|
|
248
|
+
// could not be found.
|
|
249
|
+
process.exit(127);
|
|
250
|
+
}
|
|
251
|
+
let _npmBinPathDetails;
|
|
252
|
+
function getNpmBinPathDetails() {
|
|
253
|
+
if (_npmBinPathDetails === undefined) {
|
|
254
|
+
_npmBinPathDetails = findBinPathDetailsSync(NPM);
|
|
255
|
+
}
|
|
256
|
+
return _npmBinPathDetails;
|
|
257
|
+
}
|
|
258
|
+
let _npxBinPathDetails;
|
|
259
|
+
function getNpxBinPathDetails() {
|
|
260
|
+
if (_npxBinPathDetails === undefined) {
|
|
261
|
+
_npxBinPathDetails = findBinPathDetailsSync(NPX);
|
|
262
|
+
}
|
|
263
|
+
return _npxBinPathDetails;
|
|
264
|
+
}
|
|
265
|
+
let _npmBinPath;
|
|
266
|
+
function getNpmBinPath() {
|
|
267
|
+
if (_npmBinPath === undefined) {
|
|
268
|
+
_npmBinPath = getNpmBinPathDetails().path;
|
|
269
|
+
if (!_npmBinPath) {
|
|
270
|
+
exitWithBinPathError(NPM);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return _npmBinPath;
|
|
274
|
+
}
|
|
275
|
+
function isNpmBinPathShadowed() {
|
|
276
|
+
return getNpmBinPathDetails().shadowed;
|
|
277
|
+
}
|
|
278
|
+
let _npxBinPath;
|
|
279
|
+
function getNpxBinPath() {
|
|
280
|
+
if (_npxBinPath === undefined) {
|
|
281
|
+
_npxBinPath = getNpxBinPathDetails().path;
|
|
282
|
+
if (!_npxBinPath) {
|
|
283
|
+
exitWithBinPathError(NPX);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return _npxBinPath;
|
|
287
|
+
}
|
|
288
|
+
function isNpxBinPathShadowed() {
|
|
289
|
+
return getNpxBinPathDetails().shadowed;
|
|
290
|
+
}
|
|
291
|
+
let _npmPath;
|
|
292
|
+
function getNpmPath() {
|
|
293
|
+
if (_npmPath === undefined) {
|
|
294
|
+
const npmEntrypoint = path.dirname(fs.realpathSync.native(getNpmBinPath()));
|
|
295
|
+
_npmPath = findNpmPathSync(npmEntrypoint);
|
|
296
|
+
if (!_npmPath) {
|
|
297
|
+
console.error(`Unable to find npm CLI install directory.
|
|
298
|
+
Searched parent directories of ${npmEntrypoint}.
|
|
299
|
+
|
|
300
|
+
This is may be a bug with socket-npm related to changes to the npm CLI.
|
|
301
|
+
Please report to ${SOCKET_CLI_ISSUES_URL}.`);
|
|
302
|
+
// The exit code 127 indicates that the command or binary being executed
|
|
303
|
+
// could not be found.
|
|
304
|
+
process.exit(127);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return _npmPath;
|
|
308
|
+
}
|
|
309
|
+
let _npmNmPath;
|
|
310
|
+
function getNpmNodeModulesPath() {
|
|
311
|
+
if (_npmNmPath === undefined) {
|
|
312
|
+
_npmNmPath = path.join(getNpmPath(), NODE_MODULES);
|
|
313
|
+
}
|
|
314
|
+
return _npmNmPath;
|
|
315
|
+
}
|
|
316
|
+
let _arboristPkgPath;
|
|
317
|
+
function getArboristPackagePath() {
|
|
318
|
+
if (_arboristPkgPath === undefined) {
|
|
319
|
+
_arboristPkgPath = path.join(getNpmNodeModulesPath(), '@npmcli/arborist');
|
|
320
|
+
}
|
|
321
|
+
return _arboristPkgPath;
|
|
322
|
+
}
|
|
323
|
+
let _arboristClassPath;
|
|
324
|
+
function getArboristClassPath() {
|
|
325
|
+
if (_arboristClassPath === undefined) {
|
|
326
|
+
_arboristClassPath = path.join(getArboristPackagePath(), 'lib/arborist/index.js');
|
|
327
|
+
}
|
|
328
|
+
return _arboristClassPath;
|
|
329
|
+
}
|
|
330
|
+
let _arboristDepValidPath;
|
|
331
|
+
function getArboristDepValidPath() {
|
|
332
|
+
if (_arboristDepValidPath === undefined) {
|
|
333
|
+
_arboristDepValidPath = path.join(getArboristPackagePath(), 'lib/dep-valid.js');
|
|
334
|
+
}
|
|
335
|
+
return _arboristDepValidPath;
|
|
336
|
+
}
|
|
337
|
+
let _arboristEdgeClassPath;
|
|
338
|
+
function getArboristEdgeClassPath() {
|
|
339
|
+
if (_arboristEdgeClassPath === undefined) {
|
|
340
|
+
_arboristEdgeClassPath = path.join(getArboristPackagePath(), 'lib/edge.js');
|
|
341
|
+
}
|
|
342
|
+
return _arboristEdgeClassPath;
|
|
343
|
+
}
|
|
344
|
+
let _arboristNodeClassPath;
|
|
345
|
+
function getArboristNodeClassPath() {
|
|
346
|
+
if (_arboristNodeClassPath === undefined) {
|
|
347
|
+
_arboristNodeClassPath = path.join(getArboristPackagePath(), 'lib/node.js');
|
|
348
|
+
}
|
|
349
|
+
return _arboristNodeClassPath;
|
|
350
|
+
}
|
|
351
|
+
let _arboristOverrideSetClassPath;
|
|
352
|
+
function getArboristOverrideSetClassPath() {
|
|
353
|
+
if (_arboristOverrideSetClassPath === undefined) {
|
|
354
|
+
_arboristOverrideSetClassPath = path.join(getArboristPackagePath(), 'lib/override-set.js');
|
|
355
|
+
}
|
|
356
|
+
return _arboristOverrideSetClassPath;
|
|
357
|
+
}
|
|
358
|
+
|
|
239
359
|
exports.debugLog = debugLog;
|
|
240
|
-
exports.
|
|
241
|
-
exports.
|
|
360
|
+
exports.getArboristClassPath = getArboristClassPath;
|
|
361
|
+
exports.getArboristDepValidPath = getArboristDepValidPath;
|
|
362
|
+
exports.getArboristEdgeClassPath = getArboristEdgeClassPath;
|
|
363
|
+
exports.getArboristNodeClassPath = getArboristNodeClassPath;
|
|
364
|
+
exports.getArboristOverrideSetClassPath = getArboristOverrideSetClassPath;
|
|
365
|
+
exports.getNpmBinPath = getNpmBinPath;
|
|
366
|
+
exports.getNpmNodeModulesPath = getNpmNodeModulesPath;
|
|
367
|
+
exports.getNpxBinPath = getNpxBinPath;
|
|
242
368
|
exports.getPackageFiles = getPackageFiles;
|
|
243
369
|
exports.getPackageFilesFullScans = getPackageFilesFullScans;
|
|
244
370
|
exports.isDebug = isDebug;
|
|
371
|
+
exports.isNpmBinPathShadowed = isNpmBinPathShadowed;
|
|
372
|
+
exports.isNpxBinPathShadowed = isNpxBinPathShadowed;
|
|
245
373
|
exports.logSymbols = logSymbols;
|
|
246
374
|
exports.logger = logger;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { SocketYml } from '@socketsecurity/config';
|
|
3
3
|
import { SocketSdkReturnType } from '@socketsecurity/sdk';
|
|
4
|
-
declare function
|
|
5
|
-
declare function findRoot(filepath: string): string | undefined;
|
|
6
|
-
declare function findBinPathDetails(binName: string): Promise<{
|
|
4
|
+
declare function findBinPathDetailsSync(binName: string): {
|
|
7
5
|
name: string;
|
|
8
6
|
path: string | undefined;
|
|
9
7
|
shadowed: boolean;
|
|
10
|
-
}
|
|
8
|
+
};
|
|
9
|
+
declare function findNpmPathSync(filepath: string): string | undefined;
|
|
11
10
|
declare function getPackageFiles(cwd: string, inputPaths: string[], config: SocketYml | undefined, supportedFiles: SocketSdkReturnType<'getReportSupportedFiles'>['data']): Promise<string[]>;
|
|
12
11
|
declare function getPackageFilesFullScans(cwd: string, inputPaths: string[], supportedFiles: SocketSdkReturnType<'getReportSupportedFiles'>['data'], debugLog?: typeof console.error): Promise<string[]>;
|
|
13
|
-
export {
|
|
12
|
+
export { findBinPathDetailsSync, findNpmPathSync, getPackageFiles, getPackageFilesFullScans };
|
|
@@ -13,21 +13,16 @@ var path = require('node:path');
|
|
|
13
13
|
var process = require('node:process');
|
|
14
14
|
var spawn = _socketInterop(require('@npmcli/promise-spawn'));
|
|
15
15
|
var cmdShim = _socketInterop(require('cmd-shim'));
|
|
16
|
+
var npmPaths = require('./npm-paths.js');
|
|
16
17
|
var constants = require('./constants.js');
|
|
17
|
-
var pathResolve = require('./path-resolve.js');
|
|
18
18
|
|
|
19
|
+
const {
|
|
20
|
+
NPX
|
|
21
|
+
} = constants;
|
|
19
22
|
async function installLinks(realBinPath, binName) {
|
|
23
|
+
const isNpx = binName === NPX;
|
|
20
24
|
// Find package manager being shadowed by this process.
|
|
21
|
-
const
|
|
22
|
-
path: binPath,
|
|
23
|
-
shadowed
|
|
24
|
-
} = await pathResolve.findBinPathDetails(binName);
|
|
25
|
-
if (!binPath) {
|
|
26
|
-
// The exit code 127 indicates that the command or binary being executed
|
|
27
|
-
// could not be found.
|
|
28
|
-
console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable.`);
|
|
29
|
-
process.exit(127);
|
|
30
|
-
}
|
|
25
|
+
const binPath = isNpx ? npmPaths.getNpxBinPath() : npmPaths.getNpmBinPath();
|
|
31
26
|
// Lazily access constants.WIN32.
|
|
32
27
|
const {
|
|
33
28
|
WIN32
|
|
@@ -36,6 +31,7 @@ async function installLinks(realBinPath, binName) {
|
|
|
36
31
|
if (WIN32 && binPath) {
|
|
37
32
|
return binPath;
|
|
38
33
|
}
|
|
34
|
+
const shadowed = isNpx ? npmPaths.isNpxBinPathShadowed() : npmPaths.isNpmBinPathShadowed();
|
|
39
35
|
// Move our bin directory to front of PATH so its found first.
|
|
40
36
|
if (!shadowed) {
|
|
41
37
|
if (WIN32) {
|
|
@@ -62,10 +58,14 @@ async function shadowBin(binName, binArgs = process.argv.slice(2)) {
|
|
|
62
58
|
// Lazily access constants.distPath.
|
|
63
59
|
path.join(constants.distPath, 'npm-injection.js'),
|
|
64
60
|
// Lazily access constants.shadowBinPath.
|
|
65
|
-
await installLinks(constants.shadowBinPath, binName), ...binArgs
|
|
66
|
-
// Add the `--quiet` and `--no-progress` flags to fix input being
|
|
67
|
-
// by the spinner when running the command with recent
|
|
68
|
-
|
|
61
|
+
await installLinks(constants.shadowBinPath, binName), ...(binName === NPM && binArgs.includes('install') ? [
|
|
62
|
+
// Add the `--quiet` and `--no-progress` flags to fix input being
|
|
63
|
+
// swallowed by the spinner when running the command with recent
|
|
64
|
+
// versions of npm.
|
|
65
|
+
...binArgs.filter(a => a !== '--progress' && a !== '--no-progress'), '--no-progress',
|
|
66
|
+
// Add the '--quiet' flag if an equivalent flag is not provided.
|
|
67
|
+
// https://docs.npmjs.com/cli/v11/using-npm/logging#aliases
|
|
68
|
+
...(binArgs.includes('-q') || binArgs.includes('--quiet') || binArgs.includes('-s') || binArgs.includes('--silent') ? [] : ['--quiet'])] : binArgs)], {
|
|
69
69
|
signal: abortSignal,
|
|
70
70
|
stdio: 'inherit'
|
|
71
71
|
});
|
|
@@ -12,7 +12,7 @@ function _socketInterop(e) {
|
|
|
12
12
|
var terminalLink = _socketInterop(require('terminal-link'));
|
|
13
13
|
var colors = _socketInterop(require('yoctocolors-cjs'));
|
|
14
14
|
var indentString = require('@socketregistry/indent-string/index.cjs');
|
|
15
|
-
var
|
|
15
|
+
var npmPaths = require('./npm-paths.js');
|
|
16
16
|
var process = require('node:process');
|
|
17
17
|
var hpagent = _socketInterop(require('hpagent'));
|
|
18
18
|
var isInteractive = require('@socketregistry/is-interactive/index.cjs');
|
|
@@ -82,7 +82,7 @@ class ColorOrMarkdown {
|
|
|
82
82
|
return this.useMarkdown ? `* ${indentedContent.join('\n* ')}\n` : `${indentedContent.join('\n')}\n`;
|
|
83
83
|
}
|
|
84
84
|
get logSymbols() {
|
|
85
|
-
return this.useMarkdown ? markdownLogSymbols :
|
|
85
|
+
return this.useMarkdown ? markdownLogSymbols : npmPaths.logSymbols;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -146,7 +146,7 @@ function getSettings() {
|
|
|
146
146
|
try {
|
|
147
147
|
Object.assign(_settings, JSON.parse(Buffer.from(raw, 'base64').toString()));
|
|
148
148
|
} catch {
|
|
149
|
-
|
|
149
|
+
npmPaths.logger.warn(`Failed to parse settings at ${settingsPath}`);
|
|
150
150
|
}
|
|
151
151
|
} else {
|
|
152
152
|
fs.mkdirSync(path.dirname(settingsPath), {
|
|
@@ -170,7 +170,7 @@ function getSettingsPath() {
|
|
|
170
170
|
if (WIN32) {
|
|
171
171
|
if (!_warnedSettingPathWin32Missing) {
|
|
172
172
|
_warnedSettingPathWin32Missing = true;
|
|
173
|
-
|
|
173
|
+
npmPaths.logger.warn(`Missing %${LOCALAPPDATA}%`);
|
|
174
174
|
}
|
|
175
175
|
} else {
|
|
176
176
|
dataHome = path.join(os.homedir(), ...(process.platform === 'darwin' ? ['Library', 'Application Support'] : ['.local', 'share']));
|
package/dist/require/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ 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'));
|
|
@@ -223,24 +223,36 @@ const {
|
|
|
223
223
|
} = constants;
|
|
224
224
|
function shadowNpmInstall(opts) {
|
|
225
225
|
const {
|
|
226
|
-
flags = [],
|
|
226
|
+
flags: flags_ = [],
|
|
227
227
|
ipc,
|
|
228
228
|
...spawnOptions
|
|
229
229
|
} = {
|
|
230
230
|
__proto__: null,
|
|
231
231
|
...opts
|
|
232
232
|
};
|
|
233
|
+
const flags = flags_.filter(f => f !== '--audit' && f !== '--fund' && f !== '--progress' && f !== '--no-audit' && f !== '--no-fund' && f !== '--no-progress');
|
|
233
234
|
const useIpc = objects.isObject(ipc);
|
|
234
|
-
const useDebug =
|
|
235
|
-
const
|
|
235
|
+
const useDebug = npmPaths.isDebug();
|
|
236
|
+
const spawnPromise = spawn(
|
|
236
237
|
// Lazily access constants.execPath.
|
|
237
238
|
constants.execPath, [
|
|
238
|
-
// Lazily access constants.
|
|
239
|
-
|
|
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',
|
|
240
243
|
// Even though the '--silent' flag is passed npm will still run through
|
|
241
244
|
// code paths for 'audit' and 'fund' unless '--no-audit' and '--no-fund'
|
|
242
245
|
// flags are passed.
|
|
243
|
-
|
|
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 ||
|
|
250
|
+
// Detect loglevel flags:
|
|
251
|
+
flags.some(f =>
|
|
252
|
+
// https://docs.npmjs.com/cli/v11/using-npm/logging#setting-log-levels
|
|
253
|
+
f.startsWith('--loglevel') ||
|
|
254
|
+
// https://docs.npmjs.com/cli/v11/using-npm/logging#aliases
|
|
255
|
+
f === '-d' || f === '--dd' || f === '--ddd' || f === '-q' || f === '--quiet' || f === '-s' || f === '--silent') ? [] : ['--silent']), ...flags], {
|
|
244
256
|
signal: abortSignal$3,
|
|
245
257
|
// Set stdio to include 'ipc'.
|
|
246
258
|
// See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166
|
|
@@ -257,9 +269,9 @@ function shadowNpmInstall(opts) {
|
|
|
257
269
|
}
|
|
258
270
|
});
|
|
259
271
|
if (useIpc) {
|
|
260
|
-
|
|
272
|
+
spawnPromise.process.send(ipc);
|
|
261
273
|
}
|
|
262
|
-
return
|
|
274
|
+
return spawnPromise;
|
|
263
275
|
}
|
|
264
276
|
|
|
265
277
|
const {
|
|
@@ -1916,16 +1928,7 @@ async function setupCommand$j(name, description, argv, importMeta) {
|
|
|
1916
1928
|
cli.showHelp();
|
|
1917
1929
|
return;
|
|
1918
1930
|
}
|
|
1919
|
-
const {
|
|
1920
|
-
path: binPath
|
|
1921
|
-
} = await pathResolve.findBinPathDetails(binName$1);
|
|
1922
|
-
if (!binPath) {
|
|
1923
|
-
// The exit code 127 indicates that the command or binary being executed
|
|
1924
|
-
// could not be found.
|
|
1925
|
-
console.error(`Socket unable to locate ${binName$1}; ensure it is available in the PATH environment variable.`);
|
|
1926
|
-
process$1.exit(127);
|
|
1927
|
-
}
|
|
1928
|
-
const spawnPromise = spawn(binPath, argv, {
|
|
1931
|
+
const spawnPromise = spawn(npmPaths.getNpmBinPath(), argv, {
|
|
1929
1932
|
signal: abortSignal$1,
|
|
1930
1933
|
stdio: 'inherit'
|
|
1931
1934
|
});
|
|
@@ -1984,16 +1987,7 @@ async function setupCommand$i(name, description, argv, importMeta) {
|
|
|
1984
1987
|
cli.showHelp();
|
|
1985
1988
|
return;
|
|
1986
1989
|
}
|
|
1987
|
-
const {
|
|
1988
|
-
path: binPath
|
|
1989
|
-
} = await pathResolve.findBinPathDetails(binName);
|
|
1990
|
-
if (!binPath) {
|
|
1991
|
-
// The exit code 127 indicates that the command or binary being executed
|
|
1992
|
-
// could not be found.
|
|
1993
|
-
console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable.`);
|
|
1994
|
-
process$1.exit(127);
|
|
1995
|
-
}
|
|
1996
|
-
const spawnPromise = spawn(binPath, argv, {
|
|
1990
|
+
const spawnPromise = spawn(npmPaths.getNpxBinPath(), argv, {
|
|
1997
1991
|
signal: abortSignal,
|
|
1998
1992
|
stdio: 'inherit'
|
|
1999
1993
|
});
|
|
@@ -2170,7 +2164,6 @@ const create$2 = {
|
|
|
2170
2164
|
}));
|
|
2171
2165
|
if (reportData) {
|
|
2172
2166
|
formatReportDataOutput(reportData, {
|
|
2173
|
-
includeAllIssues,
|
|
2174
2167
|
name,
|
|
2175
2168
|
outputJson,
|
|
2176
2169
|
outputMarkdown,
|
|
@@ -2282,7 +2275,7 @@ async function setupCommand$g(name, description, argv, importMeta) {
|
|
|
2282
2275
|
cause
|
|
2283
2276
|
});
|
|
2284
2277
|
});
|
|
2285
|
-
const packagePaths = await
|
|
2278
|
+
const packagePaths = await npmPaths.getPackageFiles(cwd, cli.input, config$1, supportedFiles);
|
|
2286
2279
|
return {
|
|
2287
2280
|
config: config$1,
|
|
2288
2281
|
cwd,
|
|
@@ -2300,7 +2293,7 @@ async function createReport(packagePaths, {
|
|
|
2300
2293
|
cwd,
|
|
2301
2294
|
dryRun
|
|
2302
2295
|
}) {
|
|
2303
|
-
|
|
2296
|
+
npmPaths.debugLog('Uploading:', packagePaths.join(`\n${npmPaths.logSymbols.info} Uploading: `));
|
|
2304
2297
|
if (dryRun) {
|
|
2305
2298
|
return;
|
|
2306
2299
|
}
|
|
@@ -2670,7 +2663,7 @@ async function setupCommand$e(name, description, argv, importMeta) {
|
|
|
2670
2663
|
cause
|
|
2671
2664
|
});
|
|
2672
2665
|
});
|
|
2673
|
-
const packagePaths = await
|
|
2666
|
+
const packagePaths = await npmPaths.getPackageFilesFullScans(cwd, cli.input, supportedFiles);
|
|
2674
2667
|
const {
|
|
2675
2668
|
branch: branchName,
|
|
2676
2669
|
repo: repoName
|
|
@@ -3785,7 +3778,7 @@ const dependencies = {
|
|
|
3785
3778
|
}) {
|
|
3786
3779
|
const name = parentName + ' dependencies';
|
|
3787
3780
|
const input = setupCommand$3(name, dependencies.description, argv, importMeta);
|
|
3788
|
-
{
|
|
3781
|
+
if (input) {
|
|
3789
3782
|
await searchDeps(input);
|
|
3790
3783
|
}
|
|
3791
3784
|
}
|
|
@@ -4353,7 +4346,7 @@ const threatFeed = {
|
|
|
4353
4346
|
}) {
|
|
4354
4347
|
const name = `${parentName} threat-feed`;
|
|
4355
4348
|
const input = setupCommand(name, threatFeed.description, argv, importMeta);
|
|
4356
|
-
{
|
|
4349
|
+
if (input) {
|
|
4357
4350
|
const apiKey = socketUrl.getDefaultToken();
|
|
4358
4351
|
if (!apiKey) {
|
|
4359
4352
|
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.');
|
|
@@ -4574,7 +4567,7 @@ void (async () => {
|
|
|
4574
4567
|
} else {
|
|
4575
4568
|
errorTitle = 'Unexpected error with no details';
|
|
4576
4569
|
}
|
|
4577
|
-
console.error(`${
|
|
4570
|
+
console.error(`${npmPaths.logSymbols.error} ${colors.bgRed(colors.white(errorTitle + ':'))} ${errorMessage}`);
|
|
4578
4571
|
if (errorBody) {
|
|
4579
4572
|
console.error(`\n${errorBody}`);
|
|
4580
4573
|
}
|
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": "socket",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.43",
|
|
4
4
|
"description": "CLI tool for Socket.dev",
|
|
5
5
|
"homepage": "http://github.com/SocketDev/socket-cli",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@apideck/better-ajv-errors": "^0.3.6",
|
|
64
|
-
"@cyclonedx/cdxgen": "^11.1.
|
|
64
|
+
"@cyclonedx/cdxgen": "^11.1.7",
|
|
65
65
|
"@npmcli/promise-spawn": "^8.0.2",
|
|
66
66
|
"@socketregistry/hyrious__bun.lockb": "^1.0.12",
|
|
67
67
|
"@socketregistry/indent-string": "^1.0.9",
|
|
68
68
|
"@socketregistry/is-interactive": "^1.0.1",
|
|
69
69
|
"@socketregistry/is-unicode-supported": "^1.0.0",
|
|
70
70
|
"@socketsecurity/config": "^2.1.3",
|
|
71
|
-
"@socketsecurity/registry": "^1.0.
|
|
71
|
+
"@socketsecurity/registry": "^1.0.81",
|
|
72
72
|
"@socketsecurity/sdk": "^1.4.5",
|
|
73
73
|
"blessed": "^0.1.81",
|
|
74
74
|
"blessed-contrib": "^4.11.0",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"@babel/preset-env": "^7.26.7",
|
|
103
103
|
"@babel/preset-typescript": "^7.26.0",
|
|
104
104
|
"@babel/runtime": "^7.26.7",
|
|
105
|
-
"@eslint/compat": "^1.2.
|
|
105
|
+
"@eslint/compat": "^1.2.6",
|
|
106
106
|
"@eslint/js": "^9.19.0",
|
|
107
107
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
108
108
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"@types/micromatch": "^4.0.9",
|
|
116
116
|
"@types/mocha": "^10.0.10",
|
|
117
117
|
"@types/mock-fs": "^4.13.4",
|
|
118
|
-
"@types/node": "^22.
|
|
118
|
+
"@types/node": "^22.13.0",
|
|
119
119
|
"@types/npmcli__arborist": "^6.3.0",
|
|
120
120
|
"@types/npmcli__promise-spawn": "^6.0.3",
|
|
121
121
|
"@types/proc-log": "^3.0.4",
|
|
@@ -141,10 +141,10 @@
|
|
|
141
141
|
"mock-fs": "^5.4.1",
|
|
142
142
|
"nock": "^14.0.0",
|
|
143
143
|
"npm-run-all2": "^7.0.2",
|
|
144
|
-
"oxlint": "0.15.
|
|
144
|
+
"oxlint": "0.15.9",
|
|
145
145
|
"prettier": "3.4.2",
|
|
146
146
|
"read-package-up": "^11.0.0",
|
|
147
|
-
"rollup": "4.
|
|
147
|
+
"rollup": "4.34.1",
|
|
148
148
|
"rollup-plugin-ts": "^3.4.5",
|
|
149
149
|
"type-coverage": "^2.29.7",
|
|
150
150
|
"typescript": "5.4.5",
|
|
@@ -152,6 +152,7 @@
|
|
|
152
152
|
"unplugin-purge-polyfills": "^0.0.7"
|
|
153
153
|
},
|
|
154
154
|
"overrides": {
|
|
155
|
+
"@socketregistry/packageurl-js": "npm:@socketregistry/packageurl-js@^1",
|
|
155
156
|
"aggregate-error": "npm:@socketregistry/aggregate-error@^1",
|
|
156
157
|
"es-define-property": "npm:@socketregistry/es-define-property@^1",
|
|
157
158
|
"function-bind": "npm:@socketregistry/function-bind@^1",
|
|
@@ -178,6 +179,7 @@
|
|
|
178
179
|
"yaml": "$yaml"
|
|
179
180
|
},
|
|
180
181
|
"resolutions": {
|
|
182
|
+
"@socketregistry/packageurl-js": "npm:@socketregistry/packageurl-js@^1",
|
|
181
183
|
"aggregate-error": "npm:@socketregistry/aggregate-error@^1",
|
|
182
184
|
"es-define-property": "npm:@socketregistry/es-define-property@^1",
|
|
183
185
|
"function-bind": "npm:@socketregistry/function-bind@^1",
|