@socketsecurity/cli-with-sentry 0.14.44
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/LICENSE +21 -0
- package/README.md +121 -0
- package/bin/cli.js +57 -0
- package/bin/npm-cli.js +6 -0
- package/bin/npx-cli.js +6 -0
- package/dist/constants.d.ts +162 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/init.gradle +250 -0
- package/dist/instrument-with-sentry.d.ts +1 -0
- package/dist/instrument-with-sentry.js +58 -0
- package/dist/instrument-with-sentry.js.map +1 -0
- package/dist/module-sync/cli.d.ts +2 -0
- package/dist/module-sync/cli.js +6851 -0
- package/dist/module-sync/cli.js.map +1 -0
- package/dist/module-sync/constants.js +3 -0
- package/dist/module-sync/constants2.d.ts +0 -0
- package/dist/module-sync/constants2.js +231 -0
- package/dist/module-sync/constants2.js.map +1 -0
- package/dist/module-sync/debug.d.ts +3 -0
- package/dist/module-sync/edge.d.ts +66 -0
- package/dist/module-sync/errors.d.ts +14 -0
- package/dist/module-sync/index.d.ts +192 -0
- package/dist/module-sync/index.js +1879 -0
- package/dist/module-sync/index.js.map +1 -0
- package/dist/module-sync/logging.d.ts +16 -0
- package/dist/module-sync/node.d.ts +84 -0
- package/dist/module-sync/npm-injection.d.ts +1 -0
- package/dist/module-sync/npm-injection.js +26 -0
- package/dist/module-sync/npm-injection.js.map +1 -0
- package/dist/module-sync/npm-paths.d.ts +15 -0
- package/dist/module-sync/npm-paths.js +423 -0
- package/dist/module-sync/npm-paths.js.map +1 -0
- package/dist/module-sync/npm.d.ts +24 -0
- package/dist/module-sync/npm.js +99 -0
- package/dist/module-sync/npm.js.map +1 -0
- package/dist/module-sync/path-resolve.d.ts +12 -0
- package/dist/module-sync/proc-log.d.ts +3 -0
- package/dist/module-sync/reify.d.ts +1018 -0
- package/dist/module-sync/sdk.d.ts +5 -0
- package/dist/module-sync/settings.d.ts +15 -0
- package/dist/module-sync/shadow-bin.d.ts +2 -0
- package/dist/module-sync/shadow-bin.js +103 -0
- package/dist/module-sync/shadow-bin.js.map +1 -0
- package/dist/module-sync/types.d.ts +45 -0
- package/dist/require/cli.js +6848 -0
- package/dist/require/constants.js +3 -0
- package/dist/require/index.js +3 -0
- package/dist/require/npm-injection.js +3 -0
- package/dist/require/npm-paths.js +3 -0
- package/dist/require/npm.js +3 -0
- package/dist/require/shadow-bin.js +3 -0
- package/dist/require/vendor.js +11474 -0
- package/package.json +245 -0
- package/shadow-bin/npm +4 -0
- package/shadow-bin/npx +4 -0
- package/translations.json +592 -0
|
File without changes
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('node:fs');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var process = require('node:process');
|
|
6
|
+
var registryConstants = require('@socketsecurity/registry/lib/constants');
|
|
7
|
+
var env = require('@socketsecurity/registry/lib/env');
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
NODE_MODULES,
|
|
11
|
+
PACKAGE_JSON,
|
|
12
|
+
TAP,
|
|
13
|
+
kInternalsSymbol,
|
|
14
|
+
[kInternalsSymbol]: {
|
|
15
|
+
createConstantsObject
|
|
16
|
+
}
|
|
17
|
+
} = registryConstants;
|
|
18
|
+
const ALERT_TYPE_CRITICAL_CVE = 'criticalCVE';
|
|
19
|
+
const ALERT_TYPE_CVE = 'cve';
|
|
20
|
+
const ALERT_TYPE_MEDIUM_CVE = 'mediumCVE';
|
|
21
|
+
const ALERT_TYPE_MILD_CVE = 'mildCVE';
|
|
22
|
+
const ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE = 'socketUpgradeAvailable';
|
|
23
|
+
const API_V0_URL = 'https://api.socket.dev/v0';
|
|
24
|
+
const BABEL_RUNTIME = '@babel/runtime';
|
|
25
|
+
const BINARY_LOCK_EXT = '.lockb';
|
|
26
|
+
const BUN = 'bun';
|
|
27
|
+
const CLI = 'cli';
|
|
28
|
+
const CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER = 'firstPatchedVersionIdentifier';
|
|
29
|
+
const CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE = 'vulnerableVersionRange';
|
|
30
|
+
const LOCK_EXT = '.lock';
|
|
31
|
+
const MODULE_SYNC = 'module-sync';
|
|
32
|
+
const NPM_INJECTION = 'npm-injection';
|
|
33
|
+
const NPM_REGISTRY_URL = 'https://registry.npmjs.org';
|
|
34
|
+
const NPX = 'npx';
|
|
35
|
+
const PNPM = 'pnpm';
|
|
36
|
+
const REQUIRE = 'require';
|
|
37
|
+
const SHADOW_BIN = 'shadow-bin';
|
|
38
|
+
const SOCKET = 'socket';
|
|
39
|
+
const SOCKET_CLI_DEBUG = 'SOCKET_CLI_DEBUG';
|
|
40
|
+
const SOCKET_CLI_FIX = 'SOCKET_CLI_FIX';
|
|
41
|
+
const SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues';
|
|
42
|
+
const SOCKET_CLI_LEGACY_BUILD = 'SOCKET_CLI_LEGACY_BUILD';
|
|
43
|
+
const SOCKET_CLI_OPTIMIZE = 'SOCKET_CLI_OPTIMIZE';
|
|
44
|
+
const SOCKET_CLI_PUBLISHED_BUILD = 'SOCKET_CLI_PUBLISHED_BUILD';
|
|
45
|
+
const SOCKET_CLI_SAFE_WRAPPER = 'SOCKET_CLI_SAFE_WRAPPER';
|
|
46
|
+
const SOCKET_CLI_SENTRY_BUILD = 'SOCKET_CLI_SENTRY_BUILD';
|
|
47
|
+
const SOCKET_CLI_VERSION_HASH = 'SOCKET_CLI_VERSION_HASH';
|
|
48
|
+
const VLT = 'vlt';
|
|
49
|
+
const YARN = 'yarn';
|
|
50
|
+
const YARN_BERRY = `${YARN}/berry`;
|
|
51
|
+
const YARN_CLASSIC = `${YARN}/classic`;
|
|
52
|
+
let _Sentry;
|
|
53
|
+
const LAZY_BATCH_PURL_ENDPOINT = () => {
|
|
54
|
+
const query = new URLSearchParams();
|
|
55
|
+
query.append('alerts', 'true');
|
|
56
|
+
query.append('compact', 'true');
|
|
57
|
+
return `${API_V0_URL}/purl?${query}`;
|
|
58
|
+
};
|
|
59
|
+
const LAZY_DIST_TYPE = () => registryConstants.SUPPORTS_NODE_REQUIRE_MODULE ? MODULE_SYNC : REQUIRE;
|
|
60
|
+
const LAZY_ENV = () => Object.freeze({
|
|
61
|
+
// Lazily access registryConstants.ENV.
|
|
62
|
+
...registryConstants.ENV,
|
|
63
|
+
// Flag set to help debug Socket CLI.
|
|
64
|
+
[SOCKET_CLI_DEBUG]: env.envAsBoolean(process.env[SOCKET_CLI_DEBUG]),
|
|
65
|
+
// Inline the following environment values so that they CANNOT be influenced
|
|
66
|
+
// by user provided environment variables.
|
|
67
|
+
//
|
|
68
|
+
// Flag set to determine if this is the Legacy build.
|
|
69
|
+
// The '@rollup/plugin-replace' will replace "process.env[SOCKET_CLI_LEGACY_BUILD]".
|
|
70
|
+
[SOCKET_CLI_LEGACY_BUILD]: false,
|
|
71
|
+
// Flag set to determine if this is a published build.
|
|
72
|
+
// The '@rollup/plugin-replace' will replace "process.env[SOCKET_CLI_PUBLISHED_BUILD]".
|
|
73
|
+
[SOCKET_CLI_PUBLISHED_BUILD]: true,
|
|
74
|
+
// Flag set to determine if this is the Sentry build.
|
|
75
|
+
// The '@rollup/plugin-replace' will replace "process.env[SOCKET_CLI_SENTRY_BUILD]".
|
|
76
|
+
[SOCKET_CLI_SENTRY_BUILD]: true,
|
|
77
|
+
// Flag set to determine the version hash of the build.
|
|
78
|
+
// The '@rollup/plugin-replace' will replace "process.env[SOCKET_CLI_VERSION_HASH]".
|
|
79
|
+
[SOCKET_CLI_VERSION_HASH]: "0.14.44:d759761:ba5ca849:pub"
|
|
80
|
+
});
|
|
81
|
+
const lazyCdxgenBinPath = () =>
|
|
82
|
+
// Lazily access constants.nmBinPath.
|
|
83
|
+
path.join(constants.nmBinPath, 'cdxgen');
|
|
84
|
+
const lazyDistPath = () =>
|
|
85
|
+
// Lazily access constants.rootDistPath and constants.DIST_TYPE.
|
|
86
|
+
path.join(constants.rootDistPath, constants.DIST_TYPE);
|
|
87
|
+
const lazyInstrumentWithSentryPath = () =>
|
|
88
|
+
// Lazily access constants.rootDistPath.
|
|
89
|
+
path.join(constants.rootDistPath, 'instrument-with-sentry.js');
|
|
90
|
+
const lazyNmBinPath = () =>
|
|
91
|
+
// Lazily access constants.rootPath.
|
|
92
|
+
path.join(constants.rootPath, `${NODE_MODULES}/.bin`);
|
|
93
|
+
const lazyNpmInjectionPath = () =>
|
|
94
|
+
// Lazily access constants.distPath.
|
|
95
|
+
path.join(constants.distPath, `${NPM_INJECTION}.js`);
|
|
96
|
+
const lazyRootBinPath = () =>
|
|
97
|
+
// Lazily access constants.rootPath.
|
|
98
|
+
path.join(constants.rootPath, 'bin');
|
|
99
|
+
const lazyRootDistPath = () =>
|
|
100
|
+
// Lazily access constants.rootPath.
|
|
101
|
+
path.join(constants.rootPath, 'dist');
|
|
102
|
+
const lazyRootPath = () =>
|
|
103
|
+
// The '@rollup/plugin-replace' will replace "process.env.[TAP]".
|
|
104
|
+
path.resolve(fs.realpathSync.native(__dirname), '..');
|
|
105
|
+
const lazyRootPkgJsonPath = () =>
|
|
106
|
+
// Lazily access constants.rootPath.
|
|
107
|
+
path.join(constants.rootPath, PACKAGE_JSON);
|
|
108
|
+
const lazyShadowBinPath = () =>
|
|
109
|
+
// Lazily access constants.rootPath.
|
|
110
|
+
path.join(constants.rootPath, SHADOW_BIN);
|
|
111
|
+
const lazySynpBinPath = () =>
|
|
112
|
+
// Lazily access constants.nmBinPath.
|
|
113
|
+
path.join(constants.nmBinPath, 'synp');
|
|
114
|
+
const constants = createConstantsObject({
|
|
115
|
+
ALERT_TYPE_CRITICAL_CVE,
|
|
116
|
+
ALERT_TYPE_CVE,
|
|
117
|
+
ALERT_TYPE_MEDIUM_CVE,
|
|
118
|
+
ALERT_TYPE_MILD_CVE,
|
|
119
|
+
ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE,
|
|
120
|
+
API_V0_URL,
|
|
121
|
+
BABEL_RUNTIME,
|
|
122
|
+
// Lazily defined values are initialized as `undefined` to keep their key order.
|
|
123
|
+
BATCH_PURL_ENDPOINT: undefined,
|
|
124
|
+
BINARY_LOCK_EXT,
|
|
125
|
+
BUN,
|
|
126
|
+
CLI,
|
|
127
|
+
CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER,
|
|
128
|
+
CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE,
|
|
129
|
+
DIST_TYPE: undefined,
|
|
130
|
+
ENV: undefined,
|
|
131
|
+
LOCK_EXT,
|
|
132
|
+
MODULE_SYNC,
|
|
133
|
+
NPM_INJECTION,
|
|
134
|
+
NPM_REGISTRY_URL,
|
|
135
|
+
NPX,
|
|
136
|
+
PNPM,
|
|
137
|
+
REQUIRE,
|
|
138
|
+
SHADOW_BIN,
|
|
139
|
+
SOCKET,
|
|
140
|
+
SOCKET_CLI_DEBUG,
|
|
141
|
+
SOCKET_CLI_FIX,
|
|
142
|
+
SOCKET_CLI_ISSUES_URL,
|
|
143
|
+
SOCKET_CLI_LEGACY_BUILD,
|
|
144
|
+
SOCKET_CLI_OPTIMIZE,
|
|
145
|
+
SOCKET_CLI_PUBLISHED_BUILD,
|
|
146
|
+
SOCKET_CLI_SAFE_WRAPPER,
|
|
147
|
+
SOCKET_CLI_SENTRY_BUILD,
|
|
148
|
+
SOCKET_CLI_VERSION_HASH,
|
|
149
|
+
VLT,
|
|
150
|
+
YARN,
|
|
151
|
+
YARN_BERRY,
|
|
152
|
+
YARN_CLASSIC,
|
|
153
|
+
cdxgenBinPath: undefined,
|
|
154
|
+
distPath: undefined,
|
|
155
|
+
instrumentWithSentryPath: undefined,
|
|
156
|
+
nmBinPath: undefined,
|
|
157
|
+
npmInjectionPath: undefined,
|
|
158
|
+
rootBinPath: undefined,
|
|
159
|
+
rootDistPath: undefined,
|
|
160
|
+
rootPath: undefined,
|
|
161
|
+
rootPkgJsonPath: undefined,
|
|
162
|
+
shadowBinPath: undefined,
|
|
163
|
+
synpBinPath: undefined
|
|
164
|
+
}, {
|
|
165
|
+
getters: {
|
|
166
|
+
BATCH_PURL_ENDPOINT: LAZY_BATCH_PURL_ENDPOINT,
|
|
167
|
+
DIST_TYPE: LAZY_DIST_TYPE,
|
|
168
|
+
ENV: LAZY_ENV,
|
|
169
|
+
distPath: lazyDistPath,
|
|
170
|
+
cdxgenBinPath: lazyCdxgenBinPath,
|
|
171
|
+
instrumentWithSentryPath: lazyInstrumentWithSentryPath,
|
|
172
|
+
nmBinPath: lazyNmBinPath,
|
|
173
|
+
npmInjectionPath: lazyNpmInjectionPath,
|
|
174
|
+
rootBinPath: lazyRootBinPath,
|
|
175
|
+
rootDistPath: lazyRootDistPath,
|
|
176
|
+
rootPath: lazyRootPath,
|
|
177
|
+
rootPkgJsonPath: lazyRootPkgJsonPath,
|
|
178
|
+
shadowBinPath: lazyShadowBinPath,
|
|
179
|
+
synpBinPath: lazySynpBinPath
|
|
180
|
+
},
|
|
181
|
+
internals: {
|
|
182
|
+
getSentry() {
|
|
183
|
+
return _Sentry;
|
|
184
|
+
},
|
|
185
|
+
setSentry(Sentry) {
|
|
186
|
+
if (_Sentry === undefined) {
|
|
187
|
+
_Sentry = Sentry;
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
mixin: registryConstants
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
var constants$1 = {
|
|
197
|
+
__proto__: null,
|
|
198
|
+
default: constants
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
function getAugmentedNamespace(n) {
|
|
202
|
+
if (n.__esModule) return n;
|
|
203
|
+
var f = n.default;
|
|
204
|
+
if (typeof f == "function") {
|
|
205
|
+
var a = function a () {
|
|
206
|
+
if (this instanceof a) {
|
|
207
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
208
|
+
}
|
|
209
|
+
return f.apply(this, arguments);
|
|
210
|
+
};
|
|
211
|
+
a.prototype = f.prototype;
|
|
212
|
+
} else a = {};
|
|
213
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
214
|
+
Object.keys(n).forEach(function (k) {
|
|
215
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
216
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function () {
|
|
219
|
+
return n[k];
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
return a;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
var require$$1 = /*@__PURE__*/getAugmentedNamespace(constants$1);
|
|
227
|
+
|
|
228
|
+
exports.constants = constants;
|
|
229
|
+
exports.require$$1 = require$$1;
|
|
230
|
+
//# debugId=435f32a3-529f-42d3-a920-3fda62a829e2
|
|
231
|
+
//# sourceMappingURL=constants2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants2.js","sources":["../../src/constants.ts"],"sourcesContent":["import { realpathSync } from 'node:fs'\nimport path from 'node:path'\nimport process from 'node:process'\n\nimport registryConstants from '@socketsecurity/registry/lib/constants'\nimport { envAsBoolean } from '@socketsecurity/registry/lib/env'\n\nimport type { Remap } from '@socketsecurity/registry/lib/objects'\n\nconst {\n NODE_MODULES,\n PACKAGE_JSON,\n TAP,\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: {\n createConstantsObject\n }\n} = registryConstants\n\ntype RegistryEnv = typeof registryConstants.ENV\n\ntype RegistryInternals = (typeof registryConstants)['Symbol(kInternalsSymbol)']\n\ntype Sentry = any\n\ntype Internals = Remap<\n Omit<RegistryInternals, 'getIPC'> &\n Readonly<{\n getIPC: {\n (): Promise<IPC>\n <K extends keyof IPC | undefined>(\n key?: K\n ): Promise<K extends keyof IPC ? IPC[K] : IPC>\n }\n getSentry: () => Sentry\n setSentry(Sentry: Sentry): boolean\n }>\n>\n\ntype ENV = Remap<\n RegistryEnv &\n Readonly<{\n SOCKET_CLI_DEBUG: boolean\n SOCKET_CLI_LEGACY_BUILD: boolean\n SOCKET_CLI_PUBLISHED_BUILD: boolean\n SOCKET_CLI_SENTRY_BUILD: boolean\n SOCKET_CLI_VERSION_HASH: string\n }>\n>\n\ntype IPC = Readonly<{\n SOCKET_CLI_FIX?: string\n SOCKET_CLI_OPTIMIZE?: boolean\n SOCKET_CLI_SAFE_WRAPPER?: boolean\n}>\n\ntype Constants = Remap<\n Omit<typeof registryConstants, 'Symbol(kInternalsSymbol)' | 'ENV' | 'IPC'> & {\n readonly 'Symbol(kInternalsSymbol)': Internals\n readonly ALERT_TYPE_CRITICAL_CVE: 'criticalCVE'\n readonly ALERT_TYPE_CVE: 'cve'\n readonly ALERT_TYPE_MEDIUM_CVE: 'mediumCVE'\n readonly ALERT_TYPE_MILD_CVE: 'mildCVE'\n readonly ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE: 'socketUpgradeAvailable'\n readonly API_V0_URL: 'https://api.socket.dev/v0'\n readonly BABEL_RUNTIME: '@babel/runtime'\n readonly BATCH_PURL_ENDPOINT: 'https://api.socket.dev/v0/purl?alerts=true&compact=true'\n readonly BINARY_LOCK_EXT: '.lockb'\n readonly BUN: 'bun'\n readonly CLI: 'cli'\n readonly CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER: 'firstPatchedVersionIdentifier'\n readonly CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE: 'vulnerableVersionRange'\n readonly ENV: ENV\n readonly DIST_TYPE: 'module-sync' | 'require'\n readonly IPC: IPC\n readonly LOCK_EXT: '.lock'\n readonly MODULE_SYNC: 'module-sync'\n readonly NPM_INJECTION: 'npm-injection'\n readonly NPM_REGISTRY_URL: 'https://registry.npmjs.org'\n readonly NPX: 'npx'\n readonly PNPM: 'pnpm'\n readonly REQUIRE: 'require'\n readonly SHADOW_BIN: 'shadow-bin'\n readonly SOCKET: 'socket'\n readonly SOCKET_CLI_DEBUG: 'SOCKET_CLI_DEBUG'\n readonly SOCKET_CLI_FIX: 'SOCKET_CLI_FIX'\n readonly SOCKET_CLI_ISSUES_URL: 'https://github.com/SocketDev/socket-cli/issues'\n readonly SOCKET_CLI_LEGACY_BUILD: 'SOCKET_CLI_LEGACY_BUILD'\n readonly SOCKET_CLI_OPTIMIZE: 'SOCKET_CLI_OPTIMIZE'\n readonly SOCKET_CLI_PUBLISHED_BUILD: 'SOCKET_CLI_PUBLISHED_BUILD'\n readonly SOCKET_CLI_SAFE_WRAPPER: 'SOCKET_CLI_SAFE_WRAPPER'\n readonly SOCKET_CLI_SENTRY_BUILD: 'SOCKET_CLI_SENTRY_BUILD'\n readonly SOCKET_CLI_VERSION_HASH: 'SOCKET_CLI_VERSION_HASH'\n readonly VLT: 'vlt'\n readonly YARN: 'yarn'\n readonly YARN_BERRY: 'yarn/berry'\n readonly YARN_CLASSIC: 'yarn/classic'\n readonly cdxgenBinPath: string\n readonly distPath: string\n readonly instrumentWithSentryPath: string\n readonly nmBinPath: string\n readonly npmInjectionPath: string\n readonly rootBinPath: string\n readonly rootDistPath: string\n readonly rootPath: string\n readonly rootPkgJsonPath: string\n readonly shadowBinPath: string\n readonly synpBinPath: string\n }\n>\n\nconst ALERT_TYPE_CRITICAL_CVE = 'criticalCVE'\nconst ALERT_TYPE_CVE = 'cve'\nconst ALERT_TYPE_MEDIUM_CVE = 'mediumCVE'\nconst ALERT_TYPE_MILD_CVE = 'mildCVE'\nconst ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE = 'socketUpgradeAvailable'\nconst API_V0_URL = 'https://api.socket.dev/v0'\nconst BABEL_RUNTIME = '@babel/runtime'\nconst BINARY_LOCK_EXT = '.lockb'\nconst BUN = 'bun'\nconst CLI = 'cli'\nconst CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER =\n 'firstPatchedVersionIdentifier'\nconst CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE = 'vulnerableVersionRange'\nconst LOCK_EXT = '.lock'\nconst MODULE_SYNC = 'module-sync'\nconst NPM_INJECTION = 'npm-injection'\nconst NPM_REGISTRY_URL = 'https://registry.npmjs.org'\nconst NPX = 'npx'\nconst PNPM = 'pnpm'\nconst REQUIRE = 'require'\nconst SHADOW_BIN = 'shadow-bin'\nconst SOCKET = 'socket'\nconst SOCKET_CLI_DEBUG = 'SOCKET_CLI_DEBUG'\nconst SOCKET_CLI_FIX = 'SOCKET_CLI_FIX'\nconst SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues'\nconst SOCKET_CLI_LEGACY_BUILD = 'SOCKET_CLI_LEGACY_BUILD'\nconst SOCKET_CLI_OPTIMIZE = 'SOCKET_CLI_OPTIMIZE'\nconst SOCKET_CLI_PUBLISHED_BUILD = 'SOCKET_CLI_PUBLISHED_BUILD'\nconst SOCKET_CLI_SAFE_WRAPPER = 'SOCKET_CLI_SAFE_WRAPPER'\nconst SOCKET_CLI_SENTRY_BUILD = 'SOCKET_CLI_SENTRY_BUILD'\nconst SOCKET_CLI_VERSION_HASH = 'SOCKET_CLI_VERSION_HASH'\nconst VLT = 'vlt'\nconst YARN = 'yarn'\nconst YARN_BERRY = `${YARN}/berry`\nconst YARN_CLASSIC = `${YARN}/classic`\n\nlet _Sentry: any\n\nconst LAZY_BATCH_PURL_ENDPOINT = () => {\n const query = new URLSearchParams()\n query.append('alerts', 'true')\n query.append('compact', 'true')\n return `${API_V0_URL}/purl?${query}`\n}\n\nconst LAZY_DIST_TYPE = () =>\n registryConstants.SUPPORTS_NODE_REQUIRE_MODULE ? MODULE_SYNC : REQUIRE\n\nconst LAZY_ENV = () =>\n Object.freeze({\n // Lazily access registryConstants.ENV.\n ...registryConstants.ENV,\n // Flag set to help debug Socket CLI.\n [SOCKET_CLI_DEBUG]: envAsBoolean(process.env[SOCKET_CLI_DEBUG]),\n // Inline the following environment values so that they CANNOT be influenced\n // by user provided environment variables.\n //\n // Flag set to determine if this is the Legacy build.\n // The '@rollup/plugin-replace' will replace \"process.env[SOCKET_CLI_LEGACY_BUILD]\".\n [SOCKET_CLI_LEGACY_BUILD]: process.env[SOCKET_CLI_LEGACY_BUILD],\n // Flag set to determine if this is a published build.\n // The '@rollup/plugin-replace' will replace \"process.env[SOCKET_CLI_PUBLISHED_BUILD]\".\n [SOCKET_CLI_PUBLISHED_BUILD]: process.env[SOCKET_CLI_PUBLISHED_BUILD],\n // Flag set to determine if this is the Sentry build.\n // The '@rollup/plugin-replace' will replace \"process.env[SOCKET_CLI_SENTRY_BUILD]\".\n [SOCKET_CLI_SENTRY_BUILD]: process.env[SOCKET_CLI_SENTRY_BUILD],\n // Flag set to determine the version hash of the build.\n // The '@rollup/plugin-replace' will replace \"process.env[SOCKET_CLI_VERSION_HASH]\".\n [SOCKET_CLI_VERSION_HASH]: process.env[SOCKET_CLI_VERSION_HASH]\n })\n\nconst lazyCdxgenBinPath = () =>\n // Lazily access constants.nmBinPath.\n path.join(constants.nmBinPath, 'cdxgen')\n\nconst lazyDistPath = () =>\n // Lazily access constants.rootDistPath and constants.DIST_TYPE.\n path.join(constants.rootDistPath, constants.DIST_TYPE)\n\nconst lazyInstrumentWithSentryPath = () =>\n // Lazily access constants.rootDistPath.\n path.join(constants.rootDistPath, 'instrument-with-sentry.js')\n\nconst lazyNmBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, `${NODE_MODULES}/.bin`)\n\nconst lazyNpmInjectionPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, `${NPM_INJECTION}.js`)\n\nconst lazyRootBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'bin')\n\nconst lazyRootDistPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'dist')\n\nconst lazyRootPath = () =>\n // The '@rollup/plugin-replace' will replace \"process.env.[TAP]\".\n path.resolve(\n realpathSync.native(__dirname),\n process.env[TAP] ? '../..' : '..'\n )\n\nconst lazyRootPkgJsonPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, PACKAGE_JSON)\n\nconst lazyShadowBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, SHADOW_BIN)\n\nconst lazySynpBinPath = () =>\n // Lazily access constants.nmBinPath.\n path.join(constants.nmBinPath, 'synp')\n\nconst constants = <Constants>createConstantsObject(\n {\n ALERT_TYPE_CRITICAL_CVE,\n ALERT_TYPE_CVE,\n ALERT_TYPE_MEDIUM_CVE,\n ALERT_TYPE_MILD_CVE,\n ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE,\n API_V0_URL,\n BABEL_RUNTIME,\n // Lazily defined values are initialized as `undefined` to keep their key order.\n BATCH_PURL_ENDPOINT: undefined,\n BINARY_LOCK_EXT,\n BUN,\n CLI,\n CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER,\n CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE,\n DIST_TYPE: undefined,\n ENV: undefined,\n LOCK_EXT,\n MODULE_SYNC,\n NPM_INJECTION,\n NPM_REGISTRY_URL,\n NPX,\n PNPM,\n REQUIRE,\n SHADOW_BIN,\n SOCKET,\n SOCKET_CLI_DEBUG,\n SOCKET_CLI_FIX,\n SOCKET_CLI_ISSUES_URL,\n SOCKET_CLI_LEGACY_BUILD,\n SOCKET_CLI_OPTIMIZE,\n SOCKET_CLI_PUBLISHED_BUILD,\n SOCKET_CLI_SAFE_WRAPPER,\n SOCKET_CLI_SENTRY_BUILD,\n SOCKET_CLI_VERSION_HASH,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n cdxgenBinPath: undefined,\n distPath: undefined,\n instrumentWithSentryPath: undefined,\n nmBinPath: undefined,\n npmInjectionPath: undefined,\n rootBinPath: undefined,\n rootDistPath: undefined,\n rootPath: undefined,\n rootPkgJsonPath: undefined,\n shadowBinPath: undefined,\n synpBinPath: undefined\n },\n {\n getters: {\n BATCH_PURL_ENDPOINT: LAZY_BATCH_PURL_ENDPOINT,\n DIST_TYPE: LAZY_DIST_TYPE,\n ENV: LAZY_ENV,\n distPath: lazyDistPath,\n cdxgenBinPath: lazyCdxgenBinPath,\n instrumentWithSentryPath: lazyInstrumentWithSentryPath,\n nmBinPath: lazyNmBinPath,\n npmInjectionPath: lazyNpmInjectionPath,\n rootBinPath: lazyRootBinPath,\n rootDistPath: lazyRootDistPath,\n rootPath: lazyRootPath,\n rootPkgJsonPath: lazyRootPkgJsonPath,\n shadowBinPath: lazyShadowBinPath,\n synpBinPath: lazySynpBinPath\n },\n internals: {\n getSentry() {\n return _Sentry\n },\n setSentry(Sentry: Sentry): boolean {\n if (_Sentry === undefined) {\n _Sentry = Sentry\n return true\n }\n return false\n }\n },\n mixin: registryConstants\n }\n)\n\nexport default constants\n"],"names":["createConstantsObject","query","path","constants","BATCH_PURL_ENDPOINT","DIST_TYPE","ENV","cdxgenBinPath","distPath","instrumentWithSentryPath","nmBinPath","npmInjectionPath","rootBinPath","rootDistPath","rootPath","rootPkgJsonPath","shadowBinPath","synpBinPath","getters","internals","getSentry","_Sentry","mixin"],"mappings":";;;;;;;;AASA;;;;;AAKE;AACEA;AACF;AACF;AA8FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACE;AACAC;AACAA;AACA;AACF;AAEA;AAGA;AAEI;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF;AAEF;AACE;AACAC;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAKF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEIC;;;;;;;;AASF;AACAC;;;;;;AAMAC;AACAC;;;;;;;;;;;;;;;;;;;;;;;AAuBAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACF;AAEEC;AACEd;AACAC;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;;AAEFE;AACEC;AACE;;;;AAIEC;AACA;AACF;AACA;AACF;;AAEFC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","debugId":"435f32a3-529f-42d3-a920-3fda62a829e2"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/// <reference types="npmcli__arborist" />
|
|
2
|
+
import { SafeNode } from "./node.js";
|
|
3
|
+
import { SafeOverrideSet } from "./index.js";
|
|
4
|
+
import { DependencyProblem } from '@npmcli/arborist';
|
|
5
|
+
import { Edge as BaseEdge } from "@npmcli/arborist";
|
|
6
|
+
type EdgeClass = Omit<BaseEdge, 'accept' | 'detach' | 'optional' | 'overrides' | 'peer' | 'peerConflicted' | 'rawSpec' | 'reload' | 'satisfiedBy' | 'spec' | 'to'> & {
|
|
7
|
+
optional: boolean;
|
|
8
|
+
overrides: SafeOverrideSet | undefined;
|
|
9
|
+
peer: boolean;
|
|
10
|
+
peerConflicted: boolean;
|
|
11
|
+
rawSpec: string;
|
|
12
|
+
get accept(): string | undefined;
|
|
13
|
+
get spec(): string;
|
|
14
|
+
get to(): SafeNode | null;
|
|
15
|
+
new (...args: any): EdgeClass;
|
|
16
|
+
detach(): void;
|
|
17
|
+
reload(hard?: boolean): void;
|
|
18
|
+
satisfiedBy(node: SafeNode): boolean;
|
|
19
|
+
};
|
|
20
|
+
type EdgeOptions = {
|
|
21
|
+
type: string;
|
|
22
|
+
name: string;
|
|
23
|
+
spec: string;
|
|
24
|
+
from: SafeNode;
|
|
25
|
+
accept?: string | undefined;
|
|
26
|
+
overrides?: SafeOverrideSet | undefined;
|
|
27
|
+
to?: SafeNode;
|
|
28
|
+
};
|
|
29
|
+
type ErrorStatus = DependencyProblem | 'OK';
|
|
30
|
+
type Explanation = {
|
|
31
|
+
type: string;
|
|
32
|
+
name: string;
|
|
33
|
+
spec: string;
|
|
34
|
+
bundled: boolean;
|
|
35
|
+
overridden: boolean;
|
|
36
|
+
error: ErrorStatus | undefined;
|
|
37
|
+
rawSpec: string | undefined;
|
|
38
|
+
from: object | undefined;
|
|
39
|
+
} | null;
|
|
40
|
+
declare const Edge: EdgeClass;
|
|
41
|
+
declare class SafeEdge extends Edge {
|
|
42
|
+
#private;
|
|
43
|
+
constructor(options: EdgeOptions);
|
|
44
|
+
get accept(): string | undefined;
|
|
45
|
+
get bundled(): boolean;
|
|
46
|
+
get error(): "DETACHED" | "MISSING" | "PEER LOCAL" | "INVALID" | null;
|
|
47
|
+
get from(): SafeNode | null;
|
|
48
|
+
get spec(): string;
|
|
49
|
+
get to(): SafeNode | null;
|
|
50
|
+
detach(): void;
|
|
51
|
+
// Return the edge data, and an explanation of how that edge came to be here.
|
|
52
|
+
// @ts-ignore: Edge#explain is defined with an unused `seen = []` param.
|
|
53
|
+
explain(): {
|
|
54
|
+
type: string;
|
|
55
|
+
name: string;
|
|
56
|
+
spec: string;
|
|
57
|
+
bundled: boolean;
|
|
58
|
+
overridden: boolean;
|
|
59
|
+
error: ErrorStatus | undefined;
|
|
60
|
+
rawSpec: string | undefined;
|
|
61
|
+
from: object | undefined;
|
|
62
|
+
};
|
|
63
|
+
reload(hard?: boolean): void;
|
|
64
|
+
satisfiedBy(node: SafeNode): boolean;
|
|
65
|
+
}
|
|
66
|
+
export { EdgeOptions, ErrorStatus, Explanation, Edge, SafeEdge };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
type EventHintOrCaptureContext = {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
} | Function;
|
|
5
|
+
declare class AuthError extends Error {
|
|
6
|
+
}
|
|
7
|
+
declare class InputError extends Error {
|
|
8
|
+
body: string | undefined;
|
|
9
|
+
constructor(message: string, body?: string);
|
|
10
|
+
}
|
|
11
|
+
declare function captureException(exception: unknown, hint?: EventHintOrCaptureContext | undefined): Promise<string>;
|
|
12
|
+
declare function captureExceptionSync(exception: unknown, hint?: EventHintOrCaptureContext | undefined): string;
|
|
13
|
+
declare function isErrnoException(value: unknown): value is NodeJS.ErrnoException;
|
|
14
|
+
export { AuthError, InputError, captureException, captureExceptionSync, isErrnoException };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { SafeEdge } from "./edge.js";
|
|
3
|
+
import { SafeNode } from "./node.js";
|
|
4
|
+
import indentString from "@socketregistry/indent-string/index.cjs";
|
|
5
|
+
import { LogSymbols } from "./logging.js";
|
|
6
|
+
import { SocketSdkResultType } from "@socketsecurity/sdk";
|
|
7
|
+
import { Diff, ArboristClass } from "./types.js";
|
|
8
|
+
import { ObjectEncodingOptions, OpenMode, PathLike } from "node:fs";
|
|
9
|
+
import { promises as fs } from "node:fs";
|
|
10
|
+
import { readFileSync as fsReadFileSync } from "node:fs";
|
|
11
|
+
import { Abortable } from "node:events";
|
|
12
|
+
import { FileHandle } from "node:fs/promises";
|
|
13
|
+
import { kRiskyReify } from "./reify.js";
|
|
14
|
+
interface OverrideSetClass {
|
|
15
|
+
children: Map<string, SafeOverrideSet>;
|
|
16
|
+
key: string | undefined;
|
|
17
|
+
keySpec: string | undefined;
|
|
18
|
+
name: string | undefined;
|
|
19
|
+
parent: SafeOverrideSet | undefined;
|
|
20
|
+
value: string | undefined;
|
|
21
|
+
version: string | undefined;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-new
|
|
23
|
+
new (...args: any[]): OverrideSetClass;
|
|
24
|
+
get isRoot(): boolean;
|
|
25
|
+
get ruleset(): Map<string, SafeOverrideSet>;
|
|
26
|
+
ancestry(): Generator<SafeOverrideSet>;
|
|
27
|
+
childrenAreEqual(otherOverrideSet: SafeOverrideSet | undefined): boolean;
|
|
28
|
+
getEdgeRule(edge: SafeEdge): SafeOverrideSet;
|
|
29
|
+
getNodeRule(node: SafeNode): SafeOverrideSet;
|
|
30
|
+
getMatchingRule(node: SafeNode): SafeOverrideSet | null;
|
|
31
|
+
isEqual(otherOverrideSet: SafeOverrideSet | undefined): boolean;
|
|
32
|
+
}
|
|
33
|
+
declare const OverrideSet: OverrideSetClass;
|
|
34
|
+
// Implementation code not related to patch https://github.com/npm/cli/pull/7025
|
|
35
|
+
// is based on https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/override-set.js:
|
|
36
|
+
declare class SafeOverrideSet extends OverrideSet {
|
|
37
|
+
// Patch adding doOverrideSetsConflict is based on
|
|
38
|
+
// https://github.com/npm/cli/pull/7025.
|
|
39
|
+
static doOverrideSetsConflict(first: SafeOverrideSet | undefined, second: SafeOverrideSet | undefined): boolean;
|
|
40
|
+
// Patch adding findSpecificOverrideSet is based on
|
|
41
|
+
// https://github.com/npm/cli/pull/7025.
|
|
42
|
+
static findSpecificOverrideSet(first: SafeOverrideSet | undefined, second: SafeOverrideSet | undefined): SafeOverrideSet | undefined;
|
|
43
|
+
// Patch adding childrenAreEqual is based on
|
|
44
|
+
// https://github.com/npm/cli/pull/7025.
|
|
45
|
+
childrenAreEqual(otherOverrideSet: SafeOverrideSet): boolean;
|
|
46
|
+
getEdgeRule(edge: SafeEdge): SafeOverrideSet;
|
|
47
|
+
// Patch adding isEqual is based on
|
|
48
|
+
// https://github.com/npm/cli/pull/7025.
|
|
49
|
+
isEqual(otherOverrideSet: SafeOverrideSet | undefined): boolean;
|
|
50
|
+
}
|
|
51
|
+
declare const depValid: (child: SafeNode, requested: string, accept: string | undefined, requester: SafeNode) => boolean;
|
|
52
|
+
declare function getSocketDevAlertUrl(alertType: string): string;
|
|
53
|
+
declare function getSocketDevPackageOverviewUrl(eco: string, name: string, version?: string): string;
|
|
54
|
+
declare class ColorOrMarkdown {
|
|
55
|
+
useMarkdown: boolean;
|
|
56
|
+
constructor(useMarkdown: boolean);
|
|
57
|
+
bold(text: string): string;
|
|
58
|
+
header(text: string, level?: number): string;
|
|
59
|
+
hyperlink(text: string, url: string | undefined, { fallback, fallbackToUrl }?: {
|
|
60
|
+
fallback?: boolean;
|
|
61
|
+
fallbackToUrl?: boolean;
|
|
62
|
+
}): string;
|
|
63
|
+
indent(...args: Parameters<typeof indentString>): ReturnType<typeof indentString>;
|
|
64
|
+
italic(text: string): string;
|
|
65
|
+
json(value: any): string;
|
|
66
|
+
list(items: string[]): string;
|
|
67
|
+
get logSymbols(): LogSymbols;
|
|
68
|
+
}
|
|
69
|
+
type AlertUxLookup = ReturnType<typeof createAlertUXLookup>;
|
|
70
|
+
type AlertUxLookupSettings = Parameters<AlertUxLookup>[0];
|
|
71
|
+
type AlertUxLookupResult = ReturnType<AlertUxLookup>;
|
|
72
|
+
type RuleActionUX = {
|
|
73
|
+
block: boolean;
|
|
74
|
+
display: boolean;
|
|
75
|
+
};
|
|
76
|
+
type SettingsType = (SocketSdkResultType<"postSettings"> & {
|
|
77
|
+
success: true;
|
|
78
|
+
})["data"];
|
|
79
|
+
declare function createAlertUXLookup(settings: SettingsType): (context: {
|
|
80
|
+
package: {
|
|
81
|
+
name: string;
|
|
82
|
+
version: string;
|
|
83
|
+
};
|
|
84
|
+
alert: {
|
|
85
|
+
type: string;
|
|
86
|
+
};
|
|
87
|
+
}) => RuleActionUX;
|
|
88
|
+
declare function uxLookup(settings: AlertUxLookupSettings): Promise<AlertUxLookupResult>;
|
|
89
|
+
type CveAlertType = "cve" | "mediumCVE" | "mildCVE" | "criticalCVE";
|
|
90
|
+
type ArtifactAlertCveFixable = Omit<SocketArtifactAlert, "props" | "title"> & {
|
|
91
|
+
type: CveAlertType;
|
|
92
|
+
props: {
|
|
93
|
+
firstPatchedVersionIdentifier: string;
|
|
94
|
+
vulnerableVersionRange: string;
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
type ArtifactAlertFixable = ArtifactAlertCveFixable & {
|
|
99
|
+
type: CveAlertType | "socketUpgradeAvailable";
|
|
100
|
+
};
|
|
101
|
+
type SocketArtifactAlert = {
|
|
102
|
+
key: string;
|
|
103
|
+
type: string;
|
|
104
|
+
severity: string;
|
|
105
|
+
category: string;
|
|
106
|
+
action?: string;
|
|
107
|
+
actionPolicyIndex?: number;
|
|
108
|
+
file?: string;
|
|
109
|
+
props?: any;
|
|
110
|
+
start?: number;
|
|
111
|
+
end?: number;
|
|
112
|
+
};
|
|
113
|
+
type SocketArtifact = {
|
|
114
|
+
type: string;
|
|
115
|
+
name: string;
|
|
116
|
+
namespace?: string;
|
|
117
|
+
version?: string;
|
|
118
|
+
subpath?: string;
|
|
119
|
+
release?: string;
|
|
120
|
+
id?: string;
|
|
121
|
+
author?: string[];
|
|
122
|
+
license?: string;
|
|
123
|
+
licenseDetails?: {
|
|
124
|
+
spdxDisj: string;
|
|
125
|
+
provenance: string;
|
|
126
|
+
filepath: string;
|
|
127
|
+
match_strength: number;
|
|
128
|
+
}[];
|
|
129
|
+
licenseAttrib?: {
|
|
130
|
+
attribText: string;
|
|
131
|
+
attribData: {
|
|
132
|
+
purl: string;
|
|
133
|
+
foundInFilepath: string;
|
|
134
|
+
spdxExpr: string;
|
|
135
|
+
foundAuthors: string[];
|
|
136
|
+
}[];
|
|
137
|
+
}[];
|
|
138
|
+
score?: {
|
|
139
|
+
supplyChain: number;
|
|
140
|
+
quality: number;
|
|
141
|
+
maintenance: number;
|
|
142
|
+
vulnerability: number;
|
|
143
|
+
license: number;
|
|
144
|
+
overall: number;
|
|
145
|
+
};
|
|
146
|
+
alerts?: SocketArtifactAlert[];
|
|
147
|
+
size?: number;
|
|
148
|
+
batchIndex?: number;
|
|
149
|
+
};
|
|
150
|
+
declare function batchScan(pkgIds: string[], concurrencyLimit?: number): AsyncGenerator<SocketArtifact>;
|
|
151
|
+
declare function isArtifactAlertCveFixable(alert: SocketArtifactAlert): alert is ArtifactAlertCveFixable;
|
|
152
|
+
declare function isArtifactAlertUpgradeFixable(alert: SocketArtifactAlert): alert is ArtifactAlertFixable;
|
|
153
|
+
declare function isArtifactAlertFixable(alert: SocketArtifactAlert): alert is ArtifactAlertFixable;
|
|
154
|
+
type PackageDetail = {
|
|
155
|
+
node: SafeNode;
|
|
156
|
+
existing?: SafeNode | undefined;
|
|
157
|
+
};
|
|
158
|
+
type GetPackagesToQueryFromDiffOptions = {
|
|
159
|
+
includeUnchanged?: boolean;
|
|
160
|
+
includeUnknownOrigin?: boolean;
|
|
161
|
+
};
|
|
162
|
+
declare function getPackagesToQueryFromDiff(diff_: Diff | null, options?: GetPackagesToQueryFromDiffOptions): PackageDetail[];
|
|
163
|
+
declare function findUp(name: string | string[], { cwd }: {
|
|
164
|
+
cwd: string;
|
|
165
|
+
}): Promise<string | undefined>;
|
|
166
|
+
type ReadFileOptions = ObjectEncodingOptions & Abortable & {
|
|
167
|
+
flag?: OpenMode | undefined;
|
|
168
|
+
};
|
|
169
|
+
declare function readFileBinary(filepath: PathLike | FileHandle, options?: ReadFileOptions): Promise<Buffer>;
|
|
170
|
+
declare function readFileUtf8(filepath: PathLike | FileHandle, options?: ReadFileOptions): Promise<string>;
|
|
171
|
+
declare function safeReadFile(...args: Parameters<typeof fs.readFile>): ReturnType<typeof fs.readFile> | undefined;
|
|
172
|
+
declare function safeReadFileSync(...args: Parameters<typeof fsReadFileSync>): ReturnType<typeof fsReadFileSync> | undefined;
|
|
173
|
+
declare const Arborist: ArboristClass;
|
|
174
|
+
declare const kCtorArgs: unique symbol;
|
|
175
|
+
declare const SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES: {
|
|
176
|
+
__proto__: null;
|
|
177
|
+
audit: boolean;
|
|
178
|
+
dryRun: boolean;
|
|
179
|
+
fund: boolean;
|
|
180
|
+
ignoreScripts: boolean;
|
|
181
|
+
progress: boolean;
|
|
182
|
+
save: boolean;
|
|
183
|
+
saveBundle: boolean;
|
|
184
|
+
silent: boolean;
|
|
185
|
+
};
|
|
186
|
+
declare class SafeArborist extends Arborist {
|
|
187
|
+
constructor(...ctorArgs: ConstructorParameters<ArboristClass>);
|
|
188
|
+
[kRiskyReify](...args: Parameters<InstanceType<ArboristClass>['reify']>): Promise<SafeNode>;
|
|
189
|
+
// @ts-ignore Incorrectly typed.
|
|
190
|
+
reify(this: SafeArborist, ...args: Parameters<InstanceType<ArboristClass>['reify']>): Promise<SafeNode>;
|
|
191
|
+
}
|
|
192
|
+
export { SafeOverrideSet, depValid, getSocketDevAlertUrl, getSocketDevPackageOverviewUrl, ColorOrMarkdown, createAlertUXLookup, uxLookup, CveAlertType, ArtifactAlertCveFixable, ArtifactAlertFixable, SocketArtifactAlert, SocketArtifact, batchScan, isArtifactAlertCveFixable, isArtifactAlertUpgradeFixable, isArtifactAlertFixable, PackageDetail, getPackagesToQueryFromDiff, findUp, ReadFileOptions, readFileBinary, readFileUtf8, safeReadFile, safeReadFileSync, Arborist, kCtorArgs, SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES, SafeArborist };
|