feat(sbom): confirm the licence of components (licence review) #569

Merged
sharang merged 3 commits from feat/licence-overrides into main 2026-10-15 12:03:30 +00:00
Owner

Licence review, v1. Where the scan finds no licence ("Unknown") or a wrong one, the workspace can confirm it.

What the user does

  • Pakete tab: Bearbeiten next to a component's licence, or tick several rows and Lizenz bearbeiten for all of them (e.g. every library of their own company).
  • Lizenzen tab: "N Komponenten ohne bekannte Lizenz", with Anzeigen und bearbeiten jumping to exactly those. The filter Lizenz offen (unbekannt) does the same.
  • The dialog offers:
    • SPDX licence (id or expression, with suggestions; the category follows from it), or own / commercial licence (name + category);
    • copyright lines, licence text (own licence), URL, where it was found;
    • contract number and valid until for a bought licence;
    • shipped vs. build-only, a note;
    • for every version of this package.
  • Confirmed rows get a bestätigt badge (who and when on hover); Bestätigung zurücknehmen withdraws it.
  • Only IT_ADMIN and USER may edit; the role gate already refuses PUT/DELETE for CXO and LEGAL, and the role-gate tests now cover the new routes. API keys don't reach these routes.

How it works

  • compliance-core/src/models/license.rs: LicenseConclusion, keyed by package (purl without version, or <manager>:<name>) plus version or *.
    • Matching prefers the version over *.
    • Validation; custom licences get a LicenseRef-<name> id.
  • Stored in their own collection license_conclusions. A scan deletes and rewrites sbom_entries, so a licence written there would vanish. Conclusions are merged in on read (SbomEntry.concluded, never stored with the entry).
  • spdx_license::category:
    • categories: permissive, weak copyleft (LGPL, MPL, EPL, CDDL), strong copyleft (GPL, EUPL), network copyleft (AGPL, SSPL), public domain;
    • OR takes the least restrictive term, AND the most;
    • free-text names stay "unclear", so "Mitsubishi EULA" is not MIT.
  • Merged into: GET /sbom (+ unresolved=true), the licence summary (counts the confirmed licence, adds category and confirmed), GET /sbom/export, the evidence pack, and the SBOM quality score.
  • Exports:
    • CycloneDX: the confirmed licence with acknowledgement: concluded (custom: name + text + URL), copyright, and the properties pruefwerk:license:{category,usage,contract,valid_until,evidence,concluded}. The detected licence is kept as pruefwerk:license:declared, because CycloneDX allows one expression or licence objects, never both.
    • SPDX: licenseConcluded (was always NOASSERTION), copyrightText, and hasExtractedLicensingInfos for LicenseRefs.
  • Fix: the dashboard showed LGPL/MPL as strong copyleft (the weak branch never ran because "LGPL" contains "GPL"). Colours now follow the category.

API

  • GET /api/v1/licenses/conclusions
  • PUT /api/v1/licenses/conclusions: {components:[{name,package_manager,version,purl}], all_versions, license | license_name, category, copyright[], license_text, license_url, evidence, contract_ref, valid_until, usage, note}. 422 with the reason; at most 500 components per request and 50 000 conclusions per workspace.
  • DELETE /api/v1/licenses/conclusions?id=

Not in v1: licence policy / findings, third-party notices, the MCP tool, the LEGAL review step (LEGAL is read-only in Prüfwerk today).

Tests: matching, validation, LicenseRef, categories, both export formats, the summary, request building, role gate. Not run locally (laptop RAM); CI runs them.

🤖 Generated with Claude Code

