sbom-vulnerability-scanner 9.9.0 → 9.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 +6 -0
- package/README.ja.md +2 -0
- package/README.md +2 -0
- package/dist/extension.js +686 -12
- package/l10n/report.en.json +17 -1
- package/l10n/report.ja.json +17 -1
- package/lib/compliance/engine.js +16 -1
- package/lib/config/constants.js +3 -0
- package/lib/policy/policyEvaluator.js +25 -0
- package/lib/report/artifacts.js +13 -3
- package/lib/report/builder.js +3 -0
- package/lib/report/complianceSection.js +49 -0
- package/lib/report/docx.js +2 -1
- package/lib/report/docxContent.js +15 -0
- package/lib/report/sarifExporter.js +3 -1
- package/lib/report/styles.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.10.0
|
|
4
|
+
|
|
5
|
+
- **Standards in the regular analysis**: When the workspace has `.sbom-profile.json`, each analysis evaluates the selected standards and writes `compliance-report-<timestamp>.json`. Results appear in SARIF, the SBOM HTML report and the Word report. A profile naming an unknown standard, or an analysis without an SBOM, is reported as an error rather than a pass.
|
|
6
|
+
- **Policy**: With `.sbom-policy.json`, failed mandatory standard checks are policy violations (`standard:<standard>/<check>`) and advisory checks are warnings. SARIF reports each check once.
|
|
7
|
+
- **Word report**: The inventory section now shows the policy audit stored with the analysis; previously it was omitted.
|
|
8
|
+
|
|
3
9
|
## 9.8.0
|
|
4
10
|
|
|
5
11
|
- **npm provenance**: The npm package is now published from CI with trusted publishing and a signed provenance statement.
|
package/README.ja.md
CHANGED
|
@@ -141,6 +141,8 @@ sbom-scanner scan . --standard cisa,cra,bsi,fda --profile .sbom-profile.json
|
|
|
141
141
|
|
|
142
142
|
この検査は技術的な補助であり、法的助言や認証ではありません。
|
|
143
143
|
|
|
144
|
+
ワークスペースに `.sbom-profile.json` があると、VS Code の通常の解析でも選択した規格を評価します。結果は `compliance-report-<日時>.json` と SARIF に出力され、SBOM の HTML レポートと Word レポートにも表示されます。`.sbom-policy.json` がある場合、不合格の必須チェックはポリシー違反(`standard:<規格>/<チェック>`)になり、推奨チェックは警告になります。
|
|
145
|
+
|
|
144
146
|
```json
|
|
145
147
|
{
|
|
146
148
|
"standards": ["cra", "bsi"],
|
package/README.md
CHANGED
|
@@ -152,6 +152,8 @@ sbom-scanner scan . --standard cisa,cra,bsi,fda --profile .sbom-profile.json
|
|
|
152
152
|
|
|
153
153
|
These checks are an engineering aid and are not a legal or certification opinion.
|
|
154
154
|
|
|
155
|
+
When the workspace contains `.sbom-profile.json`, the regular analysis in VS Code also evaluates the selected standards. The results are written to `compliance-report-<timestamp>.json` and SARIF, and shown in the SBOM HTML report and the Word report. If `.sbom-policy.json` exists, failed mandatory checks become policy violations (`standard:<standard>/<check>`), and advisory checks become warnings.
|
|
156
|
+
|
|
155
157
|
```json
|
|
156
158
|
{
|
|
157
159
|
"standards": ["cra", "bsi"],
|
package/dist/extension.js
CHANGED
|
@@ -144,6 +144,9 @@ var require_constants = __commonJS({
|
|
|
144
144
|
typeCompliance: "compliance",
|
|
145
145
|
severityError: "error",
|
|
146
146
|
severityWarning: "warning",
|
|
147
|
+
standardRulePrefix: "standard:",
|
|
148
|
+
ruleStandardsEvaluation: "standardsEvaluation",
|
|
149
|
+
standardsTarget: ".sbom-profile.json",
|
|
147
150
|
badgeViolation: "\u{1F6E1}\uFE0F POLICY VIOLATION",
|
|
148
151
|
defaultMinCraScore: 75,
|
|
149
152
|
defaultMaxEpss: 0.5
|
|
@@ -373,7 +376,7 @@ var require_package = __commonJS({
|
|
|
373
376
|
name: "sbom-vulnerability-scanner",
|
|
374
377
|
displayName: "%ext.displayName%",
|
|
375
378
|
description: "%ext.description%",
|
|
376
|
-
version: "9.
|
|
379
|
+
version: "9.11.0",
|
|
377
380
|
publisher: "masahirocom",
|
|
378
381
|
author: "masahiroid",
|
|
379
382
|
private: false,
|
|
@@ -2894,7 +2897,9 @@ var require_styles = __commonJS({
|
|
|
2894
2897
|
font-family: SFMono-Regular, Consolas, monospace;
|
|
2895
2898
|
font-size: 12px;
|
|
2896
2899
|
word-break: break-all;
|
|
2897
|
-
}
|
|
2900
|
+
}
|
|
2901
|
+
.standard-pass { color: #16a34a; font-weight: 700; }
|
|
2902
|
+
.standard-fail, .standards-error { color: #dc2626; font-weight: 700; }`;
|
|
2898
2903
|
var VULNERABILITY_STYLES = ` :root {
|
|
2899
2904
|
--bg: #ffffff;
|
|
2900
2905
|
--fg: #1f2328;
|
|
@@ -3556,6 +3561,20 @@ var require_policyEvaluator = __commonJS({
|
|
|
3556
3561
|
}
|
|
3557
3562
|
return false;
|
|
3558
3563
|
}
|
|
3564
|
+
function standardViolations(compliance, violationSeverity) {
|
|
3565
|
+
if (!compliance) return [];
|
|
3566
|
+
if (compliance.status === "ERROR") {
|
|
3567
|
+
return [{ type: POLICY.typeCompliance, rule: POLICY.ruleStandardsEvaluation, target: POLICY.standardsTarget, severity: violationSeverity, standardId: null, message: `Standards evaluation could not run (${compliance.errorKey})` }];
|
|
3568
|
+
}
|
|
3569
|
+
return (compliance.standards || []).flatMap((standard) => standard.checks.filter((check) => !check.passed).map((check) => ({
|
|
3570
|
+
type: POLICY.typeCompliance,
|
|
3571
|
+
rule: `${POLICY.standardRulePrefix}${standard.standardId}/${check.id}`,
|
|
3572
|
+
target: `${standard.standardId.toUpperCase()} ${check.clause}`,
|
|
3573
|
+
severity: check.severity === POLICY.severityError ? violationSeverity : POLICY.severityWarning,
|
|
3574
|
+
standardId: standard.standardId,
|
|
3575
|
+
message: check.message
|
|
3576
|
+
})));
|
|
3577
|
+
}
|
|
3559
3578
|
function evaluatePolicy(policy, data = {}) {
|
|
3560
3579
|
if (!policy || typeof policy !== "object") {
|
|
3561
3580
|
return {
|
|
@@ -3689,6 +3708,7 @@ var require_policyEvaluator = __commonJS({
|
|
|
3689
3708
|
}
|
|
3690
3709
|
}
|
|
3691
3710
|
}
|
|
3711
|
+
violations.push(...standardViolations(data.compliance, violationSeverity));
|
|
3692
3712
|
const errors = violations.filter((v) => v.severity === POLICY.severityError).length;
|
|
3693
3713
|
const warnings = violations.filter((v) => v.severity === POLICY.severityWarning).length;
|
|
3694
3714
|
const passed = errors === 0;
|
|
@@ -3922,7 +3942,23 @@ var require_report_en = __commonJS({
|
|
|
3922
3942
|
notScanned: "Vulnerability scan not run",
|
|
3923
3943
|
scanFailed: "Vulnerability scan failed",
|
|
3924
3944
|
scanClear: "known vulnerabilities"
|
|
3925
|
-
}
|
|
3945
|
+
},
|
|
3946
|
+
standardsConformance: "Standards Conformance (.sbom-profile.json)",
|
|
3947
|
+
standardsConformanceNotice: "Checks for the standards selected in .sbom-profile.json. A standard fails only on failed mandatory checks; advisory checks are listed as warnings.",
|
|
3948
|
+
standardsEvaluationError: "The standards evaluation could not run, so conformance is not established.",
|
|
3949
|
+
complianceError_unknownStandard: ".sbom-profile.json names a standard that is not supported.",
|
|
3950
|
+
complianceError_noSbom: "No SBOM was generated, so conformance could not be evaluated.",
|
|
3951
|
+
standardClause: "Clause",
|
|
3952
|
+
checkSeverity: "Severity",
|
|
3953
|
+
checkMandatory: "Mandatory",
|
|
3954
|
+
checkAdvisory: "Advisory",
|
|
3955
|
+
failedChecks: "Failed checks",
|
|
3956
|
+
allChecksPassed: "All checks passed.",
|
|
3957
|
+
standard_cisa: "CISA SBOM Minimum Elements (2026)",
|
|
3958
|
+
standard_cra: "EU Cyber Resilience Act",
|
|
3959
|
+
standard_bsi: "BSI TR-03183-2",
|
|
3960
|
+
standard_fda: "FDA Section 524B",
|
|
3961
|
+
standard_profile: "Profile requirements"
|
|
3926
3962
|
};
|
|
3927
3963
|
}
|
|
3928
3964
|
});
|
|
@@ -4127,7 +4163,23 @@ var require_report_ja = __commonJS({
|
|
|
4127
4163
|
notScanned: "\u8106\u5F31\u6027\u306F\u672A\u691C\u67FB",
|
|
4128
4164
|
scanFailed: "\u8106\u5F31\u6027\u691C\u67FB\u306B\u5931\u6557",
|
|
4129
4165
|
scanClear: "\u65E2\u77E5\u306E\u8106\u5F31\u6027\u306A\u3057"
|
|
4130
|
-
}
|
|
4166
|
+
},
|
|
4167
|
+
standardsConformance: "\u898F\u683C\u9069\u5408\u30C1\u30A7\u30C3\u30AF\uFF08.sbom-profile.json\uFF09",
|
|
4168
|
+
standardsConformanceNotice: ".sbom-profile.json \u3067\u9078\u629E\u3057\u305F\u898F\u683C\u306E\u30C1\u30A7\u30C3\u30AF\u7D50\u679C\u3067\u3059\u3002\u5FC5\u9808\u30C1\u30A7\u30C3\u30AF\u306E\u4E0D\u5408\u683C\u3060\u3051\u304C\u898F\u683C\u306E\u4E0D\u5408\u683C\u306B\u306A\u308A\u3001\u63A8\u5968\u30C1\u30A7\u30C3\u30AF\u306F\u8B66\u544A\u3068\u3057\u3066\u8868\u793A\u3057\u307E\u3059\u3002",
|
|
4169
|
+
standardsEvaluationError: "\u898F\u683C\u306E\u8A55\u4FA1\u3092\u5B9F\u884C\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u9069\u5408\u6027\u306F\u78BA\u8A8D\u3067\u304D\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
4170
|
+
complianceError_unknownStandard: ".sbom-profile.json \u306B\u672A\u5BFE\u5FDC\u306E\u898F\u683C\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002",
|
|
4171
|
+
complianceError_noSbom: "SBOM \u3092\u751F\u6210\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u9069\u5408\u6027\u3092\u8A55\u4FA1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",
|
|
4172
|
+
standardClause: "\u6761\u9805",
|
|
4173
|
+
checkSeverity: "\u533A\u5206",
|
|
4174
|
+
checkMandatory: "\u5FC5\u9808",
|
|
4175
|
+
checkAdvisory: "\u63A8\u5968",
|
|
4176
|
+
failedChecks: "\u4E0D\u5408\u683C\u306E\u30C1\u30A7\u30C3\u30AF",
|
|
4177
|
+
allChecksPassed: "\u3059\u3079\u3066\u306E\u30C1\u30A7\u30C3\u30AF\u306B\u5408\u683C\u3057\u307E\u3057\u305F\u3002",
|
|
4178
|
+
standard_cisa: "CISA SBOM \u6700\u5C0F\u8981\u7D20\uFF082026\uFF09",
|
|
4179
|
+
standard_cra: "EU \u30B5\u30A4\u30D0\u30FC\u30EC\u30B8\u30EA\u30A8\u30F3\u30B9\u6CD5",
|
|
4180
|
+
standard_bsi: "BSI TR-03183-2",
|
|
4181
|
+
standard_fda: "FDA 524B \u6761",
|
|
4182
|
+
standard_profile: "\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u8981\u4EF6"
|
|
4131
4183
|
};
|
|
4132
4184
|
}
|
|
4133
4185
|
});
|
|
@@ -22915,7 +22967,7 @@ var require_dist = __commonJS({
|
|
|
22915
22967
|
var require_ref = /* @__PURE__ */ __commonJSMin(((exports3, module3) => {
|
|
22916
22968
|
module3.exports = ReferenceError;
|
|
22917
22969
|
}));
|
|
22918
|
-
var
|
|
22970
|
+
var require_syntax2 = /* @__PURE__ */ __commonJSMin(((exports3, module3) => {
|
|
22919
22971
|
module3.exports = SyntaxError;
|
|
22920
22972
|
}));
|
|
22921
22973
|
var require_type = /* @__PURE__ */ __commonJSMin(((exports3, module3) => {
|
|
@@ -23113,7 +23165,7 @@ var require_dist = __commonJS({
|
|
|
23113
23165
|
var $EvalError = require_eval();
|
|
23114
23166
|
var $RangeError = require_range();
|
|
23115
23167
|
var $ReferenceError = require_ref();
|
|
23116
|
-
var $SyntaxError =
|
|
23168
|
+
var $SyntaxError = require_syntax2();
|
|
23117
23169
|
var $TypeError = require_type();
|
|
23118
23170
|
var $URIError = require_uri();
|
|
23119
23171
|
var abs = require_abs();
|
|
@@ -23622,7 +23674,7 @@ var require_dist = __commonJS({
|
|
|
23622
23674
|
}));
|
|
23623
23675
|
var require_define_data_property = /* @__PURE__ */ __commonJSMin(((exports3, module3) => {
|
|
23624
23676
|
var $defineProperty = require_es_define_property();
|
|
23625
|
-
var $SyntaxError =
|
|
23677
|
+
var $SyntaxError = require_syntax2();
|
|
23626
23678
|
var $TypeError = require_type();
|
|
23627
23679
|
var gopd = require_gopd();
|
|
23628
23680
|
module3.exports = function defineDataProperty(obj, property, value) {
|
|
@@ -33040,6 +33092,46 @@ var require_analysisWorkflow = __commonJS({
|
|
|
33040
33092
|
}
|
|
33041
33093
|
});
|
|
33042
33094
|
|
|
33095
|
+
// lib/report/complianceSection.js
|
|
33096
|
+
var require_complianceSection = __commonJS({
|
|
33097
|
+
"lib/report/complianceSection.js"(exports2, module2) {
|
|
33098
|
+
"use strict";
|
|
33099
|
+
var { escapeHtml } = require_common();
|
|
33100
|
+
var SEVERITY_ERROR = "error";
|
|
33101
|
+
function complianceView(compliance, labels) {
|
|
33102
|
+
if (!compliance) return null;
|
|
33103
|
+
if (compliance.status === "ERROR") {
|
|
33104
|
+
return { error: `${labels.standardsEvaluationError} ${labels[`complianceError_${compliance.errorKey}`] || compliance.errorKey}`, standards: [], failures: [] };
|
|
33105
|
+
}
|
|
33106
|
+
const nameOf = (id) => labels[`standard_${id}`] || id;
|
|
33107
|
+
return {
|
|
33108
|
+
error: null,
|
|
33109
|
+
standards: compliance.standards.map((standard) => ({ name: nameOf(standard.standardId), passed: standard.passed, status: standard.passed ? labels.compliant : labels.actionNeeded })),
|
|
33110
|
+
failures: compliance.standards.flatMap((standard) => standard.checks.filter((check) => !check.passed).map((check) => ({
|
|
33111
|
+
standard: nameOf(standard.standardId),
|
|
33112
|
+
clause: check.clause,
|
|
33113
|
+
severity: check.severity === SEVERITY_ERROR ? labels.checkMandatory : labels.checkAdvisory,
|
|
33114
|
+
message: check.message
|
|
33115
|
+
})))
|
|
33116
|
+
};
|
|
33117
|
+
}
|
|
33118
|
+
function renderComplianceHtml(compliance, labels) {
|
|
33119
|
+
const view = complianceView(compliance, labels);
|
|
33120
|
+
if (!view) return "";
|
|
33121
|
+
const heading = `<h2>${escapeHtml(labels.standardsConformance)}</h2><p>${escapeHtml(labels.standardsConformanceNotice)}</p>`;
|
|
33122
|
+
if (view.error) return `<section class="standards-conformance">${heading}<p class="standards-error"><strong>${escapeHtml(view.error)}</strong></p></section>`;
|
|
33123
|
+
const statusRows = view.standards.map((row) => `<tr><td>${escapeHtml(row.name)}</td><td class="${row.passed ? "standard-pass" : "standard-fail"}">${escapeHtml(row.status)}</td></tr>`).join("");
|
|
33124
|
+
const failures = view.failures.length ? `<h3>${escapeHtml(labels.failedChecks)}</h3>
|
|
33125
|
+
<table><thead><tr><th>${escapeHtml(labels.standardName)}</th><th>${escapeHtml(labels.standardClause)}</th><th>${escapeHtml(labels.checkSeverity)}</th><th>${escapeHtml(labels.policyMessage)}</th></tr></thead>
|
|
33126
|
+
<tbody>${view.failures.map((row) => `<tr><td>${escapeHtml(row.standard)}</td><td>${escapeHtml(row.clause)}</td><td>${escapeHtml(row.severity)}</td><td>${escapeHtml(row.message)}</td></tr>`).join("")}</tbody></table>` : `<p>${escapeHtml(labels.allChecksPassed)}</p>`;
|
|
33127
|
+
return `<section class="standards-conformance">${heading}
|
|
33128
|
+
<table><thead><tr><th>${escapeHtml(labels.standardName)}</th><th>${escapeHtml(labels.complianceStatus)}</th></tr></thead><tbody>${statusRows}</tbody></table>
|
|
33129
|
+
${failures}</section>`;
|
|
33130
|
+
}
|
|
33131
|
+
module2.exports = { complianceView, renderComplianceHtml };
|
|
33132
|
+
}
|
|
33133
|
+
});
|
|
33134
|
+
|
|
33043
33135
|
// lib/report/builder.js
|
|
33044
33136
|
var require_builder = __commonJS({
|
|
33045
33137
|
"lib/report/builder.js"(exports2, module2) {
|
|
@@ -33050,6 +33142,8 @@ var require_builder = __commonJS({
|
|
|
33050
33142
|
var { escapeHtml } = require_common();
|
|
33051
33143
|
var { auditComponentLicenses } = require_licenseClassifier();
|
|
33052
33144
|
var { auditSbomCraReadiness } = require_craAuditor();
|
|
33145
|
+
var { getReportLabels } = require_labels();
|
|
33146
|
+
var { renderComplianceHtml } = require_complianceSection();
|
|
33053
33147
|
function describeComponentScope(component) {
|
|
33054
33148
|
if (component.scope) return component.scope;
|
|
33055
33149
|
if (component.isDirect) return "required";
|
|
@@ -33188,6 +33282,7 @@ ${SBOM_STYLES}
|
|
|
33188
33282
|
</div>
|
|
33189
33283
|
|
|
33190
33284
|
${policyAlertHtml}
|
|
33285
|
+
${renderComplianceHtml(options.compliance || null, getReportLabels(options.language))}
|
|
33191
33286
|
${renderCraReadinessSection(craResult)}
|
|
33192
33287
|
${renderComponentTable(components)}
|
|
33193
33288
|
</body>
|
|
@@ -33472,7 +33567,8 @@ var require_sarifExporter = __commonJS({
|
|
|
33472
33567
|
if (!rules.has(rule.id)) rules.set(rule.id, rule);
|
|
33473
33568
|
results.push(buildVulnerabilityResult(vuln, workspacePath));
|
|
33474
33569
|
}
|
|
33475
|
-
|
|
33570
|
+
const policyViolations = Array.isArray(policyResult?.violations) ? policyResult.violations : [];
|
|
33571
|
+
for (const violation of compliance ? policyViolations.filter((item) => item.standardId === void 0) : policyViolations) {
|
|
33476
33572
|
const rule = buildPolicyRule(violation);
|
|
33477
33573
|
if (!rules.has(rule.id)) rules.set(rule.id, rule);
|
|
33478
33574
|
results.push(buildPolicyResult(violation));
|
|
@@ -33504,6 +33600,560 @@ var require_sarifExporter = __commonJS({
|
|
|
33504
33600
|
}
|
|
33505
33601
|
});
|
|
33506
33602
|
|
|
33603
|
+
// lib/profile/profileLoader.js
|
|
33604
|
+
var require_profileLoader = __commonJS({
|
|
33605
|
+
"lib/profile/profileLoader.js"(exports2, module2) {
|
|
33606
|
+
"use strict";
|
|
33607
|
+
var fs = require("node:fs");
|
|
33608
|
+
var path2 = require("node:path");
|
|
33609
|
+
var { COMPLIANCE } = require_constants();
|
|
33610
|
+
var stringList = (value) => Array.isArray(value) ? value.map((item) => String(item).trim()).filter(Boolean) : [];
|
|
33611
|
+
var optionalText = (value) => typeof value === "string" && value.trim() ? value.trim() : null;
|
|
33612
|
+
function normalizeProfile(parsed) {
|
|
33613
|
+
const requested = stringList(parsed.standards).map((id) => id.toLowerCase());
|
|
33614
|
+
return {
|
|
33615
|
+
name: optionalText(parsed.name) || COMPLIANCE.profileDefaultName,
|
|
33616
|
+
standards: requested.filter((id) => COMPLIANCE.standardIds.includes(id)),
|
|
33617
|
+
unknownStandards: requested.filter((id) => !COMPLIANCE.standardIds.includes(id)),
|
|
33618
|
+
requireFields: stringList(parsed.requireFields),
|
|
33619
|
+
requireHashAlgorithms: stringList(parsed.requireHashAlgorithms).map((item) => item.toUpperCase().replaceAll("-", "")),
|
|
33620
|
+
vulnerabilityContact: optionalText(parsed.vulnerabilityContact),
|
|
33621
|
+
productContact: optionalText(parsed.productContact),
|
|
33622
|
+
supportProperties: {
|
|
33623
|
+
level: optionalText(parsed.supportProperties?.level) || COMPLIANCE.supportLevelProperty,
|
|
33624
|
+
endOfSupport: optionalText(parsed.supportProperties?.endOfSupport) || COMPLIANCE.endOfSupportProperty
|
|
33625
|
+
}
|
|
33626
|
+
};
|
|
33627
|
+
}
|
|
33628
|
+
function loadProfileConfig(projectPath, profilePath) {
|
|
33629
|
+
if (!projectPath || typeof projectPath !== "string") return null;
|
|
33630
|
+
try {
|
|
33631
|
+
const parsed = JSON.parse(fs.readFileSync(path2.resolve(projectPath, profilePath || COMPLIANCE.profileFileName), "utf8"));
|
|
33632
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? normalizeProfile(parsed) : null;
|
|
33633
|
+
} catch {
|
|
33634
|
+
return null;
|
|
33635
|
+
}
|
|
33636
|
+
}
|
|
33637
|
+
module2.exports = { loadProfileConfig, normalizeProfile };
|
|
33638
|
+
}
|
|
33639
|
+
});
|
|
33640
|
+
|
|
33641
|
+
// l10n/compliance.en.json
|
|
33642
|
+
var require_compliance_en = __commonJS({
|
|
33643
|
+
"l10n/compliance.en.json"(exports2, module2) {
|
|
33644
|
+
module2.exports = {
|
|
33645
|
+
componentsPresent: "The SBOM must list at least one component.",
|
|
33646
|
+
supplier: "{failed} of {total} component(s) have no supplier.",
|
|
33647
|
+
name: "{failed} of {total} component(s) have no name.",
|
|
33648
|
+
version: "{failed} of {total} component(s) have no version.",
|
|
33649
|
+
identifier: "{failed} of {total} component(s) have no unique identifier.",
|
|
33650
|
+
dependencies: "{failed} of {total} component(s) do not appear in the dependency graph.",
|
|
33651
|
+
sbomAuthor: "The SBOM does not identify its author.",
|
|
33652
|
+
timestamp: "The SBOM has no timestamp.",
|
|
33653
|
+
hash: "{failed} of {total} component(s) have no hash value and algorithm. State that it is unknown if the artifact was not available.",
|
|
33654
|
+
license: "{failed} of {total} component(s) have no license information. State that it is unknown if it was not determined.",
|
|
33655
|
+
toolName: "The SBOM does not name the tool that generated it.",
|
|
33656
|
+
machineReadable: "The SBOM source is not a recognized machine-readable format.",
|
|
33657
|
+
topLevelDependencies: "The SBOM does not identify any top-level dependency of the product.",
|
|
33658
|
+
vulnerabilityContact: "No vulnerability reporting contact (email or URL) was found. Set vulnerabilityContact in .sbom-profile.json if it is published outside the SBOM.",
|
|
33659
|
+
productContact: "No manufacturer contact (email or URL) was found. Set productContact in .sbom-profile.json if it is published outside the SBOM.",
|
|
33660
|
+
formatVersion: "A newly generated SBOM must be JSON or XML in CycloneDX 1.6+ or SPDX 3.0.1+. An SBOM that was compliant when delivered remains compliant (section 7).",
|
|
33661
|
+
creatorContact: "The SBOM creator has no email address or URL.",
|
|
33662
|
+
componentCreator: "{failed} of {total} component(s) have no creator email address or URL.",
|
|
33663
|
+
filename: "{failed} of {total} component(s) have no bsi:component:filename property.",
|
|
33664
|
+
dependencyCompleteness: "The SBOM does not state the completeness of its dependency enumeration.",
|
|
33665
|
+
licenseExpression: "{failed} of {total} component(s) have no valid SPDX license identifier or expression.",
|
|
33666
|
+
sha512: "{failed} of {total} component(s) have no SHA-512 hash.",
|
|
33667
|
+
executableProperty: "{failed} of {total} component(s) have no valid bsi:component:executable property.",
|
|
33668
|
+
archiveProperty: "{failed} of {total} component(s) have no valid bsi:component:archive property.",
|
|
33669
|
+
structuredProperty: "{failed} of {total} component(s) have no valid bsi:component:structured property.",
|
|
33670
|
+
supportLevel: "{failed} of {total} component(s) have no support level property. Provide it in an addendum if it is not in the SBOM.",
|
|
33671
|
+
endOfSupport: "{failed} of {total} component(s) have no valid end-of-support date property. Provide it in an addendum if it is not in the SBOM.",
|
|
33672
|
+
requireField: '{failed} of {total} component(s) do not satisfy the required field "{detail}".',
|
|
33673
|
+
unsupportedField: 'The required field "{detail}" is not supported, so it could not be verified.',
|
|
33674
|
+
requireHash: "{failed} of {total} component(s) have no {detail} hash.",
|
|
33675
|
+
identifierSyntax: "{failed} of {total} component(s) have a syntactically invalid PURL or CPE.",
|
|
33676
|
+
timestampFormat: "The SBOM timestamp is not an RFC 3339 date-time with a timezone, so it may not be machine-comparable.",
|
|
33677
|
+
"bsi.timestamp": "The SBOM timestamp is missing or is not an RFC 3339 date-time with a timezone.",
|
|
33678
|
+
generationContext: "The SBOM does not state its generation context (before, during or after build).",
|
|
33679
|
+
"cisa.timestampFormat": "The SBOM timestamp does not follow RFC 9557.",
|
|
33680
|
+
producer: "{failed} of {total} component(s) have no component producer.",
|
|
33681
|
+
authorSignature: "No embedded SBOM author signature was found. A detached signature cannot be checked here.",
|
|
33682
|
+
dataFormat: "The SBOM does not state its data format name and version.",
|
|
33683
|
+
toolVersion: "The SBOM does not state the version of its generation tool.",
|
|
33684
|
+
sbomVersion: "The SBOM does not state a version for this document."
|
|
33685
|
+
};
|
|
33686
|
+
}
|
|
33687
|
+
});
|
|
33688
|
+
|
|
33689
|
+
// l10n/compliance.ja.json
|
|
33690
|
+
var require_compliance_ja = __commonJS({
|
|
33691
|
+
"l10n/compliance.ja.json"(exports2, module2) {
|
|
33692
|
+
module2.exports = {
|
|
33693
|
+
componentsPresent: "SBOM \u306B\u306F\u5C11\u306A\u304F\u3068\u3082 1 \u3064\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u5FC5\u8981\u3067\u3059\u3002",
|
|
33694
|
+
supplier: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u30B5\u30D7\u30E9\u30A4\u30E4\u30FC\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33695
|
+
name: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u540D\u524D\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33696
|
+
version: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u30D0\u30FC\u30B8\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33697
|
+
identifier: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u4E00\u610F\u306E\u8B58\u5225\u5B50\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33698
|
+
dependencies: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u4F9D\u5B58\u95A2\u4FC2\u30B0\u30E9\u30D5\u306B\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
33699
|
+
sbomAuthor: "SBOM \u306E\u4F5C\u6210\u8005\u304C\u8A18\u8F09\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
33700
|
+
timestamp: "SBOM \u306B\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33701
|
+
hash: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u30CF\u30C3\u30B7\u30E5\u5024\u3068\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u6210\u679C\u7269\u3092\u5165\u624B\u3067\u304D\u306A\u3044\u5834\u5408\u306F\u4E0D\u660E\u3068\u660E\u8A18\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
33702
|
+
license: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u30E9\u30A4\u30BB\u30F3\u30B9\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u5224\u5B9A\u3067\u304D\u306A\u3044\u5834\u5408\u306F\u4E0D\u660E\u3068\u660E\u8A18\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
33703
|
+
toolName: "SBOM \u3092\u751F\u6210\u3057\u305F\u30C4\u30FC\u30EB\u540D\u304C\u8A18\u8F09\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
33704
|
+
machineReadable: "SBOM \u306E\u5165\u529B\u5143\u304C\u3001\u8A8D\u8B58\u3067\u304D\u308B\u6A5F\u68B0\u53EF\u8AAD\u5F62\u5F0F\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33705
|
+
topLevelDependencies: "\u88FD\u54C1\u306E\u30C8\u30C3\u30D7\u30EC\u30D9\u30EB\u4F9D\u5B58\u95A2\u4FC2\u304C SBOM \u3067\u7279\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002",
|
|
33706
|
+
vulnerabilityContact: "\u8106\u5F31\u6027\u306E\u5831\u544A\u7A93\u53E3\uFF08\u30E1\u30FC\u30EB\u307E\u305F\u306F URL\uFF09\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002SBOM \u306E\u5916\u3067\u516C\u958B\u3057\u3066\u3044\u308B\u5834\u5408\u306F .sbom-profile.json \u306E vulnerabilityContact \u306B\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
33707
|
+
productContact: "\u88FD\u9020\u8005\u306E\u9023\u7D61\u5148\uFF08\u30E1\u30FC\u30EB\u307E\u305F\u306F URL\uFF09\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002SBOM \u306E\u5916\u3067\u516C\u958B\u3057\u3066\u3044\u308B\u5834\u5408\u306F .sbom-profile.json \u306E productContact \u306B\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
33708
|
+
formatVersion: "\u65B0\u898F\u306B\u751F\u6210\u3059\u308B SBOM \u306F\u3001JSON \u307E\u305F\u306F XML \u306E CycloneDX 1.6 \u4EE5\u4E0A\u3001\u3082\u3057\u304F\u306F SPDX 3.0.1 \u4EE5\u4E0A\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u7D0D\u54C1\u6642\u70B9\u3067\u9069\u5408\u3057\u3066\u3044\u305F SBOM \u306F\u9069\u5408\u306E\u307E\u307E\u3067\u3059\uFF08\u7B2C7\u7BC0\uFF09\u3002",
|
|
33709
|
+
creatorContact: "SBOM \u4F5C\u6210\u8005\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u307E\u305F\u306F URL \u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33710
|
+
componentCreator: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u4F5C\u6210\u8005\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u307E\u305F\u306F URL \u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33711
|
+
filename: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B bsi:component:filename \u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33712
|
+
dependencyCompleteness: "\u4F9D\u5B58\u95A2\u4FC2\u306E\u5217\u6319\u304C\u5B8C\u5168\u304B\u3069\u3046\u304B\u304C SBOM \u306B\u8A18\u8F09\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
33713
|
+
licenseExpression: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u6709\u52B9\u306A SPDX \u30E9\u30A4\u30BB\u30F3\u30B9\u8B58\u5225\u5B50\u307E\u305F\u306F\u5F0F\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33714
|
+
sha512: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B SHA-512 \u30CF\u30C3\u30B7\u30E5\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33715
|
+
executableProperty: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u6709\u52B9\u306A bsi:component:executable \u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33716
|
+
archiveProperty: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u6709\u52B9\u306A bsi:component:archive \u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33717
|
+
structuredProperty: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u6709\u52B9\u306A bsi:component:structured \u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33718
|
+
supportLevel: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u30B5\u30DD\u30FC\u30C8\u30EC\u30D9\u30EB\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308A\u307E\u305B\u3093\u3002SBOM \u306B\u542B\u3081\u306A\u3044\u5834\u5408\u306F\u5225\u7D19\u3067\u63D0\u4F9B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
33719
|
+
endOfSupport: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u6709\u52B9\u306A\u30B5\u30DD\u30FC\u30C8\u7D42\u4E86\u65E5\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308A\u307E\u305B\u3093\u3002SBOM \u306B\u542B\u3081\u306A\u3044\u5834\u5408\u306F\u5225\u7D19\u3067\u63D0\u4F9B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
33720
|
+
requireField: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u5FC5\u9808\u9805\u76EE\u300C{detail}\u300D\u3092\u6E80\u305F\u3057\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
33721
|
+
unsupportedField: "\u5FC5\u9808\u9805\u76EE\u300C{detail}\u300D\u306F\u672A\u5BFE\u5FDC\u306E\u305F\u3081\u3001\u691C\u8A3C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",
|
|
33722
|
+
requireHash: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B {detail} \u30CF\u30C3\u30B7\u30E5\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33723
|
+
identifierSyntax: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3067 PURL \u307E\u305F\u306F CPE \u306E\u69CB\u6587\u304C\u4E0D\u6B63\u3067\u3059\u3002",
|
|
33724
|
+
timestampFormat: "SBOM \u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\u4ED8\u304D\u306E RFC 3339 \u5F62\u5F0F\u3067\u306F\u306A\u3044\u305F\u3081\u3001\u6A5F\u68B0\u7684\u306B\u6BD4\u8F03\u3067\u304D\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002",
|
|
33725
|
+
"bsi.timestamp": "SBOM \u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u306A\u3044\u304B\u3001\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\u4ED8\u304D\u306E RFC 3339 \u5F62\u5F0F\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33726
|
+
generationContext: "SBOM \u306B\u751F\u6210\u306E\u6587\u8108\uFF08\u30D3\u30EB\u30C9\u524D\u30FB\u30D3\u30EB\u30C9\u4E2D\u30FB\u30D3\u30EB\u30C9\u5F8C\uFF09\u304C\u8A18\u8F09\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
33727
|
+
"cisa.timestampFormat": "SBOM \u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C RFC 9557 \u306B\u6CBF\u3063\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
33728
|
+
producer: "{total} \u4EF6\u4E2D {failed} \u4EF6\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u4F5C\u6210\u5143\uFF08Component Producer\uFF09\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
33729
|
+
authorSignature: "SBOM \u306B\u57CB\u3081\u8FBC\u307E\u308C\u305F\u4F5C\u6210\u8005\u306E\u7F72\u540D\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u5206\u96E2\u7F72\u540D\u306F\u3053\u3053\u3067\u306F\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3002",
|
|
33730
|
+
dataFormat: "SBOM \u306B\u30C7\u30FC\u30BF\u5F62\u5F0F\u306E\u540D\u524D\u3068\u30D0\u30FC\u30B8\u30E7\u30F3\u304C\u8A18\u8F09\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
33731
|
+
toolVersion: "SBOM \u306B\u751F\u6210\u30C4\u30FC\u30EB\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u304C\u8A18\u8F09\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",
|
|
33732
|
+
sbomVersion: "SBOM \u306B\u3053\u306E\u6587\u66F8\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u304C\u8A18\u8F09\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"
|
|
33733
|
+
};
|
|
33734
|
+
}
|
|
33735
|
+
});
|
|
33736
|
+
|
|
33737
|
+
// lib/compliance/syntax.js
|
|
33738
|
+
var require_syntax = __commonJS({
|
|
33739
|
+
"lib/compliance/syntax.js"(exports2, module2) {
|
|
33740
|
+
"use strict";
|
|
33741
|
+
var licenseList = require_spdxLicenseList();
|
|
33742
|
+
var { COMPLIANCE } = require_constants();
|
|
33743
|
+
var PURL_PATTERN = /^pkg:[a-z][a-z0-9.+-]*\/[^\s?#]+(\?[^\s#]*)?(#\S*)?$/i;
|
|
33744
|
+
var BAD_PERCENT_PATTERN = /%(?![0-9a-f]{2})/i;
|
|
33745
|
+
var CPE22_PATTERN = /^cpe:\/[aho](:[^\s:]*)*$/i;
|
|
33746
|
+
var CPE23_PREFIX = "cpe:2.3:";
|
|
33747
|
+
var CPE23_PARTS = /^[aho*-]$/i;
|
|
33748
|
+
var TIMESTAMP_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;
|
|
33749
|
+
var DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})(T.*)?$/;
|
|
33750
|
+
var EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
33751
|
+
var EMBEDDED_EMAIL_PATTERN = /[^\s()<>@]+@[^\s()<>@]+\.[^\s()<>@]+/;
|
|
33752
|
+
var URL_PATTERN = /^https?:\/\/[^\s]+$/i;
|
|
33753
|
+
var LICENSE_REF_PATTERN = /^(DocumentRef-[A-Za-z0-9.-]+:)?LicenseRef-[A-Za-z0-9.-]+$/;
|
|
33754
|
+
var TOKEN_PATTERN = /[()]|[^\s()]+/g;
|
|
33755
|
+
var OPERATORS = /* @__PURE__ */ new Set(["AND", "OR", "and", "or"]);
|
|
33756
|
+
function isValidPurl(value) {
|
|
33757
|
+
return typeof value === "string" && PURL_PATTERN.test(value) && !BAD_PERCENT_PATTERN.test(value);
|
|
33758
|
+
}
|
|
33759
|
+
function isValidCpe(value) {
|
|
33760
|
+
if (typeof value !== "string") return false;
|
|
33761
|
+
if (CPE22_PATTERN.test(value)) return true;
|
|
33762
|
+
if (!value.toLowerCase().startsWith(CPE23_PREFIX)) return false;
|
|
33763
|
+
const parts = value.slice(CPE23_PREFIX.length).split(/(?<!\\):/);
|
|
33764
|
+
return parts.length === COMPLIANCE.cpe23ComponentCount && CPE23_PARTS.test(parts[0]) && parts.every((part) => part.length > 0 && !/\s/.test(part));
|
|
33765
|
+
}
|
|
33766
|
+
function isCalendarDate(year, month, day) {
|
|
33767
|
+
return month >= 1 && month <= COMPLIANCE.monthsPerYear && day >= 1 && day <= new Date(Date.UTC(year, month, 0)).getUTCDate();
|
|
33768
|
+
}
|
|
33769
|
+
function isStrictTimestamp(value) {
|
|
33770
|
+
const match = typeof value === "string" ? value.match(TIMESTAMP_PATTERN) : null;
|
|
33771
|
+
if (!match || !isCalendarDate(Number(match[1]), Number(match[2]), Number(match[3]))) return false;
|
|
33772
|
+
return !Number.isNaN(Date.parse(value));
|
|
33773
|
+
}
|
|
33774
|
+
function isRfc9557Timestamp(value) {
|
|
33775
|
+
return typeof value === "string" && isStrictTimestamp(value.replace(/(\[[^\]\s]+\])+$/, ""));
|
|
33776
|
+
}
|
|
33777
|
+
function isDateValue(value) {
|
|
33778
|
+
const match = typeof value === "string" ? value.trim().match(DATE_PATTERN) : null;
|
|
33779
|
+
return match !== null && isCalendarDate(Number(match[1]), Number(match[2]), Number(match[3]));
|
|
33780
|
+
}
|
|
33781
|
+
var isEmail = (value) => typeof value === "string" && EMAIL_PATTERN.test(value.trim());
|
|
33782
|
+
var isHttpUrl = (value) => typeof value === "string" && URL_PATTERN.test(value.trim());
|
|
33783
|
+
var isContact = (value) => isEmail(value) || isHttpUrl(value);
|
|
33784
|
+
function extractEmail(value) {
|
|
33785
|
+
return typeof value === "string" ? value.match(EMBEDDED_EMAIL_PATTERN)?.[0] : void 0;
|
|
33786
|
+
}
|
|
33787
|
+
function versionAtLeast(actual, minimum) {
|
|
33788
|
+
if (!/^\d+(\.\d+)*$/.test(String(actual || ""))) return false;
|
|
33789
|
+
const left = String(actual).split(".").map(Number);
|
|
33790
|
+
const right = minimum.split(".").map(Number);
|
|
33791
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
33792
|
+
const difference = (left[index] || 0) - (right[index] || 0);
|
|
33793
|
+
if (difference !== 0) return difference > 0;
|
|
33794
|
+
}
|
|
33795
|
+
return true;
|
|
33796
|
+
}
|
|
33797
|
+
function isLicenseId(token) {
|
|
33798
|
+
if (LICENSE_REF_PATTERN.test(token)) return true;
|
|
33799
|
+
const id = token.endsWith("+") ? token.slice(0, -1) : token;
|
|
33800
|
+
return Object.hasOwn(licenseList.licenses, id);
|
|
33801
|
+
}
|
|
33802
|
+
function isValidLicenseExpression(expression) {
|
|
33803
|
+
if (typeof expression !== "string" || !expression.trim() || expression.length > COMPLIANCE.maxLicenseExpressionLength) return false;
|
|
33804
|
+
const tokens = expression.match(TOKEN_PATTERN) || [];
|
|
33805
|
+
let position = 0;
|
|
33806
|
+
function parseOperand(depth) {
|
|
33807
|
+
const token = tokens[position];
|
|
33808
|
+
if (token === void 0 || depth > COMPLIANCE.maxLicenseExpressionDepth) return false;
|
|
33809
|
+
if (token === "(") {
|
|
33810
|
+
position += 1;
|
|
33811
|
+
if (!parseExpression(depth + 1) || tokens[position] !== ")") return false;
|
|
33812
|
+
position += 1;
|
|
33813
|
+
return true;
|
|
33814
|
+
}
|
|
33815
|
+
if (!isLicenseId(token)) return false;
|
|
33816
|
+
position += 1;
|
|
33817
|
+
if (tokens[position] !== "WITH" && tokens[position] !== "with") return true;
|
|
33818
|
+
position += 1;
|
|
33819
|
+
const exception = tokens[position];
|
|
33820
|
+
if (!exception || !(Object.hasOwn(licenseList.exceptions, exception) || LICENSE_REF_PATTERN.test(exception))) return false;
|
|
33821
|
+
position += 1;
|
|
33822
|
+
return true;
|
|
33823
|
+
}
|
|
33824
|
+
function parseExpression(depth) {
|
|
33825
|
+
if (!parseOperand(depth)) return false;
|
|
33826
|
+
while (OPERATORS.has(tokens[position])) {
|
|
33827
|
+
position += 1;
|
|
33828
|
+
if (!parseOperand(depth)) return false;
|
|
33829
|
+
}
|
|
33830
|
+
return true;
|
|
33831
|
+
}
|
|
33832
|
+
return parseExpression(0) && position === tokens.length;
|
|
33833
|
+
}
|
|
33834
|
+
module2.exports = { isRfc9557Timestamp, isValidPurl, isValidCpe, isStrictTimestamp, isDateValue, isEmail, isHttpUrl, isContact, extractEmail, versionAtLeast, isValidLicenseExpression };
|
|
33835
|
+
}
|
|
33836
|
+
});
|
|
33837
|
+
|
|
33838
|
+
// lib/compliance/checks.js
|
|
33839
|
+
var require_checks = __commonJS({
|
|
33840
|
+
"lib/compliance/checks.js"(exports2, module2) {
|
|
33841
|
+
"use strict";
|
|
33842
|
+
var { COMPLIANCE } = require_constants();
|
|
33843
|
+
var { isValidPurl, isValidCpe, isContact, isValidLicenseExpression, isStrictTimestamp } = require_syntax();
|
|
33844
|
+
var SEVERITY_ERROR = "error";
|
|
33845
|
+
var SEVERITY_WARNING = "warning";
|
|
33846
|
+
var EMPTY_VALUES = /* @__PURE__ */ new Set(["", "unknown", "undefined", "noassertion", "none"]);
|
|
33847
|
+
var hasText = (value) => typeof value === "string" && !EMPTY_VALUES.has(value.trim().toLowerCase());
|
|
33848
|
+
var componentKey = (component) => `${component.name || "unknown"}@${component.version || "unknown"}`;
|
|
33849
|
+
var componentsOf = (sbom) => Array.isArray(sbom?.components) ? sbom.components : [];
|
|
33850
|
+
var documentOf = (sbom) => sbom?.metadata?.sourceDocument || {};
|
|
33851
|
+
function documentCheck(id, clause, severity, passed) {
|
|
33852
|
+
return { id, clause, severity, passed: Boolean(passed), failed: passed ? 0 : 1, total: 1, componentKeys: [] };
|
|
33853
|
+
}
|
|
33854
|
+
function componentCheck(sbom, id, clause, severity, predicate) {
|
|
33855
|
+
const components = componentsOf(sbom);
|
|
33856
|
+
const failing = components.filter((component) => !predicate(component));
|
|
33857
|
+
return {
|
|
33858
|
+
id,
|
|
33859
|
+
clause,
|
|
33860
|
+
severity,
|
|
33861
|
+
passed: failing.length === 0,
|
|
33862
|
+
failed: failing.length,
|
|
33863
|
+
total: components.length,
|
|
33864
|
+
componentKeys: failing.slice(0, COMPLIANCE.maxComponentExamples).map(componentKey)
|
|
33865
|
+
};
|
|
33866
|
+
}
|
|
33867
|
+
var componentsPresent = (sbom, clause) => documentCheck("componentsPresent", clause, SEVERITY_ERROR, componentsOf(sbom).length > 0);
|
|
33868
|
+
var hasName = (component) => hasText(component.name);
|
|
33869
|
+
var hasVersion = (component) => hasText(component.version);
|
|
33870
|
+
var hasSupplier = (component) => hasText(component.supplier);
|
|
33871
|
+
var hasProducer = (component) => hasSupplier(component) || hasText(component.producer);
|
|
33872
|
+
var hasLicenseStatement = (component) => (component.licenses || []).some((value) => typeof value === "string" && value.trim() !== "") || typeof component.licenseDeclared === "string" && component.licenseDeclared.trim() !== "";
|
|
33873
|
+
function hasIdentifier(component) {
|
|
33874
|
+
return [component.purl, component.cpe, ...component.otherIdentifiers || []].some(hasText);
|
|
33875
|
+
}
|
|
33876
|
+
function hasWellFormedIdentifier(component) {
|
|
33877
|
+
return (!hasText(component.purl) || isValidPurl(component.purl)) && (!hasText(component.cpe) || isValidCpe(component.cpe));
|
|
33878
|
+
}
|
|
33879
|
+
function hasValidIdentifier(component) {
|
|
33880
|
+
const purl = hasText(component.purl) ? component.purl : null;
|
|
33881
|
+
const cpe = hasText(component.cpe) ? component.cpe : null;
|
|
33882
|
+
if (!purl && !cpe) return false;
|
|
33883
|
+
return (!purl || isValidPurl(purl)) && (!cpe || isValidCpe(cpe));
|
|
33884
|
+
}
|
|
33885
|
+
var hasHash = (component) => (component.hashes || []).some((hash) => hasText(hash?.value));
|
|
33886
|
+
function hasHashAlgorithm(component, algorithm) {
|
|
33887
|
+
return (component.hashes || []).some((hash) => String(hash?.algorithm || "").toUpperCase().replaceAll("-", "") === algorithm && hasText(hash?.value));
|
|
33888
|
+
}
|
|
33889
|
+
var hasLicense = (component) => (component.licenses || []).some(hasText);
|
|
33890
|
+
function hasSpdxLicense(component) {
|
|
33891
|
+
const licenses = Array.isArray(component.spdxLicenses) ? component.spdxLicenses : component.licenses;
|
|
33892
|
+
return Array.isArray(licenses) && licenses.length > 0 && licenses.every(isValidLicenseExpression);
|
|
33893
|
+
}
|
|
33894
|
+
var hasCreatorContact = (component) => (component.creatorContacts || []).some(isContact);
|
|
33895
|
+
function dependencyGraphPredicate(sbom) {
|
|
33896
|
+
const known = /* @__PURE__ */ new Set();
|
|
33897
|
+
for (const entry of sbom?.dependencies || []) {
|
|
33898
|
+
if (entry?.ref) known.add(entry.ref);
|
|
33899
|
+
for (const target of entry?.dependsOn || []) known.add(target);
|
|
33900
|
+
}
|
|
33901
|
+
return (component) => known.has(component.id) || known.has(component.purl);
|
|
33902
|
+
}
|
|
33903
|
+
function ntiaBaselineChecks(sbom, clause) {
|
|
33904
|
+
const document2 = documentOf(sbom);
|
|
33905
|
+
return [
|
|
33906
|
+
componentCheck(sbom, "supplier", clause, SEVERITY_ERROR, hasSupplier),
|
|
33907
|
+
componentCheck(sbom, "name", clause, SEVERITY_ERROR, hasName),
|
|
33908
|
+
componentCheck(sbom, "version", clause, SEVERITY_ERROR, hasVersion),
|
|
33909
|
+
componentCheck(sbom, "identifier", clause, SEVERITY_ERROR, hasIdentifier),
|
|
33910
|
+
componentCheck(sbom, "identifierSyntax", clause, SEVERITY_WARNING, hasWellFormedIdentifier),
|
|
33911
|
+
componentCheck(sbom, "dependencies", clause, SEVERITY_ERROR, dependencyGraphPredicate(sbom)),
|
|
33912
|
+
documentCheck("sbomAuthor", clause, SEVERITY_ERROR, (document2.creators || []).some(hasText)),
|
|
33913
|
+
documentCheck("timestamp", clause, SEVERITY_ERROR, hasText(document2.timestamp)),
|
|
33914
|
+
documentCheck("timestampFormat", clause, SEVERITY_WARNING, isStrictTimestamp(document2.timestamp))
|
|
33915
|
+
];
|
|
33916
|
+
}
|
|
33917
|
+
module2.exports = {
|
|
33918
|
+
hasProducer,
|
|
33919
|
+
hasIdentifier,
|
|
33920
|
+
hasWellFormedIdentifier,
|
|
33921
|
+
hasLicenseStatement,
|
|
33922
|
+
ntiaBaselineChecks,
|
|
33923
|
+
SEVERITY_ERROR,
|
|
33924
|
+
SEVERITY_WARNING,
|
|
33925
|
+
hasText,
|
|
33926
|
+
componentsOf,
|
|
33927
|
+
documentOf,
|
|
33928
|
+
documentCheck,
|
|
33929
|
+
componentCheck,
|
|
33930
|
+
componentsPresent,
|
|
33931
|
+
hasName,
|
|
33932
|
+
hasVersion,
|
|
33933
|
+
hasSupplier,
|
|
33934
|
+
hasValidIdentifier,
|
|
33935
|
+
hasHash,
|
|
33936
|
+
hasHashAlgorithm,
|
|
33937
|
+
hasLicense,
|
|
33938
|
+
hasSpdxLicense,
|
|
33939
|
+
hasCreatorContact,
|
|
33940
|
+
dependencyGraphPredicate
|
|
33941
|
+
};
|
|
33942
|
+
}
|
|
33943
|
+
});
|
|
33944
|
+
|
|
33945
|
+
// lib/compliance/validators/cisa.js
|
|
33946
|
+
var require_cisa = __commonJS({
|
|
33947
|
+
"lib/compliance/validators/cisa.js"(exports2, module2) {
|
|
33948
|
+
"use strict";
|
|
33949
|
+
var { isRfc9557Timestamp } = require_syntax();
|
|
33950
|
+
var { SEVERITY_ERROR, SEVERITY_WARNING, hasText, documentOf, documentCheck, componentCheck, componentsPresent, hasName, hasVersion, hasProducer, hasIdentifier, hasWellFormedIdentifier, hasHash, hasLicenseStatement, dependencyGraphPredicate } = require_checks();
|
|
33951
|
+
var METADATA = "CISA 2026 SBOM Minimum Elements (July 29, 2026) - SBOM Metadata";
|
|
33952
|
+
var COMPONENT = "CISA 2026 SBOM Minimum Elements (July 29, 2026) - Component Data";
|
|
33953
|
+
function validate(sbom) {
|
|
33954
|
+
const document2 = documentOf(sbom);
|
|
33955
|
+
return {
|
|
33956
|
+
standardId: "cisa",
|
|
33957
|
+
checks: [
|
|
33958
|
+
componentsPresent(sbom, COMPONENT),
|
|
33959
|
+
documentCheck("sbomAuthor", METADATA, SEVERITY_ERROR, (document2.creators || []).some(hasText)),
|
|
33960
|
+
documentCheck("authorSignature", METADATA, SEVERITY_WARNING, document2.hasSignature),
|
|
33961
|
+
documentCheck("dataFormat", METADATA, SEVERITY_ERROR, hasText(document2.format) && hasText(document2.specVersion)),
|
|
33962
|
+
documentCheck("generationContext", METADATA, SEVERITY_WARNING, document2.hasGenerationContext),
|
|
33963
|
+
documentCheck("timestamp", METADATA, SEVERITY_ERROR, hasText(document2.timestamp)),
|
|
33964
|
+
documentCheck("timestampFormat", METADATA, SEVERITY_WARNING, isRfc9557Timestamp(document2.timestamp)),
|
|
33965
|
+
documentCheck("toolName", METADATA, SEVERITY_ERROR, document2.hasTool),
|
|
33966
|
+
documentCheck("toolVersion", METADATA, SEVERITY_WARNING, document2.hasToolVersion),
|
|
33967
|
+
documentCheck("sbomVersion", METADATA, SEVERITY_WARNING, document2.hasSbomVersion),
|
|
33968
|
+
componentCheck(sbom, "producer", COMPONENT, SEVERITY_ERROR, hasProducer),
|
|
33969
|
+
componentCheck(sbom, "dependencies", COMPONENT, SEVERITY_ERROR, dependencyGraphPredicate(sbom)),
|
|
33970
|
+
componentCheck(sbom, "hash", COMPONENT, SEVERITY_WARNING, hasHash),
|
|
33971
|
+
componentCheck(sbom, "identifier", COMPONENT, SEVERITY_ERROR, hasIdentifier),
|
|
33972
|
+
componentCheck(sbom, "identifierSyntax", COMPONENT, SEVERITY_WARNING, hasWellFormedIdentifier),
|
|
33973
|
+
componentCheck(sbom, "license", COMPONENT, SEVERITY_ERROR, hasLicenseStatement),
|
|
33974
|
+
componentCheck(sbom, "name", COMPONENT, SEVERITY_ERROR, hasName),
|
|
33975
|
+
componentCheck(sbom, "version", COMPONENT, SEVERITY_ERROR, hasVersion)
|
|
33976
|
+
]
|
|
33977
|
+
};
|
|
33978
|
+
}
|
|
33979
|
+
module2.exports = { validate };
|
|
33980
|
+
}
|
|
33981
|
+
});
|
|
33982
|
+
|
|
33983
|
+
// lib/compliance/validators/cra.js
|
|
33984
|
+
var require_cra = __commonJS({
|
|
33985
|
+
"lib/compliance/validators/cra.js"(exports2, module2) {
|
|
33986
|
+
"use strict";
|
|
33987
|
+
var { isContact } = require_syntax();
|
|
33988
|
+
var { SEVERITY_ERROR, SEVERITY_WARNING, componentsOf, documentOf, documentCheck, componentCheck, componentsPresent, hasName, hasVersion } = require_checks();
|
|
33989
|
+
var SBOM_CLAUSE = "Regulation (EU) 2024/2847 Annex I Part II point (1)";
|
|
33990
|
+
var REPORTING_CLAUSE = "Regulation (EU) 2024/2847 Annex I Part II point (6)";
|
|
33991
|
+
var CONTACT_CLAUSE = "Regulation (EU) 2024/2847 Annex II point 1, Article 13(16)";
|
|
33992
|
+
var MACHINE_READABLE_ENCODINGS = /* @__PURE__ */ new Set(["json", "xml"]);
|
|
33993
|
+
function hasTopLevelDependencies(sbom) {
|
|
33994
|
+
return componentsOf(sbom).some((component) => component.isDirect);
|
|
33995
|
+
}
|
|
33996
|
+
function validate(sbom, profile) {
|
|
33997
|
+
const document2 = documentOf(sbom);
|
|
33998
|
+
return {
|
|
33999
|
+
standardId: "cra",
|
|
34000
|
+
checks: [
|
|
34001
|
+
componentsPresent(sbom, SBOM_CLAUSE),
|
|
34002
|
+
documentCheck("machineReadable", SBOM_CLAUSE, SEVERITY_ERROR, Boolean(document2.format) && MACHINE_READABLE_ENCODINGS.has(document2.encoding)),
|
|
34003
|
+
documentCheck("topLevelDependencies", SBOM_CLAUSE, SEVERITY_ERROR, hasTopLevelDependencies(sbom)),
|
|
34004
|
+
componentCheck(sbom, "name", SBOM_CLAUSE, SEVERITY_ERROR, hasName),
|
|
34005
|
+
componentCheck(sbom, "version", SBOM_CLAUSE, SEVERITY_ERROR, hasVersion),
|
|
34006
|
+
documentCheck("vulnerabilityContact", REPORTING_CLAUSE, SEVERITY_WARNING, isContact(profile?.vulnerabilityContact) || (document2.securityContacts || []).some(isContact)),
|
|
34007
|
+
documentCheck("productContact", CONTACT_CLAUSE, SEVERITY_WARNING, isContact(profile?.productContact) || (document2.manufacturerContacts || []).some(isContact))
|
|
34008
|
+
]
|
|
34009
|
+
};
|
|
34010
|
+
}
|
|
34011
|
+
module2.exports = { validate };
|
|
34012
|
+
}
|
|
34013
|
+
});
|
|
34014
|
+
|
|
34015
|
+
// lib/compliance/validators/bsi.js
|
|
34016
|
+
var require_bsi = __commonJS({
|
|
34017
|
+
"lib/compliance/validators/bsi.js"(exports2, module2) {
|
|
34018
|
+
"use strict";
|
|
34019
|
+
var { COMPLIANCE } = require_constants();
|
|
34020
|
+
var { isStrictTimestamp, isContact, versionAtLeast } = require_syntax();
|
|
34021
|
+
var { SEVERITY_ERROR, documentOf, documentCheck, componentCheck, componentsPresent, hasName, hasVersion, hasHashAlgorithm, hasSpdxLicense, hasCreatorContact, dependencyGraphPredicate, hasText } = require_checks();
|
|
34022
|
+
var TR = "BSI TR-03183-2 v2.1.0";
|
|
34023
|
+
var FORMAT_CLAUSE = `${TR} section 4`;
|
|
34024
|
+
var SBOM_CLAUSE = `${TR} section 5.2.1`;
|
|
34025
|
+
var COMPONENT_CLAUSE = `${TR} section 5.2.2`;
|
|
34026
|
+
var LICENSE_CLAUSE = `${TR} section 6.1`;
|
|
34027
|
+
var SHA512 = "SHA512";
|
|
34028
|
+
var PROPERTY_VALUES = Object.freeze({
|
|
34029
|
+
"bsi:component:executable": ["executable", "non-executable"],
|
|
34030
|
+
"bsi:component:archive": ["archive", "no archive"],
|
|
34031
|
+
"bsi:component:structured": ["structured", "unstructured"]
|
|
34032
|
+
});
|
|
34033
|
+
var ENCODINGS = /* @__PURE__ */ new Set(["json", "xml"]);
|
|
34034
|
+
function formatSupported(document2) {
|
|
34035
|
+
const minimum = COMPLIANCE.bsiMinimumVersions[document2.format];
|
|
34036
|
+
return Boolean(minimum) && ENCODINGS.has(document2.encoding) && versionAtLeast(document2.specVersion, minimum);
|
|
34037
|
+
}
|
|
34038
|
+
var propertyCheck = (sbom, id, name) => componentCheck(
|
|
34039
|
+
sbom,
|
|
34040
|
+
id,
|
|
34041
|
+
COMPONENT_CLAUSE,
|
|
34042
|
+
SEVERITY_ERROR,
|
|
34043
|
+
(component) => PROPERTY_VALUES[name].includes(component.properties?.[name])
|
|
34044
|
+
);
|
|
34045
|
+
function validate(sbom) {
|
|
34046
|
+
const document2 = documentOf(sbom);
|
|
34047
|
+
return {
|
|
34048
|
+
standardId: "bsi",
|
|
34049
|
+
checks: [
|
|
34050
|
+
componentsPresent(sbom, COMPONENT_CLAUSE),
|
|
34051
|
+
documentCheck("formatVersion", FORMAT_CLAUSE, SEVERITY_ERROR, formatSupported(document2)),
|
|
34052
|
+
documentCheck("creatorContact", SBOM_CLAUSE, SEVERITY_ERROR, (document2.creators || []).some(isContact)),
|
|
34053
|
+
documentCheck("timestamp", SBOM_CLAUSE, SEVERITY_ERROR, isStrictTimestamp(document2.timestamp)),
|
|
34054
|
+
componentCheck(sbom, "componentCreator", COMPONENT_CLAUSE, SEVERITY_ERROR, hasCreatorContact),
|
|
34055
|
+
componentCheck(sbom, "name", COMPONENT_CLAUSE, SEVERITY_ERROR, hasName),
|
|
34056
|
+
componentCheck(sbom, "version", COMPONENT_CLAUSE, SEVERITY_ERROR, hasVersion),
|
|
34057
|
+
componentCheck(sbom, "filename", COMPONENT_CLAUSE, SEVERITY_ERROR, (component) => hasText(component.properties?.["bsi:component:filename"])),
|
|
34058
|
+
componentCheck(sbom, "dependencies", COMPONENT_CLAUSE, SEVERITY_ERROR, dependencyGraphPredicate(sbom)),
|
|
34059
|
+
documentCheck("dependencyCompleteness", COMPONENT_CLAUSE, SEVERITY_ERROR, document2.dependencyCompleteness),
|
|
34060
|
+
componentCheck(sbom, "licenseExpression", LICENSE_CLAUSE, SEVERITY_ERROR, hasSpdxLicense),
|
|
34061
|
+
componentCheck(sbom, "sha512", COMPONENT_CLAUSE, SEVERITY_ERROR, (component) => hasHashAlgorithm(component, SHA512)),
|
|
34062
|
+
propertyCheck(sbom, "executableProperty", "bsi:component:executable"),
|
|
34063
|
+
propertyCheck(sbom, "archiveProperty", "bsi:component:archive"),
|
|
34064
|
+
propertyCheck(sbom, "structuredProperty", "bsi:component:structured")
|
|
34065
|
+
]
|
|
34066
|
+
};
|
|
34067
|
+
}
|
|
34068
|
+
module2.exports = { validate };
|
|
34069
|
+
}
|
|
34070
|
+
});
|
|
34071
|
+
|
|
34072
|
+
// lib/compliance/validators/fda.js
|
|
34073
|
+
var require_fda = __commonJS({
|
|
34074
|
+
"lib/compliance/validators/fda.js"(exports2, module2) {
|
|
34075
|
+
"use strict";
|
|
34076
|
+
var { COMPLIANCE } = require_constants();
|
|
34077
|
+
var { isDateValue } = require_syntax();
|
|
34078
|
+
var { SEVERITY_WARNING, hasText, documentOf, documentCheck, componentCheck, componentsPresent, ntiaBaselineChecks } = require_checks();
|
|
34079
|
+
var STATUTE = "FD&C Act section 524B(b)(3)";
|
|
34080
|
+
var GUIDANCE = "FDA Cybersecurity in Medical Devices guidance (February 3, 2026) section V.A.4.b";
|
|
34081
|
+
var MACHINE_READABLE_ENCODINGS = /* @__PURE__ */ new Set(["json", "xml"]);
|
|
34082
|
+
function validate(sbom, profile) {
|
|
34083
|
+
const document2 = documentOf(sbom);
|
|
34084
|
+
const levelName = profile?.supportProperties?.level || COMPLIANCE.supportLevelProperty;
|
|
34085
|
+
const endName = profile?.supportProperties?.endOfSupport || COMPLIANCE.endOfSupportProperty;
|
|
34086
|
+
return {
|
|
34087
|
+
standardId: "fda",
|
|
34088
|
+
checks: [
|
|
34089
|
+
componentsPresent(sbom, STATUTE),
|
|
34090
|
+
...ntiaBaselineChecks(sbom, GUIDANCE),
|
|
34091
|
+
documentCheck("machineReadable", GUIDANCE, SEVERITY_WARNING, Boolean(document2.format) && MACHINE_READABLE_ENCODINGS.has(document2.encoding)),
|
|
34092
|
+
componentCheck(sbom, "supportLevel", GUIDANCE, SEVERITY_WARNING, (component) => hasText(component.properties?.[levelName])),
|
|
34093
|
+
componentCheck(sbom, "endOfSupport", GUIDANCE, SEVERITY_WARNING, (component) => isDateValue(component.properties?.[endName]))
|
|
34094
|
+
]
|
|
34095
|
+
};
|
|
34096
|
+
}
|
|
34097
|
+
module2.exports = { validate };
|
|
34098
|
+
}
|
|
34099
|
+
});
|
|
34100
|
+
|
|
34101
|
+
// lib/compliance/engine.js
|
|
34102
|
+
var require_engine = __commonJS({
|
|
34103
|
+
"lib/compliance/engine.js"(exports2, module2) {
|
|
34104
|
+
"use strict";
|
|
34105
|
+
var { COMPLIANCE } = require_constants();
|
|
34106
|
+
var english = require_compliance_en();
|
|
34107
|
+
var japanese = require_compliance_ja();
|
|
34108
|
+
var { SEVERITY_ERROR, documentOf, documentCheck, componentCheck, hasName, hasVersion, hasSupplier, hasValidIdentifier, hasLicense, hasHashAlgorithm } = require_checks();
|
|
34109
|
+
var cisa = require_cisa();
|
|
34110
|
+
var cra = require_cra();
|
|
34111
|
+
var bsi = require_bsi();
|
|
34112
|
+
var fda = require_fda();
|
|
34113
|
+
var VALIDATORS = Object.freeze({ cisa, cra, bsi, fda });
|
|
34114
|
+
var PROFILE_STANDARD_ID = "profile";
|
|
34115
|
+
var PROFILE_CLAUSE = COMPLIANCE.profileFileName;
|
|
34116
|
+
var FIELD_PREDICATES = Object.freeze({ name: hasName, version: hasVersion, supplier: hasSupplier, identifier: hasValidIdentifier, license: hasLicense });
|
|
34117
|
+
function validateProfileRequirements(sbom, profile) {
|
|
34118
|
+
const checks = [];
|
|
34119
|
+
for (const field of profile.requireFields) {
|
|
34120
|
+
const predicate = FIELD_PREDICATES[field];
|
|
34121
|
+
checks.push(predicate ? { ...componentCheck(sbom, `requireField.${field}`, PROFILE_CLAUSE, SEVERITY_ERROR, predicate), messageKey: "requireField", detail: field } : { ...documentCheck(`requireField.${field}`, PROFILE_CLAUSE, SEVERITY_ERROR, false), messageKey: "unsupportedField", detail: field });
|
|
34122
|
+
}
|
|
34123
|
+
for (const algorithm of profile.requireHashAlgorithms) {
|
|
34124
|
+
checks.push({ ...componentCheck(sbom, `requireHash.${algorithm}`, PROFILE_CLAUSE, SEVERITY_ERROR, (component) => hasHashAlgorithm(component, algorithm)), messageKey: "requireHash", detail: algorithm });
|
|
34125
|
+
}
|
|
34126
|
+
return { standardId: PROFILE_STANDARD_ID, checks };
|
|
34127
|
+
}
|
|
34128
|
+
function renderMessage(labels, standardId, check) {
|
|
34129
|
+
const key = check.messageKey || check.id;
|
|
34130
|
+
const template = labels[`${standardId}.${key}`] || labels[key] || key;
|
|
34131
|
+
const examples = check.componentKeys.length ? ` (${check.componentKeys.join(", ")})` : "";
|
|
34132
|
+
return template.replaceAll("{failed}", String(check.failed)).replaceAll("{total}", String(check.total)).replaceAll("{detail}", String(check.detail || "")) + (check.passed ? "" : examples);
|
|
34133
|
+
}
|
|
34134
|
+
function evaluateCompliance(sbom, { standards = [], profile = null, language } = {}) {
|
|
34135
|
+
if (!sbom) return { status: "ERROR", passed: false, errorKey: "noSbom", standards: [] };
|
|
34136
|
+
const labels = language === "ja" ? japanese : english;
|
|
34137
|
+
const results = [...new Set(standards)].map((id) => VALIDATORS[id].validate(sbom, profile));
|
|
34138
|
+
if (profile && (profile.requireFields.length || profile.requireHashAlgorithms.length)) results.push(validateProfileRequirements(sbom, profile));
|
|
34139
|
+
const rendered = results.map((result) => ({
|
|
34140
|
+
...result,
|
|
34141
|
+
passed: result.checks.every((check) => check.passed || check.severity !== SEVERITY_ERROR),
|
|
34142
|
+
checks: result.checks.map((check) => ({ ...check, message: renderMessage(labels, result.standardId, check) }))
|
|
34143
|
+
}));
|
|
34144
|
+
const passed = rendered.every((result) => result.passed);
|
|
34145
|
+
return { status: passed ? "PASS" : "FAIL", passed, sourceFormat: documentOf(sbom).format, standards: rendered };
|
|
34146
|
+
}
|
|
34147
|
+
function evaluateProfileCompliance(sbom, profile, language) {
|
|
34148
|
+
if (!profile) return null;
|
|
34149
|
+
if (profile.unknownStandards.length) return { status: "ERROR", passed: false, errorKey: "unknownStandard", standards: [] };
|
|
34150
|
+
if (!profile.standards.length && !profile.requireFields.length && !profile.requireHashAlgorithms.length) return null;
|
|
34151
|
+
return evaluateCompliance(sbom, { standards: profile.standards, profile, language });
|
|
34152
|
+
}
|
|
34153
|
+
module2.exports = { evaluateCompliance, evaluateProfileCompliance, PROFILE_STANDARD_ID };
|
|
34154
|
+
}
|
|
34155
|
+
});
|
|
34156
|
+
|
|
33507
34157
|
// lib/report/artifacts.js
|
|
33508
34158
|
var require_artifacts = __commonJS({
|
|
33509
34159
|
"lib/report/artifacts.js"(exports2, module2) {
|
|
@@ -33522,6 +34172,8 @@ var require_artifacts = __commonJS({
|
|
|
33522
34172
|
var { generateOpenVex, generateCycloneDxVex } = require_vexEngine();
|
|
33523
34173
|
var { loadVexStatements } = require_vexLoader();
|
|
33524
34174
|
var { buildSarifLog } = require_sarifExporter();
|
|
34175
|
+
var { loadProfileConfig } = require_profileLoader();
|
|
34176
|
+
var { evaluateProfileCompliance } = require_engine();
|
|
33525
34177
|
var manifest = require_package();
|
|
33526
34178
|
function buildAnalysisArtifacts2({ sbom, scan, format, errors, language }, workspacePath, suffix, previousSbom = null) {
|
|
33527
34179
|
const paths = {};
|
|
@@ -33541,6 +34193,11 @@ var require_artifacts = __commonJS({
|
|
|
33541
34193
|
} catch {
|
|
33542
34194
|
}
|
|
33543
34195
|
}
|
|
34196
|
+
const compliance = evaluateProfileCompliance(sbom?.normalized, loadProfileConfig(workspacePath), language);
|
|
34197
|
+
if (compliance) {
|
|
34198
|
+
writeJsonFile(`${file("compliance-report")}.json`, compliance);
|
|
34199
|
+
paths.complianceJson = `${file("compliance-report")}.json`;
|
|
34200
|
+
}
|
|
33544
34201
|
const policyConfig = loadPolicyConfig(workspacePath);
|
|
33545
34202
|
let policyResult = null;
|
|
33546
34203
|
if (policyConfig && (sbom?.normalized || scan?.vulnerabilities)) {
|
|
@@ -33550,7 +34207,8 @@ var require_artifacts = __commonJS({
|
|
|
33550
34207
|
policyResult = evaluatePolicy(policyConfig, {
|
|
33551
34208
|
components: audited,
|
|
33552
34209
|
vulnerabilities: scan?.vulnerabilities || [],
|
|
33553
|
-
craResult: cra
|
|
34210
|
+
craResult: cra,
|
|
34211
|
+
compliance
|
|
33554
34212
|
});
|
|
33555
34213
|
writeJsonFile(`${file("policy-report")}.json`, policyResult);
|
|
33556
34214
|
paths.policyJson = `${file("policy-report")}.json`;
|
|
@@ -33561,6 +34219,7 @@ var require_artifacts = __commonJS({
|
|
|
33561
34219
|
writeJsonFile(`${file("security-scan")}.sarif`, buildSarifLog({
|
|
33562
34220
|
vulnerabilities: scan.vulnerabilities || [],
|
|
33563
34221
|
policyResult,
|
|
34222
|
+
compliance,
|
|
33564
34223
|
workspacePath,
|
|
33565
34224
|
toolVersion: manifest.version,
|
|
33566
34225
|
scan: { status: scan.status, scanner: scan.source }
|
|
@@ -33586,7 +34245,7 @@ var require_artifacts = __commonJS({
|
|
|
33586
34245
|
paths.sbomExport = `${file(format === "spdx" ? "sbom-spdx" : "sbom-cyclonedx")}${sbom.exportFileExtension}`;
|
|
33587
34246
|
writeTextFile(paths.sbomExport, sbom.exportText);
|
|
33588
34247
|
paths.sbomHtml = `${file("sbom-report")}.html`;
|
|
33589
|
-
writeTextFile(paths.sbomHtml, buildSbomHtmlReport(sbom, workspacePath, { policyResult }));
|
|
34248
|
+
writeTextFile(paths.sbomHtml, buildSbomHtmlReport(sbom, workspacePath, { policyResult, compliance, language }));
|
|
33590
34249
|
paths.sbomExplorerHtml = `${file("sbom-explorer")}.html`;
|
|
33591
34250
|
paths.sbomLensHtml = paths.sbomExplorerHtml;
|
|
33592
34251
|
writeTextFile(paths.sbomExplorerHtml, buildSbomExplorerHtml2(sbom, scan, workspacePath, { language, diff, policyResult }));
|
|
@@ -33601,7 +34260,7 @@ var require_artifacts = __commonJS({
|
|
|
33601
34260
|
paths.statusHtml = `${file("analysis-status")}.html`;
|
|
33602
34261
|
writeTextFile(paths.statusHtml, `<!DOCTYPE html><html><head><meta charset="utf-8"><title>${escapeHtml(labels.status)}</title></head><body><h1>${escapeHtml(labels.projectAnalysisIncomplete)}</h1><p>${escapeHtml(workspacePath)}</p><ul>${errors.map((error) => `<li>${escapeHtml(error.phase)}: ${escapeHtml(error.code)}</li>`).join("")}</ul></body></html>`);
|
|
33603
34262
|
}
|
|
33604
|
-
writeJsonFile(`${file("analysis")}.json`, { schemaVersion: SNAPSHOT.version, workspacePath, sbom: sbom?.normalized, scan, errors, policy: policyResult, vex: vexStatements });
|
|
34263
|
+
writeJsonFile(`${file("analysis")}.json`, { schemaVersion: SNAPSHOT.version, workspacePath, sbom: sbom?.normalized, scan, errors, policy: policyResult, compliance, vex: vexStatements });
|
|
33605
34264
|
return { files, paths };
|
|
33606
34265
|
}
|
|
33607
34266
|
module2.exports = { buildAnalysisArtifacts: buildAnalysisArtifacts2 };
|
|
@@ -33617,6 +34276,20 @@ var require_docxContent = __commonJS({
|
|
|
33617
34276
|
var { paragraph, heading, table, severityCell, licenseRiskCell } = require_docxLayout();
|
|
33618
34277
|
var { auditComponentLicenses } = require_licenseClassifier();
|
|
33619
34278
|
var { auditSbomCraReadiness } = require_craAuditor();
|
|
34279
|
+
var { complianceView } = require_complianceSection();
|
|
34280
|
+
function standardsConformance(compliance, labels) {
|
|
34281
|
+
const view = complianceView(compliance, labels);
|
|
34282
|
+
if (!view) return [];
|
|
34283
|
+
const children = [new Paragraph({ text: labels.standardsConformance, heading: HeadingLevel.HEADING_2 }), paragraph(labels.standardsConformanceNotice)];
|
|
34284
|
+
if (view.error) return [...children, paragraph(view.error, { color: SEVERITY_STYLES.high.color, bold: true })];
|
|
34285
|
+
children.push(table([labels.standardName, labels.complianceStatus], view.standards.map((row) => [row.name, row.status]), REPORT.summaryWidths));
|
|
34286
|
+
if (!view.failures.length) return [...children, paragraph(labels.allChecksPassed)];
|
|
34287
|
+
return [
|
|
34288
|
+
...children,
|
|
34289
|
+
new Paragraph({ text: labels.failedChecks, heading: HeadingLevel.HEADING_3 }),
|
|
34290
|
+
table([labels.standardName, labels.standardClause, labels.checkSeverity, labels.policyMessage], view.failures.map((row) => [row.standard, row.clause, row.severity, row.message]), REPORT_LAYOUT.suppressedWidths)
|
|
34291
|
+
];
|
|
34292
|
+
}
|
|
33620
34293
|
function findingOrder(item) {
|
|
33621
34294
|
const key = item.severity === "medium" ? "moderate" : item.severity;
|
|
33622
34295
|
return (SEVERITY_STYLES[key] || SEVERITY_STYLES.unknown).rank;
|
|
@@ -33764,6 +34437,7 @@ ${item.cveId || item.title || ""}`,
|
|
|
33764
34437
|
if (summary.hasCopyleft) {
|
|
33765
34438
|
children.push(paragraph(labels.copyleftWarning, { color: LICENSE_RISK_STYLES.copyleft.color, bold: true }));
|
|
33766
34439
|
}
|
|
34440
|
+
children.push(...standardsConformance(sbom.compliance, labels));
|
|
33767
34441
|
const sbomPolicy = sbom.policy || sbom.policyResult;
|
|
33768
34442
|
if (sbomPolicy && Array.isArray(sbomPolicy.violations) && sbomPolicy.violations.length > 0) {
|
|
33769
34443
|
children.push(
|
|
@@ -33827,7 +34501,7 @@ var require_docx = __commonJS({
|
|
|
33827
34501
|
...scanSummary(scan, workspacePath, labels, section("scan")?.title || "", "scan", false),
|
|
33828
34502
|
...findings(scan, labels, section("findings")?.title || "", "findings")
|
|
33829
34503
|
);
|
|
33830
|
-
if (sbom) children.push(...inventory(sbom, labels, false, section("inventory")?.title || "", "inventory"));
|
|
34504
|
+
if (sbom) children.push(...inventory({ ...sbom, policy: snapshot.policy, compliance: snapshot.compliance }, labels, false, section("inventory")?.title || "", "inventory"));
|
|
33831
34505
|
return packDocxDocument(children, labels.dependencySecurityReport);
|
|
33832
34506
|
}
|
|
33833
34507
|
module2.exports = { buildDocxReport: buildDocxReport2 };
|
package/l10n/report.en.json
CHANGED
|
@@ -195,5 +195,21 @@
|
|
|
195
195
|
"notScanned": "Vulnerability scan not run",
|
|
196
196
|
"scanFailed": "Vulnerability scan failed",
|
|
197
197
|
"scanClear": "known vulnerabilities"
|
|
198
|
-
}
|
|
198
|
+
},
|
|
199
|
+
"standardsConformance": "Standards Conformance (.sbom-profile.json)",
|
|
200
|
+
"standardsConformanceNotice": "Checks for the standards selected in .sbom-profile.json. A standard fails only on failed mandatory checks; advisory checks are listed as warnings.",
|
|
201
|
+
"standardsEvaluationError": "The standards evaluation could not run, so conformance is not established.",
|
|
202
|
+
"complianceError_unknownStandard": ".sbom-profile.json names a standard that is not supported.",
|
|
203
|
+
"complianceError_noSbom": "No SBOM was generated, so conformance could not be evaluated.",
|
|
204
|
+
"standardClause": "Clause",
|
|
205
|
+
"checkSeverity": "Severity",
|
|
206
|
+
"checkMandatory": "Mandatory",
|
|
207
|
+
"checkAdvisory": "Advisory",
|
|
208
|
+
"failedChecks": "Failed checks",
|
|
209
|
+
"allChecksPassed": "All checks passed.",
|
|
210
|
+
"standard_cisa": "CISA SBOM Minimum Elements (2026)",
|
|
211
|
+
"standard_cra": "EU Cyber Resilience Act",
|
|
212
|
+
"standard_bsi": "BSI TR-03183-2",
|
|
213
|
+
"standard_fda": "FDA Section 524B",
|
|
214
|
+
"standard_profile": "Profile requirements"
|
|
199
215
|
}
|
package/l10n/report.ja.json
CHANGED
|
@@ -195,5 +195,21 @@
|
|
|
195
195
|
"notScanned": "脆弱性は未検査",
|
|
196
196
|
"scanFailed": "脆弱性検査に失敗",
|
|
197
197
|
"scanClear": "既知の脆弱性なし"
|
|
198
|
-
}
|
|
198
|
+
},
|
|
199
|
+
"standardsConformance": "規格適合チェック(.sbom-profile.json)",
|
|
200
|
+
"standardsConformanceNotice": ".sbom-profile.json で選択した規格のチェック結果です。必須チェックの不合格だけが規格の不合格になり、推奨チェックは警告として表示します。",
|
|
201
|
+
"standardsEvaluationError": "規格の評価を実行できなかったため、適合性は確認できていません。",
|
|
202
|
+
"complianceError_unknownStandard": ".sbom-profile.json に未対応の規格が指定されています。",
|
|
203
|
+
"complianceError_noSbom": "SBOM を生成できなかったため、適合性を評価できませんでした。",
|
|
204
|
+
"standardClause": "条項",
|
|
205
|
+
"checkSeverity": "区分",
|
|
206
|
+
"checkMandatory": "必須",
|
|
207
|
+
"checkAdvisory": "推奨",
|
|
208
|
+
"failedChecks": "不合格のチェック",
|
|
209
|
+
"allChecksPassed": "すべてのチェックに合格しました。",
|
|
210
|
+
"standard_cisa": "CISA SBOM 最小要素(2026)",
|
|
211
|
+
"standard_cra": "EU サイバーレジリエンス法",
|
|
212
|
+
"standard_bsi": "BSI TR-03183-2",
|
|
213
|
+
"standard_fda": "FDA 524B 条",
|
|
214
|
+
"standard_profile": "プロファイル要件"
|
|
199
215
|
}
|
package/lib/compliance/engine.js
CHANGED
|
@@ -57,4 +57,19 @@ function evaluateCompliance(sbom, { standards = [], profile = null, language } =
|
|
|
57
57
|
return { status: passed ? 'PASS' : 'FAIL', passed, sourceFormat: documentOf(sbom).format, standards: rendered };
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Evaluate the standards a workspace profile opts into. A profile naming an unknown standard is an
|
|
62
|
+
* ERROR, so a requested but unchecked standard cannot look compliant.
|
|
63
|
+
* @param {object|null|undefined} sbom Normalized SBOM
|
|
64
|
+
* @param {any} profile Result of loadProfileConfig
|
|
65
|
+
* @param {string} [language]
|
|
66
|
+
* @returns {ReturnType<typeof evaluateCompliance>|null} null when there is no profile or nothing to check
|
|
67
|
+
*/
|
|
68
|
+
function evaluateProfileCompliance(sbom, profile, language) {
|
|
69
|
+
if (!profile) return null;
|
|
70
|
+
if (profile.unknownStandards.length) return { status: 'ERROR', passed: false, errorKey: 'unknownStandard', standards: [] };
|
|
71
|
+
if (!profile.standards.length && !profile.requireFields.length && !profile.requireHashAlgorithms.length) return null;
|
|
72
|
+
return evaluateCompliance(sbom, { standards: profile.standards, profile, language });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = { evaluateCompliance, evaluateProfileCompliance, PROFILE_STANDARD_ID };
|
package/lib/config/constants.js
CHANGED
|
@@ -130,6 +130,9 @@ const POLICY = Object.freeze({
|
|
|
130
130
|
typeCompliance: 'compliance',
|
|
131
131
|
severityError: 'error',
|
|
132
132
|
severityWarning: 'warning',
|
|
133
|
+
standardRulePrefix: 'standard:',
|
|
134
|
+
ruleStandardsEvaluation: 'standardsEvaluation',
|
|
135
|
+
standardsTarget: '.sbom-profile.json',
|
|
133
136
|
badgeViolation: '🛡️ POLICY VIOLATION',
|
|
134
137
|
defaultMinCraScore: 75,
|
|
135
138
|
defaultMaxEpss: 0.5,
|
|
@@ -35,6 +35,28 @@ function matchesLicenseList(licenseText, licenseRisk, list) {
|
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Convert failed standard checks into policy violations. Advisory (warning) checks stay warnings;
|
|
40
|
+
* an evaluation that could not run is a violation so an unchecked SBOM cannot pass the policy.
|
|
41
|
+
* @param {any} compliance Result of evaluateCompliance
|
|
42
|
+
* @param {string} violationSeverity Severity for failed mandatory checks
|
|
43
|
+
* @returns {Array<object>}
|
|
44
|
+
*/
|
|
45
|
+
function standardViolations(compliance, violationSeverity) {
|
|
46
|
+
if (!compliance) return [];
|
|
47
|
+
if (compliance.status === 'ERROR') {
|
|
48
|
+
return [{ type: POLICY.typeCompliance, rule: POLICY.ruleStandardsEvaluation, target: POLICY.standardsTarget, severity: violationSeverity, standardId: null, message: `Standards evaluation could not run (${compliance.errorKey})` }];
|
|
49
|
+
}
|
|
50
|
+
return (compliance.standards || []).flatMap(standard => standard.checks.filter(check => !check.passed).map(check => ({
|
|
51
|
+
type: POLICY.typeCompliance,
|
|
52
|
+
rule: `${POLICY.standardRulePrefix}${standard.standardId}/${check.id}`,
|
|
53
|
+
target: `${standard.standardId.toUpperCase()} ${check.clause}`,
|
|
54
|
+
severity: check.severity === POLICY.severityError ? violationSeverity : POLICY.severityWarning,
|
|
55
|
+
standardId: standard.standardId,
|
|
56
|
+
message: check.message,
|
|
57
|
+
})));
|
|
58
|
+
}
|
|
59
|
+
|
|
38
60
|
/**
|
|
39
61
|
* Evaluate project against security and compliance policy
|
|
40
62
|
* @param {Object} policy - Policy configuration object
|
|
@@ -42,6 +64,7 @@ function matchesLicenseList(licenseText, licenseRisk, list) {
|
|
|
42
64
|
* @param {Array<Object>} [data.components] - Enriched components
|
|
43
65
|
* @param {Array<Object>} [data.vulnerabilities] - Findings
|
|
44
66
|
* @param {Object} [data.craResult] - CRA compliance audit result
|
|
67
|
+
* @param {Object} [data.compliance] - Result of evaluateCompliance for the workspace profile
|
|
45
68
|
* @returns {Object} Evaluation report
|
|
46
69
|
*/
|
|
47
70
|
function evaluatePolicy(policy, data = {}) {
|
|
@@ -198,6 +221,8 @@ function evaluatePolicy(policy, data = {}) {
|
|
|
198
221
|
}
|
|
199
222
|
}
|
|
200
223
|
|
|
224
|
+
violations.push(...standardViolations(data.compliance, violationSeverity));
|
|
225
|
+
|
|
201
226
|
const errors = violations.filter(v => v.severity === POLICY.severityError).length;
|
|
202
227
|
const warnings = violations.filter(v => v.severity === POLICY.severityWarning).length;
|
|
203
228
|
const passed = errors === 0;
|
package/lib/report/artifacts.js
CHANGED
|
@@ -12,6 +12,8 @@ const { auditSbomCraReadiness } = require('../sbom/craAuditor');
|
|
|
12
12
|
const { generateOpenVex, generateCycloneDxVex } = require('../vex/vexEngine');
|
|
13
13
|
const { loadVexStatements } = require('../vex/vexLoader');
|
|
14
14
|
const { buildSarifLog } = require('./sarifExporter');
|
|
15
|
+
const { loadProfileConfig } = require('../profile/profileLoader');
|
|
16
|
+
const { evaluateProfileCompliance } = require('../compliance/engine');
|
|
15
17
|
const manifest = require('../../package.json');
|
|
16
18
|
|
|
17
19
|
function buildAnalysisArtifacts({ sbom, scan, format, errors, language }, workspacePath, suffix, previousSbom = null) {
|
|
@@ -33,6 +35,13 @@ function buildAnalysisArtifacts({ sbom, scan, format, errors, language }, worksp
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
// Standards are evaluated only when the workspace opts in with a profile; without an SBOM the result is ERROR.
|
|
39
|
+
const compliance = evaluateProfileCompliance(sbom?.normalized, loadProfileConfig(workspacePath), language);
|
|
40
|
+
if (compliance) {
|
|
41
|
+
writeJsonFile(`${file('compliance-report')}.json`, compliance);
|
|
42
|
+
paths.complianceJson = `${file('compliance-report')}.json`;
|
|
43
|
+
}
|
|
44
|
+
|
|
36
45
|
const policyConfig = loadPolicyConfig(workspacePath);
|
|
37
46
|
let policyResult = null;
|
|
38
47
|
if (policyConfig && (sbom?.normalized || scan?.vulnerabilities)) {
|
|
@@ -43,6 +52,7 @@ function buildAnalysisArtifacts({ sbom, scan, format, errors, language }, worksp
|
|
|
43
52
|
components: audited,
|
|
44
53
|
vulnerabilities: scan?.vulnerabilities || [],
|
|
45
54
|
craResult: cra,
|
|
55
|
+
compliance,
|
|
46
56
|
});
|
|
47
57
|
writeJsonFile(`${file('policy-report')}.json`, policyResult);
|
|
48
58
|
paths.policyJson = `${file('policy-report')}.json`;
|
|
@@ -53,7 +63,7 @@ function buildAnalysisArtifacts({ sbom, scan, format, errors, language }, worksp
|
|
|
53
63
|
|
|
54
64
|
if (scan) {
|
|
55
65
|
writeJsonFile(`${file('security-scan')}.sarif`, buildSarifLog({
|
|
56
|
-
vulnerabilities: scan.vulnerabilities || [], policyResult, workspacePath, toolVersion: manifest.version,
|
|
66
|
+
vulnerabilities: scan.vulnerabilities || [], policyResult, compliance, workspacePath, toolVersion: manifest.version,
|
|
57
67
|
scan: { status: scan.status, scanner: scan.source },
|
|
58
68
|
}));
|
|
59
69
|
paths.sarif = `${file('security-scan')}.sarif`;
|
|
@@ -81,7 +91,7 @@ function buildAnalysisArtifacts({ sbom, scan, format, errors, language }, worksp
|
|
|
81
91
|
paths.sbomExport = `${file(format === 'spdx' ? 'sbom-spdx' : 'sbom-cyclonedx')}${sbom.exportFileExtension}`;
|
|
82
92
|
writeTextFile(paths.sbomExport, sbom.exportText);
|
|
83
93
|
paths.sbomHtml = `${file('sbom-report')}.html`;
|
|
84
|
-
writeTextFile(paths.sbomHtml, buildSbomHtmlReport(sbom, workspacePath, { policyResult }));
|
|
94
|
+
writeTextFile(paths.sbomHtml, buildSbomHtmlReport(sbom, workspacePath, { policyResult, compliance, language }));
|
|
85
95
|
paths.sbomExplorerHtml = `${file('sbom-explorer')}.html`;
|
|
86
96
|
paths.sbomLensHtml = paths.sbomExplorerHtml;
|
|
87
97
|
writeTextFile(paths.sbomExplorerHtml, buildSbomExplorerHtml(sbom, scan, workspacePath, { language, diff, policyResult }));
|
|
@@ -98,7 +108,7 @@ function buildAnalysisArtifacts({ sbom, scan, format, errors, language }, worksp
|
|
|
98
108
|
}
|
|
99
109
|
// The snapshot binds both results to the same run, avoiding accidental mixing
|
|
100
110
|
// of an old SBOM with a newer vulnerability scan during later export.
|
|
101
|
-
writeJsonFile(`${file('analysis')}.json`, { schemaVersion: SNAPSHOT.version, workspacePath, sbom: sbom?.normalized, scan, errors, policy: policyResult, vex: vexStatements });
|
|
111
|
+
writeJsonFile(`${file('analysis')}.json`, { schemaVersion: SNAPSHOT.version, workspacePath, sbom: sbom?.normalized, scan, errors, policy: policyResult, compliance, vex: vexStatements });
|
|
102
112
|
return { files, paths };
|
|
103
113
|
}
|
|
104
114
|
module.exports = { buildAnalysisArtifacts };
|
package/lib/report/builder.js
CHANGED
|
@@ -4,6 +4,8 @@ const path = require('node:path');
|
|
|
4
4
|
const { escapeHtml } = require('../common');
|
|
5
5
|
const { auditComponentLicenses } = require('../sbom/licenseClassifier');
|
|
6
6
|
const { auditSbomCraReadiness } = require('../sbom/craAuditor');
|
|
7
|
+
const { getReportLabels } = require('./labels');
|
|
8
|
+
const { renderComplianceHtml } = require('./complianceSection');
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* コンポーネントのスコープを説明する文字列を返す
|
|
@@ -173,6 +175,7 @@ ${SBOM_STYLES}
|
|
|
173
175
|
</div>
|
|
174
176
|
|
|
175
177
|
${policyAlertHtml}
|
|
178
|
+
${renderComplianceHtml(options.compliance || null, getReportLabels(options.language))}
|
|
176
179
|
${renderCraReadinessSection(craResult)}
|
|
177
180
|
${renderComponentTable(components)}
|
|
178
181
|
</body>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const { escapeHtml } = require('../common');
|
|
2
|
+
|
|
3
|
+
const SEVERITY_ERROR = 'error';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Format-neutral view of a compliance result for reports.
|
|
7
|
+
* @param {any} compliance Result of evaluateCompliance, or null
|
|
8
|
+
* @param {Record<string, any>} labels Report labels
|
|
9
|
+
* @returns {{ error: string|null, standards: Array<{ name: string, passed: boolean, status: string }>, failures: Array<{ standard: string, clause: string, severity: string, message: string }> }|null}
|
|
10
|
+
*/
|
|
11
|
+
function complianceView(compliance, labels) {
|
|
12
|
+
if (!compliance) return null;
|
|
13
|
+
if (compliance.status === 'ERROR') {
|
|
14
|
+
return { error: `${labels.standardsEvaluationError} ${labels[`complianceError_${compliance.errorKey}`] || compliance.errorKey}`, standards: [], failures: [] };
|
|
15
|
+
}
|
|
16
|
+
const nameOf = id => labels[`standard_${id}`] || id;
|
|
17
|
+
return {
|
|
18
|
+
error: null,
|
|
19
|
+
standards: compliance.standards.map(standard => ({ name: nameOf(standard.standardId), passed: standard.passed, status: standard.passed ? labels.compliant : labels.actionNeeded })),
|
|
20
|
+
failures: compliance.standards.flatMap(standard => standard.checks.filter(check => !check.passed).map(check => ({
|
|
21
|
+
standard: nameOf(standard.standardId),
|
|
22
|
+
clause: check.clause,
|
|
23
|
+
severity: check.severity === SEVERITY_ERROR ? labels.checkMandatory : labels.checkAdvisory,
|
|
24
|
+
message: check.message,
|
|
25
|
+
}))),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {any} compliance Result of evaluateCompliance, or null
|
|
31
|
+
* @param {Record<string, any>} labels Report labels
|
|
32
|
+
* @returns {string} HTML section, empty when no profile was evaluated
|
|
33
|
+
*/
|
|
34
|
+
function renderComplianceHtml(compliance, labels) {
|
|
35
|
+
const view = complianceView(compliance, labels);
|
|
36
|
+
if (!view) return '';
|
|
37
|
+
const heading = `<h2>${escapeHtml(labels.standardsConformance)}</h2><p>${escapeHtml(labels.standardsConformanceNotice)}</p>`;
|
|
38
|
+
if (view.error) return `<section class="standards-conformance">${heading}<p class="standards-error"><strong>${escapeHtml(view.error)}</strong></p></section>`;
|
|
39
|
+
const statusRows = view.standards.map(row => `<tr><td>${escapeHtml(row.name)}</td><td class="${row.passed ? 'standard-pass' : 'standard-fail'}">${escapeHtml(row.status)}</td></tr>`).join('');
|
|
40
|
+
const failures = view.failures.length ? `<h3>${escapeHtml(labels.failedChecks)}</h3>
|
|
41
|
+
<table><thead><tr><th>${escapeHtml(labels.standardName)}</th><th>${escapeHtml(labels.standardClause)}</th><th>${escapeHtml(labels.checkSeverity)}</th><th>${escapeHtml(labels.policyMessage)}</th></tr></thead>
|
|
42
|
+
<tbody>${view.failures.map(row => `<tr><td>${escapeHtml(row.standard)}</td><td>${escapeHtml(row.clause)}</td><td>${escapeHtml(row.severity)}</td><td>${escapeHtml(row.message)}</td></tr>`).join('')}</tbody></table>`
|
|
43
|
+
: `<p>${escapeHtml(labels.allChecksPassed)}</p>`;
|
|
44
|
+
return `<section class="standards-conformance">${heading}
|
|
45
|
+
<table><thead><tr><th>${escapeHtml(labels.standardName)}</th><th>${escapeHtml(labels.complianceStatus)}</th></tr></thead><tbody>${statusRows}</tbody></table>
|
|
46
|
+
${failures}</section>`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = { complianceView, renderComplianceHtml };
|
package/lib/report/docx.js
CHANGED
|
@@ -20,7 +20,8 @@ async function buildDocxReport(snapshot) {
|
|
|
20
20
|
...snapshot.errors.map(error => paragraph(`${labels.error}: ${labels[`phase_${error.phase}`]} / ${error.code}`)));
|
|
21
21
|
if (scan) children.push(...scanSummary(scan, workspacePath, labels, section('scan')?.title || '', 'scan', false),
|
|
22
22
|
...findings(scan, labels, section('findings')?.title || '', 'findings'));
|
|
23
|
-
|
|
23
|
+
// The snapshot stores policy and compliance beside the SBOM; the inventory section reports both.
|
|
24
|
+
if (sbom) children.push(...inventory({ ...sbom, policy: snapshot.policy, compliance: snapshot.compliance }, labels, false, section('inventory')?.title || '', 'inventory'));
|
|
24
25
|
return packDocxDocument(children, labels.dependencySecurityReport);
|
|
25
26
|
}
|
|
26
27
|
module.exports = { buildDocxReport };
|
|
@@ -3,6 +3,19 @@ const { REPORT, REPORT_LAYOUT, SEVERITIES, SEVERITY_STYLES, LICENSE_RISKS, LICEN
|
|
|
3
3
|
const { paragraph, heading, table, severityCell, licenseRiskCell } = require('./docxLayout');
|
|
4
4
|
const { auditComponentLicenses } = require('../sbom/licenseClassifier');
|
|
5
5
|
const { auditSbomCraReadiness } = require('../sbom/craAuditor');
|
|
6
|
+
const { complianceView } = require('./complianceSection');
|
|
7
|
+
|
|
8
|
+
function standardsConformance(compliance, labels) {
|
|
9
|
+
const view = complianceView(compliance, labels);
|
|
10
|
+
if (!view) return [];
|
|
11
|
+
/** @type {any[]} */
|
|
12
|
+
const children = [new Paragraph({ text: labels.standardsConformance, heading: HeadingLevel.HEADING_2 }), paragraph(labels.standardsConformanceNotice)];
|
|
13
|
+
if (view.error) return [...children, paragraph(view.error, { color: SEVERITY_STYLES.high.color, bold: true })];
|
|
14
|
+
children.push(table([labels.standardName, labels.complianceStatus], view.standards.map(row => [row.name, row.status]), REPORT.summaryWidths));
|
|
15
|
+
if (!view.failures.length) return [...children, paragraph(labels.allChecksPassed)];
|
|
16
|
+
return [...children, new Paragraph({ text: labels.failedChecks, heading: HeadingLevel.HEADING_3 }),
|
|
17
|
+
table([labels.standardName, labels.standardClause, labels.checkSeverity, labels.policyMessage], view.failures.map(row => [row.standard, row.clause, row.severity, row.message]), REPORT_LAYOUT.suppressedWidths)];
|
|
18
|
+
}
|
|
6
19
|
|
|
7
20
|
function findingOrder(item) {
|
|
8
21
|
const key = item.severity === 'medium' ? 'moderate' : item.severity;
|
|
@@ -138,6 +151,8 @@ function inventory(sbom, labels, pageBreakBefore, title, bookmark) {
|
|
|
138
151
|
children.push(paragraph(labels.copyleftWarning, { color: LICENSE_RISK_STYLES.copyleft.color, bold: true }));
|
|
139
152
|
}
|
|
140
153
|
|
|
154
|
+
children.push(...standardsConformance(sbom.compliance, labels));
|
|
155
|
+
|
|
141
156
|
const sbomPolicy = sbom.policy || sbom.policyResult;
|
|
142
157
|
if (sbomPolicy && Array.isArray(sbomPolicy.violations) && sbomPolicy.violations.length > 0) {
|
|
143
158
|
children.push(
|
|
@@ -151,7 +151,9 @@ function buildSarifLog({ vulnerabilities = [], policyResult = null, compliance =
|
|
|
151
151
|
if (!rules.has(rule.id)) rules.set(rule.id, rule);
|
|
152
152
|
results.push(buildVulnerabilityResult(vuln, workspacePath));
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
// Standard checks folded into the policy are reported once, as compliance results, when both are present.
|
|
155
|
+
const policyViolations = Array.isArray(policyResult?.violations) ? policyResult.violations : [];
|
|
156
|
+
for (const violation of compliance ? policyViolations.filter(item => item.standardId === undefined) : policyViolations) {
|
|
155
157
|
const rule = buildPolicyRule(violation);
|
|
156
158
|
if (!rules.has(rule.id)) rules.set(rule.id, rule);
|
|
157
159
|
results.push(buildPolicyResult(violation));
|
package/lib/report/styles.js
CHANGED
|
@@ -84,7 +84,9 @@ const SBOM_STYLES = ` :root {
|
|
|
84
84
|
font-family: SFMono-Regular, Consolas, monospace;
|
|
85
85
|
font-size: 12px;
|
|
86
86
|
word-break: break-all;
|
|
87
|
-
}
|
|
87
|
+
}
|
|
88
|
+
.standard-pass { color: #16a34a; font-weight: 700; }
|
|
89
|
+
.standard-fail, .standards-error { color: #dc2626; font-weight: 700; }`;
|
|
88
90
|
const VULNERABILITY_STYLES = ` :root {
|
|
89
91
|
--bg: #ffffff;
|
|
90
92
|
--fg: #1f2328;
|