sbom-vulnerability-scanner 9.11.0 → 9.12.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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 9.12.0
4
+
5
+ - **SBOM Explorer**: With `.sbom-profile.json`, the Explorer shows a standards card, a "Standard Gaps" filter and badge, the failed standard checks for each component in the inspector, and a summary of document-level failures. Labels follow the English/Japanese switch. An evaluation that could not run is shown as not evaluated.
6
+ - **Bounded outputs**: The complete list of failing components is used only to build the Explorer; `compliance-report-*.json`, the analysis snapshot and SARIF keep at most five example components per check.
7
+
3
8
  ## 9.10.0
4
9
 
5
10
  - **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.
package/README.ja.md CHANGED
@@ -141,7 +141,7 @@ 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:<規格>/<チェック>`)になり、推奨チェックは警告になります。
144
+ ワークスペースに `.sbom-profile.json` があると、VS Code の通常の解析でも選択した規格を評価します。結果は `compliance-report-<日時>.json` と SARIF に出力され、SBOM の HTML レポート、Word レポート、SBOM Explorer にも表示されます。Explorer では「規格不適合」フィルターで不合格のコンポーネントを絞り込めます。`.sbom-policy.json` がある場合、不合格の必須チェックはポリシー違反(`standard:<規格>/<チェック>`)になり、推奨チェックは警告になります。
145
145
 
146
146
  ```json
147
147
  {
package/README.md CHANGED
@@ -152,7 +152,7 @@ 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.
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, the Word report and SBOM Explorer, where a "Standard Gaps" filter lists the components that fail a check. If `.sbom-policy.json` exists, failed mandatory checks become policy violations (`standard:<standard>/<check>`), and advisory checks become warnings.
156
156
 
157
157
  ```json
158
158
  {
package/dist/extension.js CHANGED
@@ -376,7 +376,7 @@ var require_package = __commonJS({
376
376
  name: "sbom-vulnerability-scanner",
377
377
  displayName: "%ext.displayName%",
378
378
  description: "%ext.description%",
379
- version: "9.11.0",
379
+ version: "9.12.0",
380
380
  publisher: "masahirocom",
381
381
  author: "masahiroid",
382
382
  private: false,
@@ -3124,6 +3124,11 @@ var require_styles = __commonJS({
3124
3124
  .badge-vuln { background: var(--danger); color: #fff; }
3125
3125
  .badge-copyleft { background: #b42318; color: #fff; }
3126
3126
  .badge-cra-gap { background: var(--warning); color: #000; }
3127
+ .badge-standard-gap { background: var(--danger); color: #fff; }
3128
+ .standards-details { margin-top: 8px; font-size: 12px; }
3129
+ .standards-details summary { cursor: pointer; font-weight: 600; }
3130
+ .standards-details h4 { margin: 8px 0 4px; font-size: 12px; }
3131
+ .standard-failures li { align-items: flex-start; }
3127
3132
  .badge-diff-added { background: var(--success); color: #fff; }
3128
3133
  .badge-diff-removed { background: var(--danger); color: #fff; }
3129
3134
  .badge-diff-upgraded { background: var(--accent); color: #fff; }
@@ -3742,6 +3747,300 @@ var require_policyEvaluator = __commonJS({
3742
3747
  }
3743
3748
  });
3744
3749
 
3750
+ // lib/compliance/syntax.js
3751
+ var require_syntax = __commonJS({
3752
+ "lib/compliance/syntax.js"(exports2, module2) {
3753
+ "use strict";
3754
+ var licenseList = require_spdxLicenseList();
3755
+ var { COMPLIANCE } = require_constants();
3756
+ var PURL_PATTERN = /^pkg:[a-z][a-z0-9.+-]*\/[^\s?#]+(\?[^\s#]*)?(#\S*)?$/i;
3757
+ var BAD_PERCENT_PATTERN = /%(?![0-9a-f]{2})/i;
3758
+ var CPE22_PATTERN = /^cpe:\/[aho](:[^\s:]*)*$/i;
3759
+ var CPE23_PREFIX = "cpe:2.3:";
3760
+ var CPE23_PARTS = /^[aho*-]$/i;
3761
+ var TIMESTAMP_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;
3762
+ var DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})(T.*)?$/;
3763
+ var EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
3764
+ var EMBEDDED_EMAIL_PATTERN = /[^\s()<>@]+@[^\s()<>@]+\.[^\s()<>@]+/;
3765
+ var URL_PATTERN = /^https?:\/\/[^\s]+$/i;
3766
+ var LICENSE_REF_PATTERN = /^(DocumentRef-[A-Za-z0-9.-]+:)?LicenseRef-[A-Za-z0-9.-]+$/;
3767
+ var TOKEN_PATTERN = /[()]|[^\s()]+/g;
3768
+ var OPERATORS = /* @__PURE__ */ new Set(["AND", "OR", "and", "or"]);
3769
+ function isValidPurl(value) {
3770
+ return typeof value === "string" && PURL_PATTERN.test(value) && !BAD_PERCENT_PATTERN.test(value);
3771
+ }
3772
+ function isValidCpe(value) {
3773
+ if (typeof value !== "string") return false;
3774
+ if (CPE22_PATTERN.test(value)) return true;
3775
+ if (!value.toLowerCase().startsWith(CPE23_PREFIX)) return false;
3776
+ const parts = value.slice(CPE23_PREFIX.length).split(/(?<!\\):/);
3777
+ return parts.length === COMPLIANCE.cpe23ComponentCount && CPE23_PARTS.test(parts[0]) && parts.every((part) => part.length > 0 && !/\s/.test(part));
3778
+ }
3779
+ function isCalendarDate(year, month, day) {
3780
+ return month >= 1 && month <= COMPLIANCE.monthsPerYear && day >= 1 && day <= new Date(Date.UTC(year, month, 0)).getUTCDate();
3781
+ }
3782
+ function isStrictTimestamp(value) {
3783
+ const match = typeof value === "string" ? value.match(TIMESTAMP_PATTERN) : null;
3784
+ if (!match || !isCalendarDate(Number(match[1]), Number(match[2]), Number(match[3]))) return false;
3785
+ return !Number.isNaN(Date.parse(value));
3786
+ }
3787
+ function isRfc9557Timestamp(value) {
3788
+ return typeof value === "string" && isStrictTimestamp(value.replace(/(\[[^\]\s]+\])+$/, ""));
3789
+ }
3790
+ function isDateValue(value) {
3791
+ const match = typeof value === "string" ? value.trim().match(DATE_PATTERN) : null;
3792
+ return match !== null && isCalendarDate(Number(match[1]), Number(match[2]), Number(match[3]));
3793
+ }
3794
+ var isEmail = (value) => typeof value === "string" && EMAIL_PATTERN.test(value.trim());
3795
+ var isHttpUrl = (value) => typeof value === "string" && URL_PATTERN.test(value.trim());
3796
+ var isContact = (value) => isEmail(value) || isHttpUrl(value);
3797
+ function extractEmail(value) {
3798
+ return typeof value === "string" ? value.match(EMBEDDED_EMAIL_PATTERN)?.[0] : void 0;
3799
+ }
3800
+ function versionAtLeast(actual, minimum) {
3801
+ if (!/^\d+(\.\d+)*$/.test(String(actual || ""))) return false;
3802
+ const left = String(actual).split(".").map(Number);
3803
+ const right = minimum.split(".").map(Number);
3804
+ for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
3805
+ const difference = (left[index] || 0) - (right[index] || 0);
3806
+ if (difference !== 0) return difference > 0;
3807
+ }
3808
+ return true;
3809
+ }
3810
+ function isLicenseId(token) {
3811
+ if (LICENSE_REF_PATTERN.test(token)) return true;
3812
+ const id = token.endsWith("+") ? token.slice(0, -1) : token;
3813
+ return Object.hasOwn(licenseList.licenses, id);
3814
+ }
3815
+ function isValidLicenseExpression(expression) {
3816
+ if (typeof expression !== "string" || !expression.trim() || expression.length > COMPLIANCE.maxLicenseExpressionLength) return false;
3817
+ const tokens = expression.match(TOKEN_PATTERN) || [];
3818
+ let position = 0;
3819
+ function parseOperand(depth) {
3820
+ const token = tokens[position];
3821
+ if (token === void 0 || depth > COMPLIANCE.maxLicenseExpressionDepth) return false;
3822
+ if (token === "(") {
3823
+ position += 1;
3824
+ if (!parseExpression(depth + 1) || tokens[position] !== ")") return false;
3825
+ position += 1;
3826
+ return true;
3827
+ }
3828
+ if (!isLicenseId(token)) return false;
3829
+ position += 1;
3830
+ if (tokens[position] !== "WITH" && tokens[position] !== "with") return true;
3831
+ position += 1;
3832
+ const exception = tokens[position];
3833
+ if (!exception || !(Object.hasOwn(licenseList.exceptions, exception) || LICENSE_REF_PATTERN.test(exception))) return false;
3834
+ position += 1;
3835
+ return true;
3836
+ }
3837
+ function parseExpression(depth) {
3838
+ if (!parseOperand(depth)) return false;
3839
+ while (OPERATORS.has(tokens[position])) {
3840
+ position += 1;
3841
+ if (!parseOperand(depth)) return false;
3842
+ }
3843
+ return true;
3844
+ }
3845
+ return parseExpression(0) && position === tokens.length;
3846
+ }
3847
+ module2.exports = { isRfc9557Timestamp, isValidPurl, isValidCpe, isStrictTimestamp, isDateValue, isEmail, isHttpUrl, isContact, extractEmail, versionAtLeast, isValidLicenseExpression };
3848
+ }
3849
+ });
3850
+
3851
+ // lib/compliance/checks.js
3852
+ var require_checks = __commonJS({
3853
+ "lib/compliance/checks.js"(exports2, module2) {
3854
+ "use strict";
3855
+ var { COMPLIANCE } = require_constants();
3856
+ var { isValidPurl, isValidCpe, isContact, isValidLicenseExpression, isStrictTimestamp } = require_syntax();
3857
+ var SEVERITY_ERROR = "error";
3858
+ var SEVERITY_WARNING = "warning";
3859
+ var EMPTY_VALUES = /* @__PURE__ */ new Set(["", "unknown", "undefined", "noassertion", "none"]);
3860
+ var hasText = (value) => typeof value === "string" && !EMPTY_VALUES.has(value.trim().toLowerCase());
3861
+ var componentKey = (component) => `${component.name || "unknown"}@${component.version || "unknown"}`;
3862
+ var componentsOf = (sbom) => Array.isArray(sbom?.components) ? sbom.components : [];
3863
+ var documentOf = (sbom) => sbom?.metadata?.sourceDocument || {};
3864
+ function documentCheck(id, clause, severity, passed) {
3865
+ return { id, clause, severity, passed: Boolean(passed), failed: passed ? 0 : 1, total: 1, componentKeys: [] };
3866
+ }
3867
+ function componentCheck(sbom, id, clause, severity, predicate) {
3868
+ const components = componentsOf(sbom);
3869
+ const failing = components.filter((component) => !predicate(component));
3870
+ return {
3871
+ id,
3872
+ clause,
3873
+ severity,
3874
+ passed: failing.length === 0,
3875
+ failed: failing.length,
3876
+ total: components.length,
3877
+ componentKeys: failing.slice(0, COMPLIANCE.maxComponentExamples).map(componentKey),
3878
+ failingKeys: failing.map(componentKey)
3879
+ };
3880
+ }
3881
+ var componentsPresent = (sbom, clause) => documentCheck("componentsPresent", clause, SEVERITY_ERROR, componentsOf(sbom).length > 0);
3882
+ var hasName = (component) => hasText(component.name);
3883
+ var hasVersion = (component) => hasText(component.version);
3884
+ var hasSupplier = (component) => hasText(component.supplier);
3885
+ var hasProducer = (component) => hasSupplier(component) || hasText(component.producer);
3886
+ var hasLicenseStatement = (component) => (component.licenses || []).some((value) => typeof value === "string" && value.trim() !== "") || typeof component.licenseDeclared === "string" && component.licenseDeclared.trim() !== "";
3887
+ function hasIdentifier(component) {
3888
+ return [component.purl, component.cpe, ...component.otherIdentifiers || []].some(hasText);
3889
+ }
3890
+ function hasWellFormedIdentifier(component) {
3891
+ return (!hasText(component.purl) || isValidPurl(component.purl)) && (!hasText(component.cpe) || isValidCpe(component.cpe));
3892
+ }
3893
+ function hasValidIdentifier(component) {
3894
+ const purl = hasText(component.purl) ? component.purl : null;
3895
+ const cpe = hasText(component.cpe) ? component.cpe : null;
3896
+ if (!purl && !cpe) return false;
3897
+ return (!purl || isValidPurl(purl)) && (!cpe || isValidCpe(cpe));
3898
+ }
3899
+ var hasHash = (component) => (component.hashes || []).some((hash) => hasText(hash?.value));
3900
+ function hasHashAlgorithm(component, algorithm) {
3901
+ return (component.hashes || []).some((hash) => String(hash?.algorithm || "").toUpperCase().replaceAll("-", "") === algorithm && hasText(hash?.value));
3902
+ }
3903
+ var hasLicense = (component) => (component.licenses || []).some(hasText);
3904
+ function hasSpdxLicense(component) {
3905
+ const licenses = Array.isArray(component.spdxLicenses) ? component.spdxLicenses : component.licenses;
3906
+ return Array.isArray(licenses) && licenses.length > 0 && licenses.every(isValidLicenseExpression);
3907
+ }
3908
+ var hasCreatorContact = (component) => (component.creatorContacts || []).some(isContact);
3909
+ function dependencyGraphPredicate(sbom) {
3910
+ const known = /* @__PURE__ */ new Set();
3911
+ for (const entry of sbom?.dependencies || []) {
3912
+ if (entry?.ref) known.add(entry.ref);
3913
+ for (const target of entry?.dependsOn || []) known.add(target);
3914
+ }
3915
+ return (component) => known.has(component.id) || known.has(component.purl);
3916
+ }
3917
+ function ntiaBaselineChecks(sbom, clause) {
3918
+ const document2 = documentOf(sbom);
3919
+ return [
3920
+ componentCheck(sbom, "supplier", clause, SEVERITY_ERROR, hasSupplier),
3921
+ componentCheck(sbom, "name", clause, SEVERITY_ERROR, hasName),
3922
+ componentCheck(sbom, "version", clause, SEVERITY_ERROR, hasVersion),
3923
+ componentCheck(sbom, "identifier", clause, SEVERITY_ERROR, hasIdentifier),
3924
+ componentCheck(sbom, "identifierSyntax", clause, SEVERITY_WARNING, hasWellFormedIdentifier),
3925
+ componentCheck(sbom, "dependencies", clause, SEVERITY_ERROR, dependencyGraphPredicate(sbom)),
3926
+ documentCheck("sbomAuthor", clause, SEVERITY_ERROR, (document2.creators || []).some(hasText)),
3927
+ documentCheck("timestamp", clause, SEVERITY_ERROR, hasText(document2.timestamp)),
3928
+ documentCheck("timestampFormat", clause, SEVERITY_WARNING, isStrictTimestamp(document2.timestamp))
3929
+ ];
3930
+ }
3931
+ module2.exports = {
3932
+ componentKey,
3933
+ hasProducer,
3934
+ hasIdentifier,
3935
+ hasWellFormedIdentifier,
3936
+ hasLicenseStatement,
3937
+ ntiaBaselineChecks,
3938
+ SEVERITY_ERROR,
3939
+ SEVERITY_WARNING,
3940
+ hasText,
3941
+ componentsOf,
3942
+ documentOf,
3943
+ documentCheck,
3944
+ componentCheck,
3945
+ componentsPresent,
3946
+ hasName,
3947
+ hasVersion,
3948
+ hasSupplier,
3949
+ hasValidIdentifier,
3950
+ hasHash,
3951
+ hasHashAlgorithm,
3952
+ hasLicense,
3953
+ hasSpdxLicense,
3954
+ hasCreatorContact,
3955
+ dependencyGraphPredicate
3956
+ };
3957
+ }
3958
+ });
3959
+
3960
+ // lib/report/complianceSection.js
3961
+ var require_complianceSection = __commonJS({
3962
+ "lib/report/complianceSection.js"(exports2, module2) {
3963
+ "use strict";
3964
+ var { escapeHtml } = require_common();
3965
+ var SEVERITY_ERROR = "error";
3966
+ function complianceView(compliance, labels) {
3967
+ if (!compliance) return null;
3968
+ if (compliance.status === "ERROR") {
3969
+ return { error: `${labels.standardsEvaluationError} ${labels[`complianceError_${compliance.errorKey}`] || compliance.errorKey}`, standards: [], failures: [] };
3970
+ }
3971
+ const nameOf = (id) => labels[`standard_${id}`] || id;
3972
+ return {
3973
+ error: null,
3974
+ standards: compliance.standards.map((standard) => ({ name: nameOf(standard.standardId), passed: standard.passed, status: standard.passed ? labels.compliant : labels.actionNeeded })),
3975
+ failures: compliance.standards.flatMap((standard) => standard.checks.filter((check) => !check.passed).map((check) => ({
3976
+ standard: nameOf(standard.standardId),
3977
+ clause: check.clause,
3978
+ severity: check.severity === SEVERITY_ERROR ? labels.checkMandatory : labels.checkAdvisory,
3979
+ message: check.message
3980
+ })))
3981
+ };
3982
+ }
3983
+ function renderComplianceHtml(compliance, labels) {
3984
+ const view = complianceView(compliance, labels);
3985
+ if (!view) return "";
3986
+ const heading = `<h2>${escapeHtml(labels.standardsConformance)}</h2><p>${escapeHtml(labels.standardsConformanceNotice)}</p>`;
3987
+ if (view.error) return `<section class="standards-conformance">${heading}<p class="standards-error"><strong>${escapeHtml(view.error)}</strong></p></section>`;
3988
+ 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("");
3989
+ const failures = view.failures.length ? `<h3>${escapeHtml(labels.failedChecks)}</h3>
3990
+ <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>
3991
+ <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>`;
3992
+ return `<section class="standards-conformance">${heading}
3993
+ <table><thead><tr><th>${escapeHtml(labels.standardName)}</th><th>${escapeHtml(labels.complianceStatus)}</th></tr></thead><tbody>${statusRows}</tbody></table>
3994
+ ${failures}</section>`;
3995
+ }
3996
+ var EXPLORER_LABEL_KEYS = Object.freeze([
3997
+ "standardsCard",
3998
+ "pillStandardGap",
3999
+ "badgeStandardGap",
4000
+ "standardsDocumentChecks",
4001
+ "standardsComponentChecks",
4002
+ "standardError",
4003
+ "standardsEvaluationError",
4004
+ "standardClause",
4005
+ "checkMandatory",
4006
+ "checkAdvisory",
4007
+ "allChecksPassed",
4008
+ "compliant",
4009
+ "actionNeeded"
4010
+ ]);
4011
+ var labelPrefixes = ["standard_", "complianceError_"];
4012
+ function explorerStandardLabels(labels) {
4013
+ return Object.fromEntries(Object.entries(labels).filter(([key]) => EXPLORER_LABEL_KEYS.includes(key) || labelPrefixes.some((prefix) => key.startsWith(prefix))));
4014
+ }
4015
+ function explorerStandards(compliance) {
4016
+ if (!compliance) return null;
4017
+ const byComponent = /* @__PURE__ */ new Map();
4018
+ const documentFailures = [];
4019
+ for (const standard of compliance.standards || []) {
4020
+ for (const check of standard.checks.filter((item) => !item.passed)) {
4021
+ const failure = { standardId: standard.standardId, checkId: check.id, clause: check.clause, mandatory: check.severity === SEVERITY_ERROR, message: check.message };
4022
+ if (!Array.isArray(check.failingKeys) || !check.failingKeys.length) {
4023
+ documentFailures.push(failure);
4024
+ continue;
4025
+ }
4026
+ for (const key of check.failingKeys) byComponent.set(key, [...byComponent.get(key) || [], failure]);
4027
+ }
4028
+ }
4029
+ return {
4030
+ byComponent,
4031
+ summary: {
4032
+ status: compliance.status,
4033
+ errorKey: compliance.errorKey || null,
4034
+ standards: (compliance.standards || []).map((standard) => ({ standardId: standard.standardId, passed: standard.passed })),
4035
+ documentFailures,
4036
+ componentGaps: byComponent.size
4037
+ }
4038
+ };
4039
+ }
4040
+ module2.exports = { complianceView, renderComplianceHtml, explorerStandards, explorerStandardLabels };
4041
+ }
4042
+ });
4043
+
3745
4044
  // l10n/report.en.json
3746
4045
  var require_report_en = __commonJS({
3747
4046
  "l10n/report.en.json"(exports2, module2) {
@@ -3958,7 +4257,13 @@ var require_report_en = __commonJS({
3958
4257
  standard_cra: "EU Cyber Resilience Act",
3959
4258
  standard_bsi: "BSI TR-03183-2",
3960
4259
  standard_fda: "FDA Section 524B",
3961
- standard_profile: "Profile requirements"
4260
+ standard_profile: "Profile requirements",
4261
+ standardsCard: "\u{1F4CF} Standards (.sbom-profile.json)",
4262
+ pillStandardGap: "\u{1F4CF} Standard Gaps",
4263
+ badgeStandardGap: "STANDARD GAP",
4264
+ standardsDocumentChecks: "Failed document-level checks",
4265
+ standardsComponentChecks: "Failed standard checks",
4266
+ standardError: "NOT EVALUATED"
3962
4267
  };
3963
4268
  }
3964
4269
  });
@@ -4179,11 +4484,32 @@ var require_report_ja = __commonJS({
4179
4484
  standard_cra: "EU \u30B5\u30A4\u30D0\u30FC\u30EC\u30B8\u30EA\u30A8\u30F3\u30B9\u6CD5",
4180
4485
  standard_bsi: "BSI TR-03183-2",
4181
4486
  standard_fda: "FDA 524B \u6761",
4182
- standard_profile: "\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u8981\u4EF6"
4487
+ standard_profile: "\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u8981\u4EF6",
4488
+ standardsCard: "\u{1F4CF} \u898F\u683C\u9069\u5408\uFF08.sbom-profile.json\uFF09",
4489
+ pillStandardGap: "\u{1F4CF} \u898F\u683C\u4E0D\u9069\u5408",
4490
+ badgeStandardGap: "\u898F\u683C\u4E0D\u9069\u5408",
4491
+ standardsDocumentChecks: "\u6587\u66F8\u5168\u4F53\u306E\u4E0D\u5408\u683C\u30C1\u30A7\u30C3\u30AF",
4492
+ standardsComponentChecks: "\u4E0D\u5408\u683C\u306E\u898F\u683C\u30C1\u30A7\u30C3\u30AF",
4493
+ standardError: "\u8A55\u4FA1\u4E0D\u80FD"
4183
4494
  };
4184
4495
  }
4185
4496
  });
4186
4497
 
4498
+ // lib/report/labels.js
4499
+ var require_labels = __commonJS({
4500
+ "lib/report/labels.js"(exports2, module2) {
4501
+ "use strict";
4502
+ var english = require_report_en();
4503
+ var japanese = require_report_ja();
4504
+ var { MONOREPO } = require_constants();
4505
+ function getReportLabels(language) {
4506
+ const labels = language === "ja" ? japanese : english;
4507
+ return { ...labels, monorepoScope: labels.monorepoScope.replace("{0}", String(MONOREPO.maxDiscoveryDepth)) };
4508
+ }
4509
+ module2.exports = { getReportLabels };
4510
+ }
4511
+ });
4512
+
4187
4513
  // lib/report/sbomExplorer.js
4188
4514
  var require_sbomExplorer = __commonJS({
4189
4515
  "lib/report/sbomExplorer.js"(exports2, module2) {
@@ -4204,6 +4530,9 @@ var require_sbomExplorer = __commonJS({
4204
4530
  var { getComponentIdentity, formatDiffAsMarkdown } = require_diff();
4205
4531
  var { loadPolicyConfig } = require_policyLoader();
4206
4532
  var { evaluatePolicy } = require_policyEvaluator();
4533
+ var { componentKey: standardComponentKey } = require_checks();
4534
+ var { explorerStandards, explorerStandardLabels } = require_complianceSection();
4535
+ var { getReportLabels } = require_labels();
4207
4536
  function getSeverityRank(severity) {
4208
4537
  const index = SEVERITIES.indexOf(String(severity).toLowerCase());
4209
4538
  return index === -1 ? SEVERITIES.length : index;
@@ -4242,6 +4571,7 @@ var require_sbomExplorer = __commonJS({
4242
4571
  const policyConfig = options.policy || loadPolicyConfig(workspacePath);
4243
4572
  const policyResult = options.policyResult || (policyConfig ? evaluatePolicy(policyConfig, { components: auditedComponents, vulnerabilities: findings, craResult }) : null);
4244
4573
  const violatingKeySet = new Set(policyResult?.violatingComponentKeys || []);
4574
+ const standards = explorerStandards(options.compliance || null);
4245
4575
  let directCount = 0;
4246
4576
  let transitiveCount = 0;
4247
4577
  let copyleftCount = 0;
@@ -4296,6 +4626,7 @@ var require_sbomExplorer = __commonJS({
4296
4626
  craChecks: { hasSupplier, hasVersion, hasPurl, hasHashes, hasCraGap },
4297
4627
  isHighExploit,
4298
4628
  hasPolicyViolation: violatingKeySet.has(key) || violatingKeySet.has(comp.name),
4629
+ standardFailures: standards?.byComponent.get(standardComponentKey(comp)) || [],
4299
4630
  policyViolations: policyResult ? policyResult.violations.filter((v) => v.componentKey === key || v.target.startsWith(comp.name)) : [],
4300
4631
  findings: sortedFindings.map((f) => ({
4301
4632
  id: f.id,
@@ -4336,6 +4667,7 @@ var require_sbomExplorer = __commonJS({
4336
4667
  craChecks: { hasSupplier: Boolean(rem.supplier), hasVersion: Boolean(rem.version), hasPurl: Boolean(rem.purl), hasHashes: Boolean(rem.hashes?.length), hasCraGap: false },
4337
4668
  isHighExploit: false,
4338
4669
  hasPolicyViolation: false,
4670
+ standardFailures: [],
4339
4671
  policyViolations: [],
4340
4672
  findings: [],
4341
4673
  maxSeverity: null,
@@ -4368,6 +4700,8 @@ var require_sbomExplorer = __commonJS({
4368
4700
  initialLanguage,
4369
4701
  scanStatus,
4370
4702
  policy: policyResult,
4703
+ standards: standards ? standards.summary : null,
4704
+ standardLabels: standards ? { en: explorerStandardLabels(getReportLabels("en")), ja: explorerStandardLabels(getReportLabels("ja")) } : null,
4371
4705
  stats: {
4372
4706
  total: enrichedComponents.length,
4373
4707
  direct: directCount,
@@ -4419,6 +4753,15 @@ var require_sbomExplorer = __commonJS({
4419
4753
  </div>` : "";
4420
4754
  const policyPillHtml = policyResult ? `
4421
4755
  <button type="button" class="pill" data-filter="policyViolation" id="pillPolicyViolation">\u{1F6E1}\uFE0F Policy Violations (${policyResult.violations.length})</button>` : "";
4756
+ const standardsCardHtml = standards ? `
4757
+ <div class="stat-card" id="cardStandards">
4758
+ <div class="label" id="lblCardStandards"></div>
4759
+ <div class="val" id="valCardStandards" style="color:${standards.summary.status === "PASS" ? "var(--success)" : "var(--danger)"};"></div>
4760
+ </div>` : "";
4761
+ const standardsPillHtml = standards ? `
4762
+ <button type="button" class="pill" data-filter="standardGap" id="pillStandardGap"></button>` : "";
4763
+ const standardsDetailsHtml = standards ? `
4764
+ <details class="standards-details" id="standardsDetails"><summary id="standardsDetailsSummary"></summary><div id="standardsDetailsBody"></div></details>` : "";
4422
4765
  const copyDiffBtnHtml = diff ? `<button type="button" id="copyDiffBtn" class="copy-diff-btn" title="Copy Release Diff as Markdown">\u{1F4CB} <span id="lblCopyDiff">Copy Diff</span></button>` : "";
4423
4766
  return `<!DOCTYPE html>
4424
4767
  <html lang="${initialLanguage}">
@@ -4462,7 +4805,9 @@ ${SBOM_EXPLORER_STYLES}
4462
4805
  <div class="val" id="valCardVulns" style="color:${scanStatus !== "completed" ? "var(--muted)" : vulnerableCount > 0 ? "var(--danger)" : "var(--success)"}">${scanStatus === "completed" ? vulnerableCount : escapeHtml(scanStatus === "failed" ? panelLabels.scanFailed : panelLabels.notScanned)}</div>
4463
4806
  </div>
4464
4807
  ${policyCardHtml}
4808
+ ${standardsCardHtml}
4465
4809
  </div>
4810
+ ${standardsDetailsHtml}
4466
4811
  </header>
4467
4812
 
4468
4813
  <div class="toolbar">
@@ -4473,6 +4818,7 @@ ${SBOM_EXPLORER_STYLES}
4473
4818
  <button type="button" class="pill active" data-filter="all" id="pillAll">All (${rawComponents.length})</button>
4474
4819
  ${diffPillsHtml}
4475
4820
  ${policyPillHtml}
4821
+ ${standardsPillHtml}
4476
4822
  <button type="button" class="pill" data-filter="direct" id="pillDirect">\u{1F3AF} Direct (${directCount})</button>
4477
4823
  <button type="button" class="pill" data-filter="transitive" id="pillTransitive">\u26D3\uFE0F Transitive (${transitiveCount})</button>
4478
4824
  <button type="button" class="pill" data-filter="copyleft" id="pillCopyleft">\u26A0\uFE0F Copyleft (${copyleftCount})</button>
@@ -4762,6 +5108,7 @@ ${serializedData}
4762
5108
  if (pHighExploit) pHighExploit.textContent = t.pillHighExploit;
4763
5109
  const pCra = document.getElementById('pillCraGap');
4764
5110
  if (pCra) pCra.textContent = t.pillCraGap;
5111
+ applyStandardsLanguage();
4765
5112
  const lblCardPolicy = document.getElementById('lblCardPolicy');
4766
5113
  if (lblCardPolicy) lblCardPolicy.textContent = t.lblCardPolicy;
4767
5114
  const pPolicy = document.getElementById('pillPolicyViolation');
@@ -4793,6 +5140,39 @@ ${serializedData}
4793
5140
  });
4794
5141
  }
4795
5142
 
5143
+ function standardName(id) {
5144
+ const labels = rawData.standardLabels[currentLang];
5145
+ return labels['standard_' + id] || id;
5146
+ }
5147
+
5148
+ function standardFailureItems(failures) {
5149
+ const labels = rawData.standardLabels[currentLang];
5150
+ return failures.map(f => '<li><span class="check-fail">\u2717</span> <strong>' + escapeMarkup(standardName(f.standardId)) + '</strong> \xB7 ' +
5151
+ escapeMarkup(f.clause) + ' \xB7 ' + escapeMarkup(f.mandatory ? labels.checkMandatory : labels.checkAdvisory) + '<br>' + escapeMarkup(f.message) + '</li>').join('');
5152
+ }
5153
+
5154
+ function applyStandardsLanguage() {
5155
+ const summary = rawData.standards;
5156
+ if (!summary) return;
5157
+ const labels = rawData.standardLabels[currentLang];
5158
+ const setText = (id, text) => { const el = document.getElementById(id); if (el) el.textContent = text; };
5159
+ setText('lblCardStandards', labels.standardsCard);
5160
+ const failedCount = summary.standards.filter(s => !s.passed).length;
5161
+ setText('valCardStandards', summary.status === 'ERROR' ? labels.standardError : (summary.status + ' (' + failedCount + '/' + summary.standards.length + ')'));
5162
+ setText('pillStandardGap', labels.pillStandardGap + ' (' + summary.componentGaps + ')');
5163
+ setText('standardsDetailsSummary', labels.standardsCard);
5164
+ const body = document.getElementById('standardsDetailsBody');
5165
+ if (!body) return;
5166
+ if (summary.status === 'ERROR') {
5167
+ body.innerHTML = '<p class="check-fail">' + escapeMarkup(labels.standardsEvaluationError + ' ' + (labels['complianceError_' + summary.errorKey] || summary.errorKey || '')) + '</p>';
5168
+ return;
5169
+ }
5170
+ let html = '<ul class="check-list">' + summary.standards.map(s => '<li>' + (s.passed ? '<span class="check-pass">\u2713</span>' : '<span class="check-fail">\u2717</span>') + ' ' +
5171
+ escapeMarkup(standardName(s.standardId)) + ': ' + escapeMarkup(s.passed ? labels.compliant : labels.actionNeeded) + '</li>').join('') + '</ul>';
5172
+ if (summary.documentFailures.length) html += '<h4>' + escapeMarkup(labels.standardsDocumentChecks) + '</h4><ul class="check-list">' + standardFailureItems(summary.documentFailures) + '</ul>';
5173
+ body.innerHTML = html;
5174
+ }
5175
+
4796
5176
  function matchesFilter(c) {
4797
5177
  if (currentFilter === 'diffAdded' && c.diffStatus !== 'added') return false;
4798
5178
  if (currentFilter === 'diffChanged' && c.diffStatus !== 'changed') return false;
@@ -4805,6 +5185,7 @@ ${serializedData}
4805
5185
  if (currentFilter === 'highExploit' && !c.isHighExploit) return false;
4806
5186
  if (currentFilter === 'policyViolation' && !c.hasPolicyViolation) return false;
4807
5187
  if (currentFilter === 'craGap' && !c.craChecks.hasCraGap) return false;
5188
+ if (currentFilter === 'standardGap' && !(c.standardFailures && c.standardFailures.length)) return false;
4808
5189
  if (currentSearch) {
4809
5190
  const q = currentSearch.toLowerCase();
4810
5191
  const text = (c.name + ' ' + c.version + ' ' + c.license + ' ' + c.purl + ' ' + c.findings.map(f => f.id).join(' ')).toLowerCase();
@@ -4846,6 +5227,7 @@ ${serializedData}
4846
5227
  html += '<span class="badge badge-diff-downgraded" style="background:var(--danger);color:#fff;">' + t.badgePolicyViolation + '</span>';
4847
5228
  }
4848
5229
  if (c.craChecks.hasCraGap) html += '<span class="badge badge-cra-gap">' + t.badgeCraGap + '</span>';
5230
+ if (c.standardFailures && c.standardFailures.length && rawData.standardLabels) html += '<span class="badge badge-standard-gap">' + escapeMarkup(rawData.standardLabels[currentLang].badgeStandardGap) + '</span>';
4849
5231
  html += '</div>';
4850
5232
  return html;
4851
5233
  }
@@ -5019,6 +5401,13 @@ ${serializedData}
5019
5401
  html += '</ul>';
5020
5402
  html += '</div>';
5021
5403
 
5404
+ if (rawData.standards && component.standardFailures && component.standardFailures.length) {
5405
+ html += '<div class="inspector-section">';
5406
+ html += '<h3>' + escapeMarkup(rawData.standardLabels[currentLang].standardsComponentChecks) + ' (' + component.standardFailures.length + ')</h3>';
5407
+ html += '<ul class="check-list standard-failures">' + standardFailureItems(component.standardFailures) + '</ul>';
5408
+ html += '</div>';
5409
+ }
5410
+
5022
5411
  html += '<div class="inspector-section">';
5023
5412
  html += '<h3>' + t.vulnHeading + ' (' + c.findings.length + ')</h3>';
5024
5413
  if (c.findings.length === 0) {
@@ -5120,21 +5509,6 @@ ${serializedData}
5120
5509
  }
5121
5510
  });
5122
5511
 
5123
- // lib/report/labels.js
5124
- var require_labels = __commonJS({
5125
- "lib/report/labels.js"(exports2, module2) {
5126
- "use strict";
5127
- var english = require_report_en();
5128
- var japanese = require_report_ja();
5129
- var { MONOREPO } = require_constants();
5130
- function getReportLabels(language) {
5131
- const labels = language === "ja" ? japanese : english;
5132
- return { ...labels, monorepoScope: labels.monorepoScope.replace("{0}", String(MONOREPO.maxDiscoveryDepth)) };
5133
- }
5134
- module2.exports = { getReportLabels };
5135
- }
5136
- });
5137
-
5138
5512
  // lib/i18n.js
5139
5513
  var require_i18n = __commonJS({
5140
5514
  "lib/i18n.js"(exports2, module2) {
@@ -33092,46 +33466,6 @@ var require_analysisWorkflow = __commonJS({
33092
33466
  }
33093
33467
  });
33094
33468
 
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
-
33135
33469
  // lib/report/builder.js
33136
33470
  var require_builder = __commonJS({
33137
33471
  "lib/report/builder.js"(exports2, module2) {
@@ -33734,214 +34068,6 @@ var require_compliance_ja = __commonJS({
33734
34068
  }
33735
34069
  });
33736
34070
 
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
34071
  // lib/compliance/validators/cisa.js
33946
34072
  var require_cisa = __commonJS({
33947
34073
  "lib/compliance/validators/cisa.js"(exports2, module2) {
@@ -34125,13 +34251,22 @@ var require_engine = __commonJS({
34125
34251
  }
34126
34252
  return { standardId: PROFILE_STANDARD_ID, checks };
34127
34253
  }
34254
+ function stripFailingKeys(check) {
34255
+ const copy = { ...check };
34256
+ delete copy.failingKeys;
34257
+ return copy;
34258
+ }
34259
+ function withoutFailingKeys(result) {
34260
+ if (!result?.standards) return result;
34261
+ return { ...result, standards: result.standards.map((standard) => ({ ...standard, checks: standard.checks.map(stripFailingKeys) })) };
34262
+ }
34128
34263
  function renderMessage(labels, standardId, check) {
34129
34264
  const key = check.messageKey || check.id;
34130
34265
  const template = labels[`${standardId}.${key}`] || labels[key] || key;
34131
34266
  const examples = check.componentKeys.length ? ` (${check.componentKeys.join(", ")})` : "";
34132
34267
  return template.replaceAll("{failed}", String(check.failed)).replaceAll("{total}", String(check.total)).replaceAll("{detail}", String(check.detail || "")) + (check.passed ? "" : examples);
34133
34268
  }
34134
- function evaluateCompliance(sbom, { standards = [], profile = null, language } = {}) {
34269
+ function evaluateCompliance(sbom, { standards = [], profile = null, language, includeFailingKeys = false } = {}) {
34135
34270
  if (!sbom) return { status: "ERROR", passed: false, errorKey: "noSbom", standards: [] };
34136
34271
  const labels = language === "ja" ? japanese : english;
34137
34272
  const results = [...new Set(standards)].map((id) => VALIDATORS[id].validate(sbom, profile));
@@ -34142,15 +34277,16 @@ var require_engine = __commonJS({
34142
34277
  checks: result.checks.map((check) => ({ ...check, message: renderMessage(labels, result.standardId, check) }))
34143
34278
  }));
34144
34279
  const passed = rendered.every((result) => result.passed);
34145
- return { status: passed ? "PASS" : "FAIL", passed, sourceFormat: documentOf(sbom).format, standards: rendered };
34280
+ const evaluation = { status: passed ? "PASS" : "FAIL", passed, sourceFormat: documentOf(sbom).format, standards: rendered };
34281
+ return includeFailingKeys ? evaluation : withoutFailingKeys(evaluation);
34146
34282
  }
34147
- function evaluateProfileCompliance(sbom, profile, language) {
34283
+ function evaluateProfileCompliance(sbom, profile, language, { includeFailingKeys = false } = {}) {
34148
34284
  if (!profile) return null;
34149
34285
  if (profile.unknownStandards.length) return { status: "ERROR", passed: false, errorKey: "unknownStandard", standards: [] };
34150
34286
  if (!profile.standards.length && !profile.requireFields.length && !profile.requireHashAlgorithms.length) return null;
34151
- return evaluateCompliance(sbom, { standards: profile.standards, profile, language });
34287
+ return evaluateCompliance(sbom, { standards: profile.standards, profile, language, includeFailingKeys });
34152
34288
  }
34153
- module2.exports = { evaluateCompliance, evaluateProfileCompliance, PROFILE_STANDARD_ID };
34289
+ module2.exports = { evaluateCompliance, evaluateProfileCompliance, withoutFailingKeys, PROFILE_STANDARD_ID };
34154
34290
  }
34155
34291
  });
34156
34292
 
@@ -34173,7 +34309,7 @@ var require_artifacts = __commonJS({
34173
34309
  var { loadVexStatements } = require_vexLoader();
34174
34310
  var { buildSarifLog } = require_sarifExporter();
34175
34311
  var { loadProfileConfig } = require_profileLoader();
34176
- var { evaluateProfileCompliance } = require_engine();
34312
+ var { evaluateProfileCompliance, withoutFailingKeys } = require_engine();
34177
34313
  var manifest = require_package();
34178
34314
  function buildAnalysisArtifacts2({ sbom, scan, format, errors, language }, workspacePath, suffix, previousSbom = null) {
34179
34315
  const paths = {};
@@ -34193,7 +34329,8 @@ var require_artifacts = __commonJS({
34193
34329
  } catch {
34194
34330
  }
34195
34331
  }
34196
- const compliance = evaluateProfileCompliance(sbom?.normalized, loadProfileConfig(workspacePath), language);
34332
+ const detailedCompliance = evaluateProfileCompliance(sbom?.normalized, loadProfileConfig(workspacePath), language, { includeFailingKeys: true });
34333
+ const compliance = withoutFailingKeys(detailedCompliance);
34197
34334
  if (compliance) {
34198
34335
  writeJsonFile(`${file("compliance-report")}.json`, compliance);
34199
34336
  paths.complianceJson = `${file("compliance-report")}.json`;
@@ -34248,7 +34385,7 @@ var require_artifacts = __commonJS({
34248
34385
  writeTextFile(paths.sbomHtml, buildSbomHtmlReport(sbom, workspacePath, { policyResult, compliance, language }));
34249
34386
  paths.sbomExplorerHtml = `${file("sbom-explorer")}.html`;
34250
34387
  paths.sbomLensHtml = paths.sbomExplorerHtml;
34251
- writeTextFile(paths.sbomExplorerHtml, buildSbomExplorerHtml2(sbom, scan, workspacePath, { language, diff, policyResult }));
34388
+ writeTextFile(paths.sbomExplorerHtml, buildSbomExplorerHtml2(sbom, scan, workspacePath, { language, diff, policyResult, compliance: detailedCompliance }));
34252
34389
  }
34253
34390
  if (scan) {
34254
34391
  writeJsonFile(`${file("vulnerability-report")}.json`, scan);
@@ -211,5 +211,11 @@
211
211
  "standard_cra": "EU Cyber Resilience Act",
212
212
  "standard_bsi": "BSI TR-03183-2",
213
213
  "standard_fda": "FDA Section 524B",
214
- "standard_profile": "Profile requirements"
214
+ "standard_profile": "Profile requirements",
215
+ "standardsCard": "📏 Standards (.sbom-profile.json)",
216
+ "pillStandardGap": "📏 Standard Gaps",
217
+ "badgeStandardGap": "STANDARD GAP",
218
+ "standardsDocumentChecks": "Failed document-level checks",
219
+ "standardsComponentChecks": "Failed standard checks",
220
+ "standardError": "NOT EVALUATED"
215
221
  }
@@ -211,5 +211,11 @@
211
211
  "standard_cra": "EU サイバーレジリエンス法",
212
212
  "standard_bsi": "BSI TR-03183-2",
213
213
  "standard_fda": "FDA 524B 条",
214
- "standard_profile": "プロファイル要件"
214
+ "standard_profile": "プロファイル要件",
215
+ "standardsCard": "📏 規格適合(.sbom-profile.json)",
216
+ "pillStandardGap": "📏 規格不適合",
217
+ "badgeStandardGap": "規格不適合",
218
+ "standardsDocumentChecks": "文書全体の不合格チェック",
219
+ "standardsComponentChecks": "不合格の規格チェック",
220
+ "standardError": "評価不能"
215
221
  }
@@ -22,6 +22,7 @@ function componentCheck(sbom, id, clause, severity, predicate) {
22
22
  return {
23
23
  id, clause, severity, passed: failing.length === 0, failed: failing.length, total: components.length,
24
24
  componentKeys: failing.slice(0, COMPLIANCE.maxComponentExamples).map(componentKey),
25
+ failingKeys: failing.map(componentKey),
25
26
  };
26
27
  }
27
28
 
@@ -95,7 +96,7 @@ function ntiaBaselineChecks(sbom, clause) {
95
96
  ];
96
97
  }
97
98
 
98
- module.exports = {
99
+ module.exports = { componentKey,
99
100
  hasProducer, hasIdentifier, hasWellFormedIdentifier, hasLicenseStatement, ntiaBaselineChecks, SEVERITY_ERROR, SEVERITY_WARNING, hasText, componentsOf, documentOf, documentCheck, componentCheck, componentsPresent,
100
101
  hasName, hasVersion, hasSupplier, hasValidIdentifier, hasHash, hasHashAlgorithm, hasLicense, hasSpdxLicense, hasCreatorContact, dependencyGraphPredicate,
101
102
  };
@@ -27,6 +27,22 @@ function validateProfileRequirements(sbom, profile) {
27
27
  return { standardId: PROFILE_STANDARD_ID, checks };
28
28
  }
29
29
 
30
+ function stripFailingKeys(check) {
31
+ const copy = { ...check };
32
+ delete copy.failingKeys;
33
+ return copy;
34
+ }
35
+
36
+ /**
37
+ * Drop the complete per-check failing component lists, which grow with the SBOM, before a result is stored.
38
+ * @param {any} result Result of evaluateCompliance
39
+ * @returns {any}
40
+ */
41
+ function withoutFailingKeys(result) {
42
+ if (!result?.standards) return result;
43
+ return { ...result, standards: result.standards.map(standard => ({ ...standard, checks: standard.checks.map(stripFailingKeys) })) };
44
+ }
45
+
30
46
  function renderMessage(labels, standardId, check) {
31
47
  const key = check.messageKey || check.id;
32
48
  const template = labels[`${standardId}.${key}`] || labels[key] || key;
@@ -41,9 +57,10 @@ function renderMessage(labels, standardId, check) {
41
57
  * @param {Array<string>} [options.standards]
42
58
  * @param {any} [options.profile]
43
59
  * @param {string} [options.language] 'ja' selects Japanese messages
60
+ * @param {boolean} [options.includeFailingKeys] Keep every failing component key per check (for per-component views)
44
61
  * @returns {{ status: 'PASS'|'FAIL'|'ERROR', passed: boolean, errorKey?: string, sourceFormat?: string, standards: Array<object> }}
45
62
  */
46
- function evaluateCompliance(sbom, { standards = [], profile = null, language } = {}) {
63
+ function evaluateCompliance(sbom, { standards = [], profile = null, language, includeFailingKeys = false } = {}) {
47
64
  if (!sbom) return { status: 'ERROR', passed: false, errorKey: 'noSbom', standards: [] };
48
65
  const labels = language === 'ja' ? japanese : english;
49
66
  const results = [...new Set(standards)].map(id => VALIDATORS[id].validate(sbom, profile));
@@ -54,7 +71,9 @@ function evaluateCompliance(sbom, { standards = [], profile = null, language } =
54
71
  checks: result.checks.map(check => ({ ...check, message: renderMessage(labels, result.standardId, check) })),
55
72
  }));
56
73
  const passed = rendered.every(result => result.passed);
57
- return { status: passed ? 'PASS' : 'FAIL', passed, sourceFormat: documentOf(sbom).format, standards: rendered };
74
+ /** @type {{ status: 'PASS'|'FAIL', passed: boolean, sourceFormat?: string, standards: Array<object> }} */
75
+ const evaluation = { status: passed ? 'PASS' : 'FAIL', passed, sourceFormat: documentOf(sbom).format, standards: rendered };
76
+ return includeFailingKeys ? evaluation : withoutFailingKeys(evaluation);
58
77
  }
59
78
 
60
79
  /**
@@ -63,13 +82,14 @@ function evaluateCompliance(sbom, { standards = [], profile = null, language } =
63
82
  * @param {object|null|undefined} sbom Normalized SBOM
64
83
  * @param {any} profile Result of loadProfileConfig
65
84
  * @param {string} [language]
85
+ * @param {{ includeFailingKeys?: boolean }} [options]
66
86
  * @returns {ReturnType<typeof evaluateCompliance>|null} null when there is no profile or nothing to check
67
87
  */
68
- function evaluateProfileCompliance(sbom, profile, language) {
88
+ function evaluateProfileCompliance(sbom, profile, language, { includeFailingKeys = false } = {}) {
69
89
  if (!profile) return null;
70
90
  if (profile.unknownStandards.length) return { status: 'ERROR', passed: false, errorKey: 'unknownStandard', standards: [] };
71
91
  if (!profile.standards.length && !profile.requireFields.length && !profile.requireHashAlgorithms.length) return null;
72
- return evaluateCompliance(sbom, { standards: profile.standards, profile, language });
92
+ return evaluateCompliance(sbom, { standards: profile.standards, profile, language, includeFailingKeys });
73
93
  }
74
94
 
75
- module.exports = { evaluateCompliance, evaluateProfileCompliance, PROFILE_STANDARD_ID };
95
+ module.exports = { evaluateCompliance, evaluateProfileCompliance, withoutFailingKeys, PROFILE_STANDARD_ID };
@@ -13,7 +13,7 @@ const { generateOpenVex, generateCycloneDxVex } = require('../vex/vexEngine');
13
13
  const { loadVexStatements } = require('../vex/vexLoader');
14
14
  const { buildSarifLog } = require('./sarifExporter');
15
15
  const { loadProfileConfig } = require('../profile/profileLoader');
16
- const { evaluateProfileCompliance } = require('../compliance/engine');
16
+ const { evaluateProfileCompliance, withoutFailingKeys } = require('../compliance/engine');
17
17
  const manifest = require('../../package.json');
18
18
 
19
19
  function buildAnalysisArtifacts({ sbom, scan, format, errors, language }, workspacePath, suffix, previousSbom = null) {
@@ -36,7 +36,9 @@ function buildAnalysisArtifacts({ sbom, scan, format, errors, language }, worksp
36
36
  }
37
37
 
38
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);
39
+ // The Explorer needs every failing component; stored outputs keep only the bounded examples.
40
+ const detailedCompliance = evaluateProfileCompliance(sbom?.normalized, loadProfileConfig(workspacePath), language, { includeFailingKeys: true });
41
+ const compliance = withoutFailingKeys(detailedCompliance);
40
42
  if (compliance) {
41
43
  writeJsonFile(`${file('compliance-report')}.json`, compliance);
42
44
  paths.complianceJson = `${file('compliance-report')}.json`;
@@ -94,7 +96,7 @@ function buildAnalysisArtifacts({ sbom, scan, format, errors, language }, worksp
94
96
  writeTextFile(paths.sbomHtml, buildSbomHtmlReport(sbom, workspacePath, { policyResult, compliance, language }));
95
97
  paths.sbomExplorerHtml = `${file('sbom-explorer')}.html`;
96
98
  paths.sbomLensHtml = paths.sbomExplorerHtml;
97
- writeTextFile(paths.sbomExplorerHtml, buildSbomExplorerHtml(sbom, scan, workspacePath, { language, diff, policyResult }));
99
+ writeTextFile(paths.sbomExplorerHtml, buildSbomExplorerHtml(sbom, scan, workspacePath, { language, diff, policyResult, compliance: detailedCompliance }));
98
100
  }
99
101
  if (scan) {
100
102
  writeJsonFile(`${file('vulnerability-report')}.json`, scan);
@@ -46,4 +46,50 @@ function renderComplianceHtml(compliance, labels) {
46
46
  ${failures}</section>`;
47
47
  }
48
48
 
49
- module.exports = { complianceView, renderComplianceHtml };
49
+ const EXPLORER_LABEL_KEYS = Object.freeze(['standardsCard', 'pillStandardGap', 'badgeStandardGap', 'standardsDocumentChecks', 'standardsComponentChecks',
50
+ 'standardError', 'standardsEvaluationError', 'standardClause', 'checkMandatory', 'checkAdvisory', 'allChecksPassed', 'compliant', 'actionNeeded']);
51
+ const labelPrefixes = ['standard_', 'complianceError_'];
52
+
53
+ /**
54
+ * Labels the Explorer needs for its runtime language switch.
55
+ * @param {Record<string, any>} labels Report labels for one language
56
+ * @returns {Record<string, string>}
57
+ */
58
+ function explorerStandardLabels(labels) {
59
+ return Object.fromEntries(Object.entries(labels).filter(([key]) => EXPLORER_LABEL_KEYS.includes(key) || labelPrefixes.some(prefix => key.startsWith(prefix))));
60
+ }
61
+
62
+ /**
63
+ * Split a compliance result into a document summary and per-component failures for the Explorer.
64
+ * Per-component failures need `failingKeys` (evaluateCompliance with includeFailingKeys).
65
+ * @param {any} compliance Result of evaluateCompliance, or null
66
+ * @returns {{ summary: { status: string, errorKey: string|null, standards: Array<{ standardId: string, passed: boolean }>, documentFailures: Array<object>, componentGaps: number }, byComponent: Map<string, Array<object>> }|null}
67
+ */
68
+ function explorerStandards(compliance) {
69
+ if (!compliance) return null;
70
+ /** @type {Map<string, Array<object>>} */
71
+ const byComponent = new Map();
72
+ const documentFailures = [];
73
+ for (const standard of compliance.standards || []) {
74
+ for (const check of standard.checks.filter(item => !item.passed)) {
75
+ const failure = { standardId: standard.standardId, checkId: check.id, clause: check.clause, mandatory: check.severity === SEVERITY_ERROR, message: check.message };
76
+ if (!Array.isArray(check.failingKeys) || !check.failingKeys.length) {
77
+ documentFailures.push(failure);
78
+ continue;
79
+ }
80
+ for (const key of check.failingKeys) byComponent.set(key, [...(byComponent.get(key) || []), failure]);
81
+ }
82
+ }
83
+ return {
84
+ byComponent,
85
+ summary: {
86
+ status: compliance.status,
87
+ errorKey: compliance.errorKey || null,
88
+ standards: (compliance.standards || []).map(standard => ({ standardId: standard.standardId, passed: standard.passed })),
89
+ documentFailures,
90
+ componentGaps: byComponent.size,
91
+ },
92
+ };
93
+ }
94
+
95
+ module.exports = { complianceView, renderComplianceHtml, explorerStandards, explorerStandardLabels };
@@ -14,6 +14,9 @@ const { SEVERITIES, SBOM_EXPLORER, EPSS } = require('../config/constants');
14
14
  const { getComponentIdentity, formatDiffAsMarkdown } = require('../sbom/diff');
15
15
  const { loadPolicyConfig } = require('../policy/policyLoader');
16
16
  const { evaluatePolicy } = require('../policy/policyEvaluator');
17
+ const { componentKey: standardComponentKey } = require('../compliance/checks');
18
+ const { explorerStandards, explorerStandardLabels } = require('./complianceSection');
19
+ const { getReportLabels } = require('./labels');
17
20
 
18
21
  /**
19
22
  * 脆弱性の重大度ランクを取得
@@ -75,6 +78,7 @@ function buildSbomExplorerHtml(sbomResult, scanResult, workspacePath, options =
75
78
  const policyConfig = options.policy || loadPolicyConfig(workspacePath);
76
79
  const policyResult = options.policyResult || (policyConfig ? evaluatePolicy(policyConfig, { components: auditedComponents, vulnerabilities: findings, craResult }) : null);
77
80
  const violatingKeySet = new Set(policyResult?.violatingComponentKeys || []);
81
+ const standards = explorerStandards(options.compliance || null);
78
82
 
79
83
  let directCount = 0;
80
84
  let transitiveCount = 0;
@@ -136,6 +140,7 @@ function buildSbomExplorerHtml(sbomResult, scanResult, workspacePath, options =
136
140
  craChecks: { hasSupplier, hasVersion, hasPurl, hasHashes, hasCraGap },
137
141
  isHighExploit,
138
142
  hasPolicyViolation: violatingKeySet.has(key) || violatingKeySet.has(comp.name),
143
+ standardFailures: standards?.byComponent.get(standardComponentKey(comp)) || [],
139
144
  policyViolations: policyResult ? policyResult.violations.filter(v => v.componentKey === key || v.target.startsWith(comp.name)) : [],
140
145
  findings: sortedFindings.map(f => ({
141
146
  id: f.id,
@@ -177,6 +182,7 @@ function buildSbomExplorerHtml(sbomResult, scanResult, workspacePath, options =
177
182
  craChecks: { hasSupplier: Boolean(rem.supplier), hasVersion: Boolean(rem.version), hasPurl: Boolean(rem.purl), hasHashes: Boolean(rem.hashes?.length), hasCraGap: false },
178
183
  isHighExploit: false,
179
184
  hasPolicyViolation: false,
185
+ standardFailures: [],
180
186
  policyViolations: [],
181
187
  findings: [],
182
188
  maxSeverity: null,
@@ -211,6 +217,8 @@ function buildSbomExplorerHtml(sbomResult, scanResult, workspacePath, options =
211
217
  initialLanguage,
212
218
  scanStatus,
213
219
  policy: policyResult,
220
+ standards: standards ? standards.summary : null,
221
+ standardLabels: standards ? { en: explorerStandardLabels(getReportLabels('en')), ja: explorerStandardLabels(getReportLabels('ja')) } : null,
214
222
  stats: {
215
223
  total: enrichedComponents.length,
216
224
  direct: directCount,
@@ -268,6 +276,17 @@ function buildSbomExplorerHtml(sbomResult, scanResult, workspacePath, options =
268
276
  const policyPillHtml = policyResult ? `
269
277
  <button type="button" class="pill" data-filter="policyViolation" id="pillPolicyViolation">🛡️ Policy Violations (${policyResult.violations.length})</button>` : '';
270
278
 
279
+ // Filled in by the page script so it follows the runtime language switch.
280
+ const standardsCardHtml = standards ? `
281
+ <div class="stat-card" id="cardStandards">
282
+ <div class="label" id="lblCardStandards"></div>
283
+ <div class="val" id="valCardStandards" style="color:${standards.summary.status === 'PASS' ? 'var(--success)' : 'var(--danger)'};"></div>
284
+ </div>` : '';
285
+ const standardsPillHtml = standards ? `
286
+ <button type="button" class="pill" data-filter="standardGap" id="pillStandardGap"></button>` : '';
287
+ const standardsDetailsHtml = standards ? `
288
+ <details class="standards-details" id="standardsDetails"><summary id="standardsDetailsSummary"></summary><div id="standardsDetailsBody"></div></details>` : '';
289
+
271
290
  const copyDiffBtnHtml = diff ? `<button type="button" id="copyDiffBtn" class="copy-diff-btn" title="Copy Release Diff as Markdown">📋 <span id="lblCopyDiff">Copy Diff</span></button>` : '';
272
291
 
273
292
  return `<!DOCTYPE html>
@@ -312,7 +331,9 @@ ${SBOM_EXPLORER_STYLES}
312
331
  <div class="val" id="valCardVulns" style="color:${scanStatus !== 'completed' ? 'var(--muted)' : vulnerableCount > 0 ? 'var(--danger)' : 'var(--success)'}">${scanStatus === 'completed' ? vulnerableCount : escapeHtml(scanStatus === 'failed' ? panelLabels.scanFailed : panelLabels.notScanned)}</div>
313
332
  </div>
314
333
  ${policyCardHtml}
334
+ ${standardsCardHtml}
315
335
  </div>
336
+ ${standardsDetailsHtml}
316
337
  </header>
317
338
 
318
339
  <div class="toolbar">
@@ -323,6 +344,7 @@ ${SBOM_EXPLORER_STYLES}
323
344
  <button type="button" class="pill active" data-filter="all" id="pillAll">All (${rawComponents.length})</button>
324
345
  ${diffPillsHtml}
325
346
  ${policyPillHtml}
347
+ ${standardsPillHtml}
326
348
  <button type="button" class="pill" data-filter="direct" id="pillDirect">🎯 Direct (${directCount})</button>
327
349
  <button type="button" class="pill" data-filter="transitive" id="pillTransitive">⛓️ Transitive (${transitiveCount})</button>
328
350
  <button type="button" class="pill" data-filter="copyleft" id="pillCopyleft">⚠️ Copyleft (${copyleftCount})</button>
@@ -612,6 +634,7 @@ ${serializedData}
612
634
  if (pHighExploit) pHighExploit.textContent = t.pillHighExploit;
613
635
  const pCra = document.getElementById('pillCraGap');
614
636
  if (pCra) pCra.textContent = t.pillCraGap;
637
+ applyStandardsLanguage();
615
638
  const lblCardPolicy = document.getElementById('lblCardPolicy');
616
639
  if (lblCardPolicy) lblCardPolicy.textContent = t.lblCardPolicy;
617
640
  const pPolicy = document.getElementById('pillPolicyViolation');
@@ -643,6 +666,39 @@ ${serializedData}
643
666
  });
644
667
  }
645
668
 
669
+ function standardName(id) {
670
+ const labels = rawData.standardLabels[currentLang];
671
+ return labels['standard_' + id] || id;
672
+ }
673
+
674
+ function standardFailureItems(failures) {
675
+ const labels = rawData.standardLabels[currentLang];
676
+ return failures.map(f => '<li><span class="check-fail">✗</span> <strong>' + escapeMarkup(standardName(f.standardId)) + '</strong> · ' +
677
+ escapeMarkup(f.clause) + ' · ' + escapeMarkup(f.mandatory ? labels.checkMandatory : labels.checkAdvisory) + '<br>' + escapeMarkup(f.message) + '</li>').join('');
678
+ }
679
+
680
+ function applyStandardsLanguage() {
681
+ const summary = rawData.standards;
682
+ if (!summary) return;
683
+ const labels = rawData.standardLabels[currentLang];
684
+ const setText = (id, text) => { const el = document.getElementById(id); if (el) el.textContent = text; };
685
+ setText('lblCardStandards', labels.standardsCard);
686
+ const failedCount = summary.standards.filter(s => !s.passed).length;
687
+ setText('valCardStandards', summary.status === 'ERROR' ? labels.standardError : (summary.status + ' (' + failedCount + '/' + summary.standards.length + ')'));
688
+ setText('pillStandardGap', labels.pillStandardGap + ' (' + summary.componentGaps + ')');
689
+ setText('standardsDetailsSummary', labels.standardsCard);
690
+ const body = document.getElementById('standardsDetailsBody');
691
+ if (!body) return;
692
+ if (summary.status === 'ERROR') {
693
+ body.innerHTML = '<p class="check-fail">' + escapeMarkup(labels.standardsEvaluationError + ' ' + (labels['complianceError_' + summary.errorKey] || summary.errorKey || '')) + '</p>';
694
+ return;
695
+ }
696
+ let html = '<ul class="check-list">' + summary.standards.map(s => '<li>' + (s.passed ? '<span class="check-pass">✓</span>' : '<span class="check-fail">✗</span>') + ' ' +
697
+ escapeMarkup(standardName(s.standardId)) + ': ' + escapeMarkup(s.passed ? labels.compliant : labels.actionNeeded) + '</li>').join('') + '</ul>';
698
+ if (summary.documentFailures.length) html += '<h4>' + escapeMarkup(labels.standardsDocumentChecks) + '</h4><ul class="check-list">' + standardFailureItems(summary.documentFailures) + '</ul>';
699
+ body.innerHTML = html;
700
+ }
701
+
646
702
  function matchesFilter(c) {
647
703
  if (currentFilter === 'diffAdded' && c.diffStatus !== 'added') return false;
648
704
  if (currentFilter === 'diffChanged' && c.diffStatus !== 'changed') return false;
@@ -655,6 +711,7 @@ ${serializedData}
655
711
  if (currentFilter === 'highExploit' && !c.isHighExploit) return false;
656
712
  if (currentFilter === 'policyViolation' && !c.hasPolicyViolation) return false;
657
713
  if (currentFilter === 'craGap' && !c.craChecks.hasCraGap) return false;
714
+ if (currentFilter === 'standardGap' && !(c.standardFailures && c.standardFailures.length)) return false;
658
715
  if (currentSearch) {
659
716
  const q = currentSearch.toLowerCase();
660
717
  const text = (c.name + ' ' + c.version + ' ' + c.license + ' ' + c.purl + ' ' + c.findings.map(f => f.id).join(' ')).toLowerCase();
@@ -696,6 +753,7 @@ ${serializedData}
696
753
  html += '<span class="badge badge-diff-downgraded" style="background:var(--danger);color:#fff;">' + t.badgePolicyViolation + '</span>';
697
754
  }
698
755
  if (c.craChecks.hasCraGap) html += '<span class="badge badge-cra-gap">' + t.badgeCraGap + '</span>';
756
+ if (c.standardFailures && c.standardFailures.length && rawData.standardLabels) html += '<span class="badge badge-standard-gap">' + escapeMarkup(rawData.standardLabels[currentLang].badgeStandardGap) + '</span>';
699
757
  html += '</div>';
700
758
  return html;
701
759
  }
@@ -869,6 +927,13 @@ ${serializedData}
869
927
  html += '</ul>';
870
928
  html += '</div>';
871
929
 
930
+ if (rawData.standards && component.standardFailures && component.standardFailures.length) {
931
+ html += '<div class="inspector-section">';
932
+ html += '<h3>' + escapeMarkup(rawData.standardLabels[currentLang].standardsComponentChecks) + ' (' + component.standardFailures.length + ')</h3>';
933
+ html += '<ul class="check-list standard-failures">' + standardFailureItems(component.standardFailures) + '</ul>';
934
+ html += '</div>';
935
+ }
936
+
872
937
  html += '<div class="inspector-section">';
873
938
  html += '<h3>' + t.vulnHeading + ' (' + c.findings.length + ')</h3>';
874
939
  if (c.findings.length === 0) {
@@ -311,6 +311,11 @@ const SBOM_LENS_STYLES = `
311
311
  .badge-vuln { background: var(--danger); color: #fff; }
312
312
  .badge-copyleft { background: #b42318; color: #fff; }
313
313
  .badge-cra-gap { background: var(--warning); color: #000; }
314
+ .badge-standard-gap { background: var(--danger); color: #fff; }
315
+ .standards-details { margin-top: 8px; font-size: 12px; }
316
+ .standards-details summary { cursor: pointer; font-weight: 600; }
317
+ .standards-details h4 { margin: 8px 0 4px; font-size: 12px; }
318
+ .standard-failures li { align-items: flex-start; }
314
319
  .badge-diff-added { background: var(--success); color: #fff; }
315
320
  .badge-diff-removed { background: var(--danger); color: #fff; }
316
321
  .badge-diff-upgraded { background: var(--accent); color: #fff; }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "sbom-vulnerability-scanner",
3
3
  "displayName": "%ext.displayName%",
4
4
  "description": "%ext.description%",
5
- "version": "9.11.0",
5
+ "version": "9.12.0",
6
6
  "publisher": "masahirocom",
7
7
  "author": "masahiroid",
8
8
  "private": false,