@socketsecurity/cli-with-sentry 1.10.0 → 1.11.0
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/CHANGELOG.md +26 -0
- package/README.md +5 -5
- package/dist/cli.js +255 -128
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +4 -4
- package/dist/constants.js.map +1 -1
- package/dist/manifest-scripts/maven-extension/coana-maven-extension.jar +0 -0
- package/dist/manifest-scripts/socket-facts.init.gradle +241 -54
- package/dist/manifest-scripts/socket-facts.plugin.scala +224 -38
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/ci/handle-ci.d.mts.map +1 -1
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-gradle-to-facts.d.mts +2 -1
- package/dist/types/commands/manifest/convert-gradle-to-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-maven-to-facts.d.mts +2 -1
- package/dist/types/commands/manifest/convert-maven-to-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-sbt-to-facts.d.mts +2 -1
- package/dist/types/commands/manifest/convert-sbt-to-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/generate-recursive-manifests.d.mts.map +1 -1
- package/dist/types/commands/manifest/generate_auto_manifest.d.mts.map +1 -1
- package/dist/types/commands/manifest/run-manifest-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/assemble.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/facts.d.mts +3 -2
- package/dist/types/commands/manifest/scripts/facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/records.d.mts +7 -1
- package/dist/types/commands/manifest/scripts/records.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/resolution-report-gradle.d.mts +3 -2
- package/dist/types/commands/manifest/scripts/resolution-report-gradle.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/resolution-report-maven.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/resolution-report-render.d.mts +9 -4
- package/dist/types/commands/manifest/scripts/resolution-report-render.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/resolution-report.d.mts +7 -2
- package/dist/types/commands/manifest/scripts/resolution-report.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/sidecar.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-create.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-reach.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/perform-reachability-analysis.d.mts +2 -0
- package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +1 -1
- package/dist/types/commands/scan/reach-advisories.d.mts +7 -0
- package/dist/types/commands/scan/reach-advisories.d.mts.map +1 -0
- package/dist/types/commands/scan/reachability-flags.d.mts.map +1 -1
- package/dist/types/constants.d.mts +1 -1
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/utils/advisory-ids.d.mts +14 -0
- package/dist/types/utils/advisory-ids.d.mts.map +1 -0
- package/dist/types/utils/cve-to-ghsa.d.mts +2 -0
- package/dist/types/utils/cve-to-ghsa.d.mts.map +1 -1
- package/dist/utils.js +69 -3
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
package/dist/utils.js
CHANGED
|
@@ -6305,6 +6305,9 @@ async function setGitRemoteGithubRepoUrl(owner, repo, token, cwd = process.cwd()
|
|
|
6305
6305
|
return false;
|
|
6306
6306
|
}
|
|
6307
6307
|
|
|
6308
|
+
const CVE_FORMAT_REGEXP = /^CVE-\d{4}-\d{4,}$/;
|
|
6309
|
+
const GHSA_FORMAT_REGEXP = /^GHSA-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}$/;
|
|
6310
|
+
|
|
6308
6311
|
/**
|
|
6309
6312
|
* Converts CVE IDs to GHSA IDs using GitHub API.
|
|
6310
6313
|
* CVE to GHSA mappings are permanent, so we cache for 30 days.
|
|
@@ -6404,6 +6407,68 @@ async function convertPurlToGhsas(purl) {
|
|
|
6404
6407
|
}
|
|
6405
6408
|
}
|
|
6406
6409
|
|
|
6410
|
+
/**
|
|
6411
|
+
* Converts mixed CVE/GHSA/PURL IDs to GHSA IDs, collecting one error for each
|
|
6412
|
+
* ID that is malformed or cannot be converted.
|
|
6413
|
+
*/
|
|
6414
|
+
async function resolveAdvisoryIds(ids, options) {
|
|
6415
|
+
const {
|
|
6416
|
+
silence = false
|
|
6417
|
+
} = {
|
|
6418
|
+
__proto__: null,
|
|
6419
|
+
...options
|
|
6420
|
+
};
|
|
6421
|
+
const ghsas = [];
|
|
6422
|
+
const errors = [];
|
|
6423
|
+
for (const id of ids) {
|
|
6424
|
+
const trimmedId = id.trim();
|
|
6425
|
+
if (trimmedId.startsWith('GHSA-')) {
|
|
6426
|
+
// Already a GHSA ID, validate format
|
|
6427
|
+
if (GHSA_FORMAT_REGEXP.test(trimmedId)) {
|
|
6428
|
+
ghsas.push(trimmedId);
|
|
6429
|
+
} else {
|
|
6430
|
+
errors.push(`Invalid GHSA format: ${trimmedId}`);
|
|
6431
|
+
}
|
|
6432
|
+
} else if (trimmedId.startsWith('CVE-')) {
|
|
6433
|
+
// Convert CVE to GHSA
|
|
6434
|
+
if (!CVE_FORMAT_REGEXP.test(trimmedId)) {
|
|
6435
|
+
errors.push(`Invalid CVE format: ${trimmedId}`);
|
|
6436
|
+
continue;
|
|
6437
|
+
}
|
|
6438
|
+
|
|
6439
|
+
// eslint-disable-next-line no-await-in-loop
|
|
6440
|
+
const conversionResult = await convertCveToGhsa(trimmedId);
|
|
6441
|
+
if (conversionResult.ok) {
|
|
6442
|
+
ghsas.push(conversionResult.data);
|
|
6443
|
+
if (!silence) {
|
|
6444
|
+
logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data}`);
|
|
6445
|
+
}
|
|
6446
|
+
} else {
|
|
6447
|
+
errors.push(`${trimmedId}: ${conversionResult.message}`);
|
|
6448
|
+
}
|
|
6449
|
+
} else if (trimmedId.startsWith('pkg:')) {
|
|
6450
|
+
// Convert PURL to GHSAs.
|
|
6451
|
+
// eslint-disable-next-line no-await-in-loop
|
|
6452
|
+
const conversionResult = await convertPurlToGhsas(trimmedId);
|
|
6453
|
+
if (conversionResult.ok && conversionResult.data.length) {
|
|
6454
|
+
ghsas.push(...conversionResult.data);
|
|
6455
|
+
if (!silence) {
|
|
6456
|
+
logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data.length} GHSA(s): ${arrays.joinAnd(conversionResult.data)}`);
|
|
6457
|
+
}
|
|
6458
|
+
} else {
|
|
6459
|
+
errors.push(`${trimmedId}: ${conversionResult.message || 'No GHSAs found'}`);
|
|
6460
|
+
}
|
|
6461
|
+
} else {
|
|
6462
|
+
// Neither CVE, GHSA, nor PURL, skip
|
|
6463
|
+
errors.push(`Unsupported ID format (expected CVE, GHSA, or PURL): ${trimmedId}`);
|
|
6464
|
+
}
|
|
6465
|
+
}
|
|
6466
|
+
return {
|
|
6467
|
+
errors,
|
|
6468
|
+
ghsas
|
|
6469
|
+
};
|
|
6470
|
+
}
|
|
6471
|
+
|
|
6407
6472
|
/**
|
|
6408
6473
|
* Command-line utilities for Socket CLI.
|
|
6409
6474
|
* Handles argument parsing, flag processing, and command formatting.
|
|
@@ -8999,6 +9064,8 @@ function safeNpmSpecToPurl(pkgSpec) {
|
|
|
8999
9064
|
exports.ALL_PACKAGE_MANAGERS = ALL_PACKAGE_MANAGERS;
|
|
9000
9065
|
exports.AuthError = AuthError;
|
|
9001
9066
|
exports.COMPLETION_CMD_PREFIX = COMPLETION_CMD_PREFIX;
|
|
9067
|
+
exports.CVE_FORMAT_REGEXP = CVE_FORMAT_REGEXP;
|
|
9068
|
+
exports.GHSA_FORMAT_REGEXP = GHSA_FORMAT_REGEXP;
|
|
9002
9069
|
exports.IGNORED_DIRS = IGNORED_DIRS;
|
|
9003
9070
|
exports.InputError = InputError;
|
|
9004
9071
|
exports.RangeStyles = RangeStyles;
|
|
@@ -9012,8 +9079,6 @@ exports.cmdFlagValueToArray = cmdFlagValueToArray;
|
|
|
9012
9079
|
exports.cmdFlagsToString = cmdFlagsToString;
|
|
9013
9080
|
exports.cmdPrefixMessage = cmdPrefixMessage;
|
|
9014
9081
|
exports.compressSocketFactsForUpload = compressSocketFactsForUpload;
|
|
9015
|
-
exports.convertCveToGhsa = convertCveToGhsa;
|
|
9016
|
-
exports.convertPurlToGhsas = convertPurlToGhsas;
|
|
9017
9082
|
exports.createEnum = createEnum;
|
|
9018
9083
|
exports.debugApiRequest = debugApiRequest;
|
|
9019
9084
|
exports.debugApiResponse = debugApiResponse;
|
|
@@ -9122,6 +9187,7 @@ exports.readPnpmLockfile = readPnpmLockfile;
|
|
|
9122
9187
|
exports.readSocketJsonCascade = readSocketJsonCascade;
|
|
9123
9188
|
exports.readSocketJsonSync = readSocketJsonSync;
|
|
9124
9189
|
exports.realpathOrResolved = realpathOrResolved;
|
|
9190
|
+
exports.resolveAdvisoryIds = resolveAdvisoryIds;
|
|
9125
9191
|
exports.runAgentInstall = runAgentInstall;
|
|
9126
9192
|
exports.runSelfUpdateCheck = runSelfUpdateCheck;
|
|
9127
9193
|
exports.safeNpa = safeNpa$1;
|
|
@@ -9152,5 +9218,5 @@ exports.walkNestedMap = walkNestedMap;
|
|
|
9152
9218
|
exports.webLink = webLink;
|
|
9153
9219
|
exports.withTmpDir = withTmpDir;
|
|
9154
9220
|
exports.writeSocketJson = writeSocketJson;
|
|
9155
|
-
//# debugId=
|
|
9221
|
+
//# debugId=d923588e-ce3f-4f3d-be3d-d07c37af3876
|
|
9156
9222
|
//# sourceMappingURL=utils.js.map
|