fix(sbom): known licence names are exported as SPDX ids #543

Merged
sharang merged 1 commits from fix/sbom-licence-spdx-ids into main 2026-10-09 13:39:29 +00:00
Owner

BSI TR-03183-2: licences in the SBOM export as SPDX ids.

  • New compliance_core::spdx_license: the SPDX list (moved from sbom_docs), the licence-page URL table (moved from nuget_license, plus Eclipse/CC0/Boost pages and generic opensource.org/licenses/<id> / spdx.org/licenses/<id>), and the name matcher (moved from registry_license::spdx_of_name, extended). One table, used at export and by the POM/NuGet lookups at ingest.
  • Names are matched by family + version, ignoring case, punctuation, "The", "Version"/"v"; "or later"/"+" gives -or-later; GPL 2 with Classpath exception becomes GPL-2.0-only WITH Classpath-exception-2.0. A family without the version it needs ("GPL", "BSD License", "Eclipse Public License") or a dual licence ("CDDL + GPLv2 ...") stays a name. Valid ids (case-canonicalised), expressions and LicenseRef- stay as they are.
  • CycloneDX: known -> license.id, unknown -> license.name, expressions -> expression.
  • SPDX: licenseConcluded was the raw name (invalid SPDX); now an expression of listed ids, else NOASSERTION with the declared text in licenseComments. The concluded-vs-declared field choice is unchanged (out of scope).
  • Normalised at export, so SBOM rows stored before need no migration.

Not in this PR: COPYLEFT_LICENSES in the SBOM licence summary still matches stored strings exactly, so old rows named "GNU Lesser General Public License v2.1" are not flagged copyleft; feeding it the normaliser is a follow-up.

Tests: spdx_license::tests::{known_licence_names_and_urls_become_spdx_ids, unknown_names_and_spdx_input_stay_as_written, spdx_expressions_are_recognised}, sbom_docs::tests::known_license_names_are_exported_as_spdx_ids, doctest; existing registry_license/nuget_license licence tests and vex_schemas pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

BSI TR-03183-2: licences in the SBOM export as SPDX ids. - New `compliance_core::spdx_license`: the SPDX list (moved from `sbom_docs`), the licence-page URL table (moved from `nuget_license`, plus Eclipse/CC0/Boost pages and generic `opensource.org/licenses/<id>` / `spdx.org/licenses/<id>`), and the name matcher (moved from `registry_license::spdx_of_name`, extended). One table, used at export and by the POM/NuGet lookups at ingest. - Names are matched by family + version, ignoring case, punctuation, "The", "Version"/"v"; "or later"/"+" gives `-or-later`; GPL 2 with Classpath exception becomes `GPL-2.0-only WITH Classpath-exception-2.0`. A family without the version it needs ("GPL", "BSD License", "Eclipse Public License") or a dual licence ("CDDL + GPLv2 ...") stays a name. Valid ids (case-canonicalised), expressions and `LicenseRef-` stay as they are. - CycloneDX: known -> `license.id`, unknown -> `license.name`, expressions -> `expression`. - SPDX: `licenseConcluded` was the raw name (invalid SPDX); now an expression of listed ids, else `NOASSERTION` with the declared text in `licenseComments`. The concluded-vs-declared field choice is unchanged (out of scope). - Normalised at export, so SBOM rows stored before need no migration. Not in this PR: `COPYLEFT_LICENSES` in the SBOM licence summary still matches stored strings exactly, so old rows named "GNU Lesser General Public License v2.1" are not flagged copyleft; feeding it the normaliser is a follow-up. Tests: `spdx_license::tests::{known_licence_names_and_urls_become_spdx_ids, unknown_names_and_spdx_input_stay_as_written, spdx_expressions_are_recognised}`, `sbom_docs::tests::known_license_names_are_exported_as_spdx_ids`, doctest; existing `registry_license`/`nuget_license` licence tests and `vex_schemas` pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-09 13:25:36 +00:00
fix(sbom): known licence names are exported as SPDX ids
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 11m43s
e417d154d4
BSI TR-03183-2 wants SPDX ids. Maven POMs, syft and older scans store
names ("The Apache Software License, Version 2.0") or only a licence URL;
the CycloneDX export wrote them as license.name, the SPDX export put the
raw name into licenseConcluded (invalid SPDX).

New compliance_core::spdx_license holds the SPDX list (moved from
sbom_docs), the licence-page URL table (moved from the agent's NuGet
lookup) and the name matcher (moved and extended from the agent's POM
lookup): case, punctuation, "The", "Version"/"v", "or later"/"+" and
GPL + Classpath exception; a family without a version or a dual licence
stays a name. Normalised at export, so rows stored before need no
migration; the POM and NuGet lookups use the same functions at ingest.

SPDX export: an expression of listed ids, else NOASSERTION with the
declared text in licenseComments.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang force-pushed fix/sbom-licence-spdx-ids from 19d098bdbb to e417d154d4 2026-10-09 13:25:36 +00:00 Compare
sharang merged commit 2c2fea6222 into main 2026-10-09 13:39:29 +00:00
Sign in to join this conversation.