@mitre/hdf-converters 3.6.0-rc.1 → 3.6.0-rc.2
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/index.d.ts.map +1 -1
- package/dist/index.js +57 -29
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../converters/legacyhdf-to-hdf/typescript/converter.ts","../converters/asff-to-hdf/typescript/converter.ts","../converters/sarif-to-hdf/typescript/converter.ts","../converters/junit-to-hdf/typescript/converter.ts","../converters/xccdf-results-to-hdf/typescript/converter.ts","../converters/ckl-to-hdf/typescript/converter.ts","../converters/cklb-to-hdf/typescript/converter.ts","../converters/hdf-to-ckl/typescript/converter.ts","../converters/hdf-to-cklb/typescript/converter.ts","../converters/kics-to-hdf/typescript/converter.ts","../converters/semgrep-to-hdf/typescript/converter.ts","../converters/snyk-to-hdf/typescript/converter.ts","../converters/grype-to-hdf/typescript/converter.ts","../converters/defectdojo-to-hdf/typescript/converter.ts","../converters/nessus-to-hdf/typescript/converter.ts","../converters/sonarqube-to-hdf/typescript/converter.ts","../converters/aws-config-to-hdf/typescript/converter.ts","../converters/checkov-to-hdf/typescript/converter.ts","../converters/gosec-to-hdf/typescript/converter.ts","../converters/nikto-to-hdf/typescript/converter.ts","../converters/zap-to-hdf/typescript/converter.ts","../converters/cyclonedx-to-hdf/typescript/converter.ts","../converters/hdf-to-csv/typescript/converter.ts","../converters/hdf-to-ecs/typescript/converter.ts","../converters/hdf-to-splunk/typescript/converter.ts","../converters/hdf-to-ocsf/typescript/converter.ts","../converters/hdf-to-asff/typescript/converter.ts","../converters/splunk-to-hdf/typescript/converter.ts","../converters/hdf-to-xml/typescript/converter.ts","../converters/gitlab-to-hdf/typescript/converter.ts","../converters/trivy-to-hdf/typescript/converter.ts","../converters/trufflehog-to-hdf/typescript/converter.ts","../converters/hipcheck-to-hdf/typescript/converter.ts","../converters/burpsuite-to-hdf/typescript/converter.ts","../converters/dbprotect-to-hdf/typescript/converter.ts","../converters/twistlock-to-hdf/typescript/converter.ts","../converters/deptrack-to-hdf/typescript/converter.ts","../converters/jfrog-xray-to-hdf/typescript/converter.ts","../converters/neuvector-to-hdf/typescript/converter.ts","../converters/fortify-to-hdf/typescript/converter.ts","../converters/prisma-to-hdf/typescript/converter.ts","../converters/netsparker-to-hdf/typescript/converter.ts","../converters/scoutsuite-to-hdf/typescript/converter.ts","../converters/conveyor-to-hdf/typescript/converter.ts","../converters/veracode-to-hdf/typescript/converter.ts","../converters/msft-secure-score-to-hdf/typescript/converter.ts","../converters/msft-defender-devops-to-hdf/typescript/converter.ts","../converters/msft-defender-cloud-to-hdf/typescript/converter.ts","../converters/msft-defender-endpoint-to-hdf/typescript/converter.ts","../converters/hdf-to-xccdf/typescript/converter.ts","../converters/hdf-to-oscal-sar/typescript/converter.ts","../converters/hdf-to-oscal-poam/typescript/converter.ts","../converters/ionchannel-to-hdf/typescript/converter.ts","../converters/openvex-to-hdf/typescript/converter.ts","../converters/csaf-vex-to-hdf/typescript/converter.ts","../converters/cyclonedx-vex-to-hdf/typescript/converter.ts","../converters/spdx-vex-to-hdf/typescript/converter.ts","../converters/hdf-to-csaf-vex/typescript/converter.ts","../converters/hdf-to-openvex/typescript/converter.ts","../converters/hdf-to-cyclonedx-vex/typescript/converter.ts","../converters/oscal-to-hdf/typescript/detect.ts","../converters/oscal-to-hdf/typescript/converter-catalog.ts","../converters/oscal-to-hdf/typescript/converter-profile.ts","../converters/oscal-to-hdf/typescript/converter-component.ts","../converters/oscal-to-hdf/typescript/converter-ssp.ts","../converters/oscal-to-hdf/typescript/converter-sap.ts","../converters/oscal-to-hdf/typescript/converter-poam.ts","../converters/oscal-to-hdf/typescript/converter-sar.ts","../shared/typescript/enrichStix.ts","../shared/typescript/stix.ts"],"mappings":";;;;;;;;;;;;UAwBiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA,eAAe;IAAO;IAAe;;EACrC;EACA;EACA,OAAO;EACP;EACA;IACE;IACA;;EAEF,cAAc;EACd,UAAU;EACV;GACC;;UAGc;EACf;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,WAAW;EACX;EACA,UAAU;EACV;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;GACC;;UAGc;EACf;EACA,UAAU;EACV,UAAU;EACV;EACA;EACA;GACC;;UAKc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;IAAU;;EACV;EACA;IAAa;IAAe;;EAC5B;EACA;GACC;;UAGc;EACf;EACA;EACA;IAAa;IAAe;;EAC5B;GACC;;UAGc;EACf;EACA;EACA;EACA,eAAe;IAAO;IAAe;;EACrC;EACA;EACA,OAAO;EACP;EACA;IACE;IACA;;EAEF,aAAa;EACb,UAAU;EACV;EACA;EACA;EACA,kBAAkB;EAClB,QAAQ;EACR;EACA,OAAO;IAAO;;GACb;;UAGc;EACf;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,eAAe;EACf;IACE;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;;EAEF,UAAU;EACV;EACA;EACA;EACA;GACC;;UAGc;EACf,WAAW;EACX;EACA;EACA;EACA;IAAS;IAAe;IAAkB;;EAC1C;EACA;EACA;EACA;EACA;EACA,aAAa;;iBAgvBC,iBAAiB,QAAQ,kBAAkB,4BAA6B;;;;;;;iBAgExE,YAAY,gBAAgB,QAAQ;;;;iBC7e9B,iBAAiB,eAAe,4BAA6B;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../converters/legacyhdf-to-hdf/typescript/converter.ts","../converters/asff-to-hdf/typescript/converter.ts","../converters/sarif-to-hdf/typescript/converter.ts","../converters/junit-to-hdf/typescript/converter.ts","../converters/xccdf-results-to-hdf/typescript/converter.ts","../converters/ckl-to-hdf/typescript/converter.ts","../converters/cklb-to-hdf/typescript/converter.ts","../converters/hdf-to-ckl/typescript/converter.ts","../converters/hdf-to-cklb/typescript/converter.ts","../converters/kics-to-hdf/typescript/converter.ts","../converters/semgrep-to-hdf/typescript/converter.ts","../converters/snyk-to-hdf/typescript/converter.ts","../converters/grype-to-hdf/typescript/converter.ts","../converters/defectdojo-to-hdf/typescript/converter.ts","../converters/nessus-to-hdf/typescript/converter.ts","../converters/sonarqube-to-hdf/typescript/converter.ts","../converters/aws-config-to-hdf/typescript/converter.ts","../converters/checkov-to-hdf/typescript/converter.ts","../converters/gosec-to-hdf/typescript/converter.ts","../converters/nikto-to-hdf/typescript/converter.ts","../converters/zap-to-hdf/typescript/converter.ts","../converters/cyclonedx-to-hdf/typescript/converter.ts","../converters/hdf-to-csv/typescript/converter.ts","../converters/hdf-to-ecs/typescript/converter.ts","../converters/hdf-to-splunk/typescript/converter.ts","../converters/hdf-to-ocsf/typescript/converter.ts","../converters/hdf-to-asff/typescript/converter.ts","../converters/splunk-to-hdf/typescript/converter.ts","../converters/hdf-to-xml/typescript/converter.ts","../converters/gitlab-to-hdf/typescript/converter.ts","../converters/trivy-to-hdf/typescript/converter.ts","../converters/trufflehog-to-hdf/typescript/converter.ts","../converters/hipcheck-to-hdf/typescript/converter.ts","../converters/burpsuite-to-hdf/typescript/converter.ts","../converters/dbprotect-to-hdf/typescript/converter.ts","../converters/twistlock-to-hdf/typescript/converter.ts","../converters/deptrack-to-hdf/typescript/converter.ts","../converters/jfrog-xray-to-hdf/typescript/converter.ts","../converters/neuvector-to-hdf/typescript/converter.ts","../converters/fortify-to-hdf/typescript/converter.ts","../converters/prisma-to-hdf/typescript/converter.ts","../converters/netsparker-to-hdf/typescript/converter.ts","../converters/scoutsuite-to-hdf/typescript/converter.ts","../converters/conveyor-to-hdf/typescript/converter.ts","../converters/veracode-to-hdf/typescript/converter.ts","../converters/msft-secure-score-to-hdf/typescript/converter.ts","../converters/msft-defender-devops-to-hdf/typescript/converter.ts","../converters/msft-defender-cloud-to-hdf/typescript/converter.ts","../converters/msft-defender-endpoint-to-hdf/typescript/converter.ts","../converters/hdf-to-xccdf/typescript/converter.ts","../converters/hdf-to-oscal-sar/typescript/converter.ts","../converters/hdf-to-oscal-poam/typescript/converter.ts","../converters/ionchannel-to-hdf/typescript/converter.ts","../converters/openvex-to-hdf/typescript/converter.ts","../converters/csaf-vex-to-hdf/typescript/converter.ts","../converters/cyclonedx-vex-to-hdf/typescript/converter.ts","../converters/spdx-vex-to-hdf/typescript/converter.ts","../converters/hdf-to-csaf-vex/typescript/converter.ts","../converters/hdf-to-openvex/typescript/converter.ts","../converters/hdf-to-cyclonedx-vex/typescript/converter.ts","../converters/oscal-to-hdf/typescript/detect.ts","../converters/oscal-to-hdf/typescript/converter-catalog.ts","../converters/oscal-to-hdf/typescript/converter-profile.ts","../converters/oscal-to-hdf/typescript/converter-component.ts","../converters/oscal-to-hdf/typescript/converter-ssp.ts","../converters/oscal-to-hdf/typescript/converter-sap.ts","../converters/oscal-to-hdf/typescript/converter-poam.ts","../converters/oscal-to-hdf/typescript/converter-sar.ts","../shared/typescript/enrichStix.ts","../shared/typescript/stix.ts"],"mappings":";;;;;;;;;;;;UAwBiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA,eAAe;IAAO;IAAe;;EACrC;EACA;EACA,OAAO;EACP;EACA;IACE;IACA;;EAEF,cAAc;EACd,UAAU;EACV;GACC;;UAGc;EACf;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,WAAW;EACX;EACA,UAAU;EACV;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;GACC;;UAGc;EACf;EACA,UAAU;EACV,UAAU;EACV;EACA;EACA;GACC;;UAKc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;IAAU;;EACV;EACA;IAAa;IAAe;;EAC5B;EACA;GACC;;UAGc;EACf;EACA;EACA;IAAa;IAAe;;EAC5B;GACC;;UAGc;EACf;EACA;EACA;EACA,eAAe;IAAO;IAAe;;EACrC;EACA;EACA,OAAO;EACP;EACA;IACE;IACA;;EAEF,aAAa;EACb,UAAU;EACV;EACA;EACA;EACA,kBAAkB;EAClB,QAAQ;EACR;EACA,OAAO;IAAO;;GACb;;UAGc;EACf;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;UAGc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,eAAe;EACf;IACE;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;;EAEF,UAAU;EACV;EACA;EACA;EACA;GACC;;UAGc;EACf,WAAW;EACX;EACA;EACA;EACA;IAAS;IAAe;IAAkB;;EAC1C;EACA;EACA;EACA;EACA;EACA,aAAa;;iBAgvBC,iBAAiB,QAAQ,kBAAkB,4BAA6B;;;;;;;iBAgExE,YAAY,gBAAgB,QAAQ;;;;iBC7e9B,iBAAiB,eAAe,4BAA6B;;;iBClZ7D,kBAAkB,eAAe,4BAA6B;;;;;;iBCvE9D,kBAAkB,eAAe,4BAA6B;;;iBCkP9D,yBAAyB,eAAe,4BAA6B;;;;;;;;;;;;iBCzUrE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B;;;;UClC1C;;EAEf;;EAEA,OAAO;;EAEP;;;EAGA;;;;;;;;;;;;;;;;iBAwBc,WAAW,sBAAsB,qBAAqB,OAAO;;;KC1CjE,aAAa;UAER;EACf;EACA;EACA,SAAS;;;iBAIK,gBAAgB,gBAAgB;;iBA2BhC,iBAAiB"}
|
package/dist/index.js
CHANGED
|
@@ -161,20 +161,6 @@ function extractCWEIDs(text) {
|
|
|
161
161
|
ids.sort();
|
|
162
162
|
return ids;
|
|
163
163
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Return the first candidate whose content is not empty or whitespace-only,
|
|
166
|
-
* as-is (the emptiness test trims, the returned value does not). Returns '' when
|
|
167
|
-
* every candidate is empty or whitespace. The caller supplies its own documented
|
|
168
|
-
* fallback as the last candidate so the substituted value is meaningful per
|
|
169
|
-
* field — this helper never invents a placeholder like "N/A". Use it where a
|
|
170
|
-
* target schema requires a non-empty (often minLength:1) string and a source
|
|
171
|
-
* value may be absent; it is a selection helper, not a normalizer, and never
|
|
172
|
-
* decides to OMIT a field (that stays the caller's call). Go parity: FirstNonEmpty.
|
|
173
|
-
*/
|
|
174
|
-
function firstNonEmpty(...candidates) {
|
|
175
|
-
for (const c of candidates) if (c.trim() !== "") return c;
|
|
176
|
-
return "";
|
|
177
|
-
}
|
|
178
164
|
/** Default maximum input size for converters (50MB) */
|
|
179
165
|
const DEFAULT_MAX_INPUT_SIZE = 50 * 1024 * 1024;
|
|
180
166
|
/**
|
|
@@ -1449,7 +1435,8 @@ function convertRun(run, version, resultsChecksum, timestamp) {
|
|
|
1449
1435
|
}
|
|
1450
1436
|
function buildRuleMap(run) {
|
|
1451
1437
|
const map = /* @__PURE__ */ new Map();
|
|
1452
|
-
|
|
1438
|
+
for (const ext of run.tool?.extensions ?? []) for (const rule of ext.rules ?? []) map.set(rule.id, rule);
|
|
1439
|
+
for (const rule of run.tool?.driver?.rules ?? []) map.set(rule.id, rule);
|
|
1453
1440
|
return map;
|
|
1454
1441
|
}
|
|
1455
1442
|
function convertResultGroup(ruleId, rule, sarifResults, timestamp) {
|
|
@@ -1460,7 +1447,7 @@ function convertResultGroup(ruleId, rule, sarifResults, timestamp) {
|
|
|
1460
1447
|
const nistControls = mapCWEToNIST(cweIds, DEFAULT_STATIC_ANALYSIS_NIST_TAGS);
|
|
1461
1448
|
const cciControls = nistToCci(nistControls);
|
|
1462
1449
|
const ruleLevel = resolveRuleLevel(rule, sarifResults);
|
|
1463
|
-
const impact = severityToImpactWithAliases(ruleLevel, SARIF_ALIASES, 0) || .1;
|
|
1450
|
+
const impact = (securitySeverityImpact(rule) ?? severityToImpactWithAliases(ruleLevel, SARIF_ALIASES, 0)) || .1;
|
|
1464
1451
|
const sourceLocation = firstResult.locations && firstResult.locations.length > 0 ? extractSourceLocation$1(firstResult.locations[0]) : void 0;
|
|
1465
1452
|
const results = [];
|
|
1466
1453
|
for (const sr of sarifResults) results.push(...convertSarifResultToHDFResults(sr));
|
|
@@ -1469,6 +1456,7 @@ function convertResultGroup(ruleId, rule, sarifResults, timestamp) {
|
|
|
1469
1456
|
const options = { tags: buildTags$4(firstResult, rule, ruleLevel, cweIds, nistControls, cciControls, allSuppressions) };
|
|
1470
1457
|
if (sourceLocation) options.sourceLocation = sourceLocation;
|
|
1471
1458
|
const req = createRequirement(ruleId, title, descriptions, impact, results, options);
|
|
1459
|
+
req.severity = impactToSeverity(impact);
|
|
1472
1460
|
const controlType = deriveControlTypeFromTags(nistControls);
|
|
1473
1461
|
if (controlType !== void 0) req.controlType = controlType;
|
|
1474
1462
|
req.verificationMethod = VerificationMethodEnum.Automated;
|
|
@@ -1535,6 +1523,20 @@ function packageFromSarifProperties(props) {
|
|
|
1535
1523
|
fixedInVersion: props.fixedInVersion
|
|
1536
1524
|
});
|
|
1537
1525
|
}
|
|
1526
|
+
const DECIMAL_SCORE = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
1527
|
+
function securitySeverityImpact(rule) {
|
|
1528
|
+
const raw = rule?.properties?.["security-severity"];
|
|
1529
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
1530
|
+
let score;
|
|
1531
|
+
if (typeof raw === "string") {
|
|
1532
|
+
const trimmed = raw.trim();
|
|
1533
|
+
if (!DECIMAL_SCORE.test(trimmed)) return void 0;
|
|
1534
|
+
score = Number(trimmed);
|
|
1535
|
+
} else if (typeof raw === "number") score = raw;
|
|
1536
|
+
else return;
|
|
1537
|
+
if (!Number.isFinite(score) || score < 0 || score > 10) return void 0;
|
|
1538
|
+
return roundImpact(score / 10);
|
|
1539
|
+
}
|
|
1538
1540
|
function resolveRuleLevel(rule, results) {
|
|
1539
1541
|
if (rule?.defaultConfiguration?.level) return rule.defaultConfiguration.level;
|
|
1540
1542
|
for (const r of results) if (!r.kind || r.kind === "fail") {
|
|
@@ -8968,7 +8970,18 @@ async function convertGitlabToHdf(input, converterVersion = "1.0.0") {
|
|
|
8968
8970
|
const BASELINE_NAME = "Trivy Scan";
|
|
8969
8971
|
const STATIC_CCI = nistToCci(DEFAULT_STATIC_ANALYSIS_NIST_TAGS);
|
|
8970
8972
|
const CWE_ID_PATTERN$1 = /^CWE-[1-9]\d*$/;
|
|
8971
|
-
const
|
|
8973
|
+
const IMPACT_MAP = {
|
|
8974
|
+
critical: .9,
|
|
8975
|
+
high: .7,
|
|
8976
|
+
medium: .5,
|
|
8977
|
+
low: .3,
|
|
8978
|
+
unknown: .5,
|
|
8979
|
+
none: 0,
|
|
8980
|
+
info: 0
|
|
8981
|
+
};
|
|
8982
|
+
function severityToImpact$2(severity) {
|
|
8983
|
+
return IMPACT_MAP[(severity || "").toLowerCase()] ?? .5;
|
|
8984
|
+
}
|
|
8972
8985
|
/**
|
|
8973
8986
|
* Route Trivy output to HDF Results: native Trivy JSON (SchemaVersion 2) is
|
|
8974
8987
|
* parsed here; SARIF / CycloneDX / ASFF / GitLab are delegated to their
|
|
@@ -9018,7 +9031,7 @@ async function convertNative(input, converterVersion) {
|
|
|
9018
9031
|
function convertVuln(v, res, startTime) {
|
|
9019
9032
|
const descriptions = [{
|
|
9020
9033
|
label: "default",
|
|
9021
|
-
data: firstNonEmpty(v.Description
|
|
9034
|
+
data: firstNonEmpty(v.Description, v.Title, v.VulnerabilityID)
|
|
9022
9035
|
}];
|
|
9023
9036
|
if (v.FixedVersion) descriptions.push({
|
|
9024
9037
|
label: "fix",
|
|
@@ -9036,7 +9049,7 @@ function convertVuln(v, res, startTime) {
|
|
|
9036
9049
|
id: `Trivy/${v.VulnerabilityID ?? ""}`,
|
|
9037
9050
|
title: `Trivy found ${v.VulnerabilityID ?? ""} in ${pkgLabel(v.PkgName, v.InstalledVersion)}`,
|
|
9038
9051
|
descriptions,
|
|
9039
|
-
impact:
|
|
9052
|
+
impact: severityToImpact$2(v.Severity ?? ""),
|
|
9040
9053
|
tags,
|
|
9041
9054
|
cwe: filterCwes(v.CweIDs),
|
|
9042
9055
|
cvss: buildCvssEntries$4(v.CVSS),
|
|
@@ -9048,7 +9061,7 @@ function convertVuln(v, res, startTime) {
|
|
|
9048
9061
|
status: ResultStatus.Failed,
|
|
9049
9062
|
codeDesc: buildVulnCodeDesc(v, res),
|
|
9050
9063
|
startTime,
|
|
9051
|
-
message: `Severity: ${firstNonEmpty(v.Severity
|
|
9064
|
+
message: `Severity: ${firstNonEmpty(v.Severity, "UNKNOWN")}`
|
|
9052
9065
|
}]
|
|
9053
9066
|
};
|
|
9054
9067
|
const ap = buildAffectedPackage$1(v);
|
|
@@ -9059,7 +9072,7 @@ function convertVuln(v, res, startTime) {
|
|
|
9059
9072
|
function convertMisconf(m, res, startTime) {
|
|
9060
9073
|
const descriptions = [{
|
|
9061
9074
|
label: "default",
|
|
9062
|
-
data: firstNonEmpty(m.Description
|
|
9075
|
+
data: firstNonEmpty(m.Description, m.Message, m.Title)
|
|
9063
9076
|
}];
|
|
9064
9077
|
if (m.Resolution) descriptions.push({
|
|
9065
9078
|
label: "fix",
|
|
@@ -9071,10 +9084,10 @@ function convertMisconf(m, res, startTime) {
|
|
|
9071
9084
|
});
|
|
9072
9085
|
markUnratedSeverity(tags, m.Severity);
|
|
9073
9086
|
const req = {
|
|
9074
|
-
id: `Trivy/${firstNonEmpty(m.ID
|
|
9087
|
+
id: `Trivy/${firstNonEmpty(m.ID, m.AVDID)}`,
|
|
9075
9088
|
title: m.Title,
|
|
9076
9089
|
descriptions,
|
|
9077
|
-
impact:
|
|
9090
|
+
impact: severityToImpact$2(m.Severity ?? ""),
|
|
9078
9091
|
tags,
|
|
9079
9092
|
refs: buildRefs$5([m.PrimaryURL, ...m.References ?? []]),
|
|
9080
9093
|
code: JSON.stringify(m, null, 2),
|
|
@@ -9082,7 +9095,7 @@ function convertMisconf(m, res, startTime) {
|
|
|
9082
9095
|
verificationMethod: VerificationMethodEnum.Automated,
|
|
9083
9096
|
results: [{
|
|
9084
9097
|
status: misconfStatus(m.Status),
|
|
9085
|
-
codeDesc: firstNonEmpty(m.Message
|
|
9098
|
+
codeDesc: firstNonEmpty(m.Message, m.Title),
|
|
9086
9099
|
startTime
|
|
9087
9100
|
}]
|
|
9088
9101
|
};
|
|
@@ -9104,9 +9117,9 @@ function convertSecret(s, res, startTime) {
|
|
|
9104
9117
|
title: s.Title,
|
|
9105
9118
|
descriptions: [{
|
|
9106
9119
|
label: "default",
|
|
9107
|
-
data: `${firstNonEmpty(s.Title
|
|
9120
|
+
data: `${firstNonEmpty(s.Title, s.RuleID)} detected in ${res.Target ?? ""} (value redacted by Trivy).`
|
|
9108
9121
|
}],
|
|
9109
|
-
impact:
|
|
9122
|
+
impact: severityToImpact$2(s.Severity ?? ""),
|
|
9110
9123
|
tags,
|
|
9111
9124
|
code: JSON.stringify(s, null, 2),
|
|
9112
9125
|
controlType: deriveControlTypeFromTags(DEFAULT_STATIC_ANALYSIS_NIST_TAGS),
|
|
@@ -9138,7 +9151,7 @@ function convertLicense(l, res, startTime) {
|
|
|
9138
9151
|
label: "default",
|
|
9139
9152
|
data: `Package ${l.PkgName ?? ""} uses the ${l.Name ?? ""} license (category: ${l.Category ?? ""}).`
|
|
9140
9153
|
}],
|
|
9141
|
-
impact:
|
|
9154
|
+
impact: severityToImpact$2(l.Severity ?? ""),
|
|
9142
9155
|
tags,
|
|
9143
9156
|
refs: buildRefs$5([l.Link]),
|
|
9144
9157
|
code: JSON.stringify(l, null, 2),
|
|
@@ -9219,6 +9232,17 @@ function buildCvssEntries$4(m) {
|
|
|
9219
9232
|
}
|
|
9220
9233
|
return entries.length > 0 ? entries : void 0;
|
|
9221
9234
|
}
|
|
9235
|
+
const PURL_ECOSYSTEMS = {
|
|
9236
|
+
deb: Ecosystem.Deb,
|
|
9237
|
+
rpm: Ecosystem.RPM,
|
|
9238
|
+
maven: Ecosystem.Maven,
|
|
9239
|
+
npm: Ecosystem.Npm,
|
|
9240
|
+
pypi: Ecosystem.Pypi,
|
|
9241
|
+
gem: Ecosystem.Gem,
|
|
9242
|
+
cargo: Ecosystem.Cargo,
|
|
9243
|
+
golang: Ecosystem.Go,
|
|
9244
|
+
nuget: Ecosystem.Nuget
|
|
9245
|
+
};
|
|
9222
9246
|
function buildAffectedPackage$1(v) {
|
|
9223
9247
|
const ap = {};
|
|
9224
9248
|
if (v.PkgName) ap.name = v.PkgName;
|
|
@@ -9233,8 +9257,8 @@ function buildAffectedPackage$1(v) {
|
|
|
9233
9257
|
return ap;
|
|
9234
9258
|
}
|
|
9235
9259
|
function ecosystemFromPurl(purl) {
|
|
9236
|
-
const
|
|
9237
|
-
return
|
|
9260
|
+
const type = (purl.replace(/^pkg:/, "").split(/[/@?]/)[0] ?? "").toLowerCase();
|
|
9261
|
+
return PURL_ECOSYSTEMS[type];
|
|
9238
9262
|
}
|
|
9239
9263
|
function buildRefs$5(urls) {
|
|
9240
9264
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -9261,6 +9285,10 @@ function digestPart(ref) {
|
|
|
9261
9285
|
const at = ref.lastIndexOf("@");
|
|
9262
9286
|
return at >= 0 ? ref.slice(at + 1) : ref;
|
|
9263
9287
|
}
|
|
9288
|
+
function firstNonEmpty(...vals) {
|
|
9289
|
+
for (const v of vals) if (v) return v;
|
|
9290
|
+
return "";
|
|
9291
|
+
}
|
|
9264
9292
|
function putIf(m, key, val) {
|
|
9265
9293
|
if (val) m[key] = val;
|
|
9266
9294
|
}
|