Licence review, v1. Where the scan finds no licence ("Unknown") or a wrong one, the workspace can confirm it. **What the user does** - **Pakete** tab: **Bearbeiten** next to a component's licence, or tick several rows and **Lizenz bearbeiten** for all of them (e.g. every library of their own company). - **Lizenzen** tab: "N Komponenten ohne bekannte Lizenz", with **Anzeigen und bearbeiten** jumping to exactly those. The filter **Lizenz offen (unbekannt)** does the same. - The dialog offers: - **SPDX licence** (id or expression, with suggestions; the category follows from it), or **own / commercial licence** (name + category); - copyright lines, licence text (own licence), URL, where it was found; - contract number and **valid until** for a bought licence; - shipped vs. build-only, a note; - **for every version of this package**. - Confirmed rows get a **bestätigt** badge (who and when on hover); **Bestätigung zurücknehmen** withdraws it. - Only IT_ADMIN and USER may edit; the role gate already refuses `PUT`/`DELETE` for CXO and LEGAL, and the role-gate tests now cover the new routes. API keys don't reach these routes. **How it works** - `compliance-core/src/models/license.rs`: `LicenseConclusion`, keyed by package (purl without version, or `<manager>:<name>`) plus version or `*`. - Matching prefers the version over `*`. - Validation; custom licences get a `LicenseRef-<name>` id. - Stored in their own collection `license_conclusions`. A scan deletes and rewrites `sbom_entries`, so a licence written there would vanish. Conclusions are merged in on read (`SbomEntry.concluded`, never stored with the entry). - `spdx_license::category`: - categories: permissive, weak copyleft (LGPL, MPL, EPL, CDDL), strong copyleft (GPL, EUPL), network copyleft (AGPL, SSPL), public domain; - `OR` takes the least restrictive term, `AND` the most; - free-text names stay "unclear", so "Mitsubishi EULA" is not MIT. - Merged into: `GET /sbom` (+ `unresolved=true`), the licence summary (counts the confirmed licence, adds `category` and `confirmed`), `GET /sbom/export`, the evidence pack, and the SBOM quality score. - **Exports:** - **CycloneDX:** the confirmed licence with `acknowledgement: concluded` (custom: name + text + URL), `copyright`, and the properties `pruefwerk:license:{category,usage,contract,valid_until,evidence,concluded}`. The detected licence is kept as `pruefwerk:license:declared`, because CycloneDX allows one expression or licence objects, never both. - **SPDX:** `licenseConcluded` (was always `NOASSERTION`), `copyrightText`, and `hasExtractedLicensingInfos` for `LicenseRef`s. - **Fix:** the dashboard showed LGPL/MPL as strong copyleft (the weak branch never ran because "LGPL" contains "GPL"). Colours now follow the category. **API** - `GET /api/v1/licenses/conclusions` - `PUT /api/v1/licenses/conclusions`: `{components:[{name,package_manager,version,purl}], all_versions, license | license_name, category, copyright[], license_text, license_url, evidence, contract_ref, valid_until, usage, note}`. 422 with the reason; at most 500 components per request and 50 000 conclusions per workspace. - `DELETE /api/v1/licenses/conclusions?id=` **Not in v1:** licence policy / findings, third-party notices, the MCP tool, the LEGAL review step (LEGAL is read-only in Prüfwerk today). **Tests:** matching, validation, `LicenseRef`, categories, both export formats, the summary, request building, role gate. Not run locally (laptop RAM); CI runs them. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-10-15 11:42:10 +00:00
feat(sbom): confirm the licence of components (licence review)
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) Failing after 2m53s
74eb8b7647
Where the scan finds no licence (or a wrong one), IT_ADMIN and USER can
confirm it: an SPDX licence or one of their own, its category, copyright,
licence text and URL, where it was found, a bought licence's contract and
end, whether the component is shipped or only used to build, and a note.
For one version or every version of the package; one or many components
at once.

- core: LicenseConclusion (models/license.rs) with matching by package key
  (purl without version), validation and LicenseRef ids for licences SPDX
  does not list; spdx_license::category (permissive, weak/strong/network
  copyleft, public domain; OR takes the least, AND the most restrictive;
  free-text names stay unclear).
- Conclusions live in their own collection (license_conclusions): a scan
  rewrites sbom_entries, so they are merged in when components are read.
- Exports: a confirmed licence is CycloneDX acknowledgement "concluded"
  (with copyright and pruefwerk:license:* properties, the detected one kept
  as pruefwerk:license:declared) and SPDX licenseConcluded with
  copyrightText; LicenseRef licences are defined in
  hasExtractedLicensingInfos. Also in the evidence pack and the SBOM
  quality score.
- API: GET/PUT/DELETE /api/v1/licenses/conclusions (writes role-gated);
  /sbom?unresolved=true lists the components still without a licence;
  the licence summary counts the confirmed licence and gives categories.
- Dashboard: edit dialog, row checkboxes for bulk editing, "bestätigt"
  badge with who and when, "Lizenz offen" filter and counter, colours by
  category (LGPL/MPL now show as weak copyleft, not GPL).
- Docs: guide/sbom.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang added 1 commit 2026-10-15 11:45:46 +00:00
test(sbom): the licence summary serialises its category and confirmed count
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) Failing after 7m13s
887bd62986
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang added 1 commit 2026-10-15 11:53:47 +00:00
fix(sbom): keep the dash of LicenseRef- for a name without usable characters; purl keys are decoded
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 9m7s
e93219dc86
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit e65aa76ef5 into main 2026-10-15 12:03:30 +00:00
sharang deleted branch feat/licence-overrides 2026-10-15 12:03:30 +00:00
Sign in to join this conversation.