@socketsecurity/cli-with-sentry 0.14.65 → 0.14.66
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 +0 -2
- package/dist/constants.js +1 -5
- package/dist/constants.js.map +1 -1
- package/dist/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/module-sync/cli.js +20 -19
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/shadow-npm-inject.js +45 -33
- package/dist/module-sync/shadow-npm-inject.js.map +1 -1
- package/dist/module-sync/socket-package-alert.d.ts +1 -1
- package/dist/require/cli.js +20 -19
- package/dist/require/cli.js.map +1 -1
- package/package.json +6 -6
- package/dist/module-sync/fs.d.ts +0 -22
|
@@ -306,7 +306,7 @@ async function setupSdk(apiToken = getDefaultToken(), apiBaseUrl = getDefaultApi
|
|
|
306
306
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_NAME']".
|
|
307
307
|
name: "@socketsecurity/cli",
|
|
308
308
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
309
|
-
version: "0.14.
|
|
309
|
+
version: "0.14.66",
|
|
310
310
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_HOMEPAGE']".
|
|
311
311
|
homepage: "https://github.com/SocketDev/socket-cli"
|
|
312
312
|
})
|
|
@@ -1031,6 +1031,12 @@ function isArtifactAlertCve(alert) {
|
|
|
1031
1031
|
return type === ALERT_TYPE_CVE || type === ALERT_TYPE_MEDIUM_CVE || type === ALERT_TYPE_MILD_CVE || type === ALERT_TYPE_CRITICAL_CVE;
|
|
1032
1032
|
}
|
|
1033
1033
|
|
|
1034
|
+
let ALERT_FIX_TYPE = /*#__PURE__*/function (ALERT_FIX_TYPE) {
|
|
1035
|
+
ALERT_FIX_TYPE["cve"] = "cve";
|
|
1036
|
+
ALERT_FIX_TYPE["upgrade"] = "upgrade";
|
|
1037
|
+
return ALERT_FIX_TYPE;
|
|
1038
|
+
}({});
|
|
1039
|
+
|
|
1034
1040
|
const ERROR_UX = {
|
|
1035
1041
|
block: true,
|
|
1036
1042
|
display: true
|
|
@@ -1172,23 +1178,29 @@ async function uxLookup(settings) {
|
|
|
1172
1178
|
const sockSdk = await setupSdk(getPublicToken());
|
|
1173
1179
|
const orgResult = await sockSdk.getOrganizations();
|
|
1174
1180
|
if (!orgResult.success) {
|
|
1175
|
-
|
|
1181
|
+
if (orgResult.status === 429) {
|
|
1182
|
+
throw new Error(`API token quota exceeded: ${orgResult.error}`);
|
|
1183
|
+
}
|
|
1184
|
+
throw new Error(`Failed to fetch Socket organization info: ${orgResult.error}`);
|
|
1176
1185
|
}
|
|
1186
|
+
const {
|
|
1187
|
+
organizations
|
|
1188
|
+
} = orgResult.data;
|
|
1177
1189
|
const orgs = [];
|
|
1178
|
-
for (const org of Object.values(
|
|
1190
|
+
for (const org of Object.values(organizations)) {
|
|
1179
1191
|
if (org) {
|
|
1180
1192
|
orgs.push(org);
|
|
1181
1193
|
}
|
|
1182
1194
|
}
|
|
1183
|
-
const
|
|
1195
|
+
const settingsResult = await sockSdk.postSettings(orgs.map(org => ({
|
|
1184
1196
|
organization: org.id
|
|
1185
1197
|
})));
|
|
1186
|
-
if (!
|
|
1187
|
-
throw new Error(`Failed to fetch API key settings: ${
|
|
1198
|
+
if (!settingsResult.success) {
|
|
1199
|
+
throw new Error(`Failed to fetch API key settings: ${settingsResult.error}`);
|
|
1188
1200
|
}
|
|
1189
1201
|
return {
|
|
1190
1202
|
orgs,
|
|
1191
|
-
settings:
|
|
1203
|
+
settings: settingsResult.data
|
|
1192
1204
|
};
|
|
1193
1205
|
} catch (e) {
|
|
1194
1206
|
const cause = objects.isObject(e) && 'cause' in e ? e['cause'] : undefined;
|
|
@@ -1255,16 +1267,15 @@ function stringJoinWithSeparateFinalSeparator(list, separator = ' and ') {
|
|
|
1255
1267
|
return `${values.join(', ')}${separator}${finalValue}`;
|
|
1256
1268
|
}
|
|
1257
1269
|
|
|
1258
|
-
let
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
return
|
|
1270
|
+
let ALERT_SEVERITY = /*#__PURE__*/function (ALERT_SEVERITY) {
|
|
1271
|
+
ALERT_SEVERITY["critical"] = "critical";
|
|
1272
|
+
ALERT_SEVERITY["high"] = "high";
|
|
1273
|
+
ALERT_SEVERITY["middle"] = "middle";
|
|
1274
|
+
ALERT_SEVERITY["low"] = "low";
|
|
1275
|
+
return ALERT_SEVERITY;
|
|
1264
1276
|
}({});
|
|
1265
|
-
|
|
1266
1277
|
// Ordered from most severe to least.
|
|
1267
|
-
const SEVERITIES_BY_ORDER = ['critical', 'high', 'middle', 'low'];
|
|
1278
|
+
const SEVERITIES_BY_ORDER = Object.freeze(['critical', 'high', 'middle', 'low']);
|
|
1268
1279
|
function getDesiredSeverities(lowestToInclude) {
|
|
1269
1280
|
const result = [];
|
|
1270
1281
|
for (const severity of SEVERITIES_BY_ORDER) {
|
|
@@ -1298,8 +1309,11 @@ function getSeverityCount(issues, lowestToInclude) {
|
|
|
1298
1309
|
if (!value) {
|
|
1299
1310
|
continue;
|
|
1300
1311
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1312
|
+
const {
|
|
1313
|
+
severity
|
|
1314
|
+
} = value;
|
|
1315
|
+
if (severityCount[severity] !== undefined) {
|
|
1316
|
+
severityCount[severity] += 1;
|
|
1303
1317
|
}
|
|
1304
1318
|
}
|
|
1305
1319
|
return severityCount;
|
|
@@ -1359,8 +1373,6 @@ function getTranslations() {
|
|
|
1359
1373
|
}
|
|
1360
1374
|
|
|
1361
1375
|
const {
|
|
1362
|
-
ALERT_FIX_TYPE_CVE,
|
|
1363
|
-
ALERT_FIX_TYPE_UPGRADE,
|
|
1364
1376
|
CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER,
|
|
1365
1377
|
NPM: NPM$2
|
|
1366
1378
|
} = constants;
|
|
@@ -1368,7 +1380,7 @@ const format = new ColorOrMarkdown(false);
|
|
|
1368
1380
|
async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
|
|
1369
1381
|
// Make TypeScript happy.
|
|
1370
1382
|
if (!artifact.name || !artifact.version || !artifact.alerts?.length) {
|
|
1371
|
-
return;
|
|
1383
|
+
return alertsByPkgId;
|
|
1372
1384
|
}
|
|
1373
1385
|
const {
|
|
1374
1386
|
consolidate = false,
|
|
@@ -1405,10 +1417,10 @@ async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
|
|
|
1405
1417
|
}
|
|
1406
1418
|
});
|
|
1407
1419
|
const fixType = alert.fix?.type ?? '';
|
|
1408
|
-
const critical = alert.severity ===
|
|
1420
|
+
const critical = alert.severity === ALERT_SEVERITY.critical;
|
|
1409
1421
|
const cve = isArtifactAlertCve(alert);
|
|
1410
|
-
const fixableCve = fixType ===
|
|
1411
|
-
const fixableUpgrade = fixType ===
|
|
1422
|
+
const fixableCve = fixType === ALERT_FIX_TYPE.cve;
|
|
1423
|
+
const fixableUpgrade = fixType === ALERT_FIX_TYPE.upgrade;
|
|
1412
1424
|
const fixable = fixableCve || fixableUpgrade;
|
|
1413
1425
|
const upgrade = fixableUpgrade && !objects.hasOwn(overrides, name);
|
|
1414
1426
|
if (include.cve && cve || include.unfixable && !fixable || include.critical && critical || include.upgrade && upgrade) {
|
|
@@ -1427,7 +1439,7 @@ async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
|
|
|
1427
1439
|
}
|
|
1428
1440
|
}
|
|
1429
1441
|
if (!sockPkgAlerts.length) {
|
|
1430
|
-
return;
|
|
1442
|
+
return alertsByPkgId;
|
|
1431
1443
|
}
|
|
1432
1444
|
if (consolidate) {
|
|
1433
1445
|
const highestForCve = new Map();
|
|
@@ -1436,7 +1448,7 @@ async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
|
|
|
1436
1448
|
for (const sockPkgAlert of sockPkgAlerts) {
|
|
1437
1449
|
const alert = sockPkgAlert.raw;
|
|
1438
1450
|
const fixType = alert.fix?.type ?? '';
|
|
1439
|
-
if (fixType ===
|
|
1451
|
+
if (fixType === ALERT_FIX_TYPE.cve) {
|
|
1440
1452
|
const patchedVersion = alert.props[CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER];
|
|
1441
1453
|
const patchedMajor = semver.major(patchedVersion);
|
|
1442
1454
|
const oldHighest = highestForCve.get(patchedMajor);
|
|
@@ -1447,7 +1459,7 @@ async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
|
|
|
1447
1459
|
version: patchedVersion
|
|
1448
1460
|
});
|
|
1449
1461
|
}
|
|
1450
|
-
} else if (fixType ===
|
|
1462
|
+
} else if (fixType === ALERT_FIX_TYPE.upgrade) {
|
|
1451
1463
|
const oldHighest = highestForUpgrade.get(major);
|
|
1452
1464
|
const highest = oldHighest?.version ?? '0.0.0';
|
|
1453
1465
|
if (semver.gt(version, highest)) {
|
|
@@ -1462,11 +1474,11 @@ async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
|
|
|
1462
1474
|
}
|
|
1463
1475
|
sockPkgAlerts = [...unfixableAlerts, ...[...highestForCve.values()].map(d => d.alert), ...[...highestForUpgrade.values()].map(d => d.alert)];
|
|
1464
1476
|
}
|
|
1465
|
-
if (
|
|
1466
|
-
|
|
1477
|
+
if (sockPkgAlerts.length) {
|
|
1478
|
+
sockPkgAlerts.sort((a, b) => sorts.naturalCompare(a.type, b.type));
|
|
1479
|
+
alertsByPkgId.set(pkgId, sockPkgAlerts);
|
|
1467
1480
|
}
|
|
1468
|
-
|
|
1469
|
-
alertsByPkgId.set(pkgId, sockPkgAlerts);
|
|
1481
|
+
return alertsByPkgId;
|
|
1470
1482
|
}
|
|
1471
1483
|
function getCveInfoByAlertsMap(alertsMap, options) {
|
|
1472
1484
|
const exclude = {
|
|
@@ -1482,7 +1494,7 @@ function getCveInfoByAlertsMap(alertsMap, options) {
|
|
|
1482
1494
|
const name = packages.resolvePackageName(purlObj);
|
|
1483
1495
|
for (const sockPkgAlert of sockPkgAlerts) {
|
|
1484
1496
|
const alert = sockPkgAlert.raw;
|
|
1485
|
-
if (alert.fix?.type !==
|
|
1497
|
+
if (alert.fix?.type !== ALERT_FIX_TYPE.cve || exclude.upgrade && registry.getManifestData(NPM$2, name)) {
|
|
1486
1498
|
continue;
|
|
1487
1499
|
}
|
|
1488
1500
|
if (!infoByPkg) {
|
|
@@ -1910,12 +1922,12 @@ function installSafeArborist() {
|
|
|
1910
1922
|
|
|
1911
1923
|
installSafeArborist();
|
|
1912
1924
|
|
|
1925
|
+
exports.ALERT_SEVERITY = ALERT_SEVERITY;
|
|
1913
1926
|
exports.Arborist = Arborist;
|
|
1914
1927
|
exports.AuthError = AuthError;
|
|
1915
1928
|
exports.ColorOrMarkdown = ColorOrMarkdown;
|
|
1916
1929
|
exports.InputError = InputError;
|
|
1917
1930
|
exports.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES = SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES;
|
|
1918
|
-
exports.SEVERITY = SEVERITY;
|
|
1919
1931
|
exports.SafeArborist = SafeArborist;
|
|
1920
1932
|
exports.addArtifactToAlertsMap = addArtifactToAlertsMap;
|
|
1921
1933
|
exports.captureException = captureException;
|
|
@@ -1937,5 +1949,5 @@ exports.safeReadFile = safeReadFile;
|
|
|
1937
1949
|
exports.setupSdk = setupSdk;
|
|
1938
1950
|
exports.updateNode = updateNode;
|
|
1939
1951
|
exports.updateSetting = updateSetting;
|
|
1940
|
-
//# debugId=
|
|
1952
|
+
//# debugId=86178861-a8cc-486b-ac92-f49e627e80af
|
|
1941
1953
|
//# sourceMappingURL=shadow-npm-inject.js.map
|