feat(licenses): licence policy, legal review, third-party notices (licence review v2) #570

Merged
sharang merged 4 commits from feat/licence-v2 into main 2026-10-15 14:35:44 +00:00
Owner

Licence review v2, on top of #569: a policy that says which licences may be used, a legal review that decides the open ones, and the third-party notices a product ships.

What it does

  • Licence policy (GET/PUT /api/v1/licenses/policy, one document per workspace, collection license_policy): per licence category what a shipped and a build-only component needs: allow, review (a LEGAL approval) or forbid. Rules for single licences (AGPL-3.0-only forbidden) apply before the category. AND takes the strictest term, OR the least strict. A bought licence past valid_until is forbidden; one ending within the warning period (default 60 days) is announced.
    • The default forbids nothing. Copyleft, bought and unknown licences in shipped components need a review, so each workspace decides.
  • Licence check (GET /api/v1/licenses/check): counts plus the open components with their reasons. Every SBOM row also carries its verdict (policy, never stored).
  • Findings: after a complete SBOM (Syft ran), the scan reports, under scanner license-policy:
    • each forbidden or expired licence as a High finding;
    • all components waiting for a review as one Low finding per target.
    • They auto-resolve like other findings. A policy change shows in the check at once and in the findings with the next scan.
  • Legal review (POST/DELETE /api/v1/licenses/review): approve or reject the licence of one or more components, with an optional note.
    • An approval resolves a review, never a forbid.
    • A component nobody confirmed a licence for is confirmed as the scan found it (SPDX only), by the reviewer.
    • Saving the licence again in the editor drops the review.
    • The review shows in CycloneDX (pruefwerk:license:review) and in SPDX licenseComments.
  • Who decides:
    • The role gate gets ROLE_WRITES: LEGAL may write on exactly these three routes (policy PUT, review POST/DELETE) and stays read-only everywhere else.
    • The handlers allow LEGAL, IT_ADMIN and support; USER and CXO get 403.
    • This changes the 2026-09-30 role table on purpose (documented in role_gate.rs).
  • Third-party notices (GET /api/v1/sbom/notices?repo_id=&format=text|markdown&build_only=):
    • Shipped components grouped by licence, with their copyright lines.
    • SPDX licences link to spdx.org; the workspace's own licences print their stored text.
    • Components without a licence are listed at the end.
    • The evidence pack gains THIRD-PARTY-NOTICES.txt and license-check.json.
  • API keys: sbom.read reaches check, policy GET and notices.
  • MCP:
    • New license_check and get_third_party_notices.
    • get_sbom and list_sbom_packages now carry the confirmed licences; before this they showed only what was detected.
  • Dashboard, SBOM → Lizenzen:
    • a "Lizenzprüfung" card: summary, the open list with approve/reject/undo (single and bulk), "Richtlinie" (compact dialog: kind × shipped/build, single-licence rules, warning days), "Drittanbieter-Hinweise" download;
    • list rows show Nicht erlaubt / Zur Prüfung and freigegeben / abgelehnt.
  • Docs: docs/guide/sbom.md, docs/features/mcp-server.md.

Tested

Unit tests cover the policy evaluation (categories, licence rules, AND/OR, build-only, expiry, approve/reject), the notices, the review handler, the scan findings (stable fingerprints), the evidence pack file list, and router tests for LEGAL on the decision routes. Clippy and tests run in CI (not locally).

🤖 Generated with Claude Code

Licence review v2, on top of #569: a policy that says which licences may be used, a legal review that decides the open ones, and the third-party notices a product ships. ## What it does - **Licence policy** (`GET/PUT /api/v1/licenses/policy`, one document per workspace, collection `license_policy`): per licence category what a **shipped** and a **build-only** component needs: *allow*, *review* (a LEGAL approval) or *forbid*. Rules for single licences (`AGPL-3.0-only` forbidden) apply before the category. `AND` takes the strictest term, `OR` the least strict. A bought licence past `valid_until` is forbidden; one ending within the warning period (default 60 days) is announced. - The **default forbids nothing**. Copyleft, bought and unknown licences in shipped components need a review, so each workspace decides. - **Licence check** (`GET /api/v1/licenses/check`): counts plus the open components with their reasons. Every SBOM row also carries its verdict (`policy`, never stored). - **Findings**: after a complete SBOM (Syft ran), the scan reports, under scanner `license-policy`: - each forbidden or expired licence as a High finding; - all components waiting for a review as one Low finding per target. - They auto-resolve like other findings. A policy change shows in the check at once and in the findings with the next scan. - **Legal review** (`POST/DELETE /api/v1/licenses/review`): approve or reject the licence of one or more components, with an optional note. - An approval resolves a *review*, never a *forbid*. - A component nobody confirmed a licence for is confirmed as the scan found it (SPDX only), by the reviewer. - Saving the licence again in the editor drops the review. - The review shows in CycloneDX (`pruefwerk:license:review`) and in SPDX `licenseComments`. - **Who decides:** - The role gate gets `ROLE_WRITES`: **LEGAL may write on exactly these three routes** (policy PUT, review POST/DELETE) and stays read-only everywhere else. - The handlers allow LEGAL, IT_ADMIN and support; USER and CXO get 403. - This changes the 2026-09-30 role table on purpose (documented in `role_gate.rs`). - **Third-party notices** (`GET /api/v1/sbom/notices?repo_id=&format=text|markdown&build_only=`): - Shipped components grouped by licence, with their copyright lines. - SPDX licences link to spdx.org; the workspace's own licences print their stored text. - Components without a licence are listed at the end. - The evidence pack gains `THIRD-PARTY-NOTICES.txt` and `license-check.json`. - **API keys:** `sbom.read` reaches check, policy GET and notices. - **MCP:** - New `license_check` and `get_third_party_notices`. - `get_sbom` and `list_sbom_packages` now carry the confirmed licences; before this they showed only what was detected. - **Dashboard, SBOM → Lizenzen:** - a "Lizenzprüfung" card: summary, the open list with approve/reject/undo (single and bulk), "Richtlinie" (compact dialog: kind × shipped/build, single-licence rules, warning days), "Drittanbieter-Hinweise" download; - list rows show *Nicht erlaubt* / *Zur Prüfung* and *freigegeben* / *abgelehnt*. - **Docs:** `docs/guide/sbom.md`, `docs/features/mcp-server.md`. ## Tested Unit tests cover the policy evaluation (categories, licence rules, AND/OR, build-only, expiry, approve/reject), the notices, the review handler, the scan findings (stable fingerprints), the evidence pack file list, and router tests for LEGAL on the decision routes. Clippy and tests run in CI (not locally). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-10-15 13:56:44 +00:00
feat(licenses): licence policy, legal review, third-party notices (licence review v2)
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) Canceled after 2m9s
e133d3f97d
- Licence policy per workspace: per licence category what a shipped and a
  build-only component needs (allow / review / forbid), rules for single
  licences, and how early a bought licence's end is announced. The default
  forbids nothing and asks for a review of copyleft, bought and unknown
  licences in shipped components.
- Licence check (GET /api/v1/licenses/check) and a verdict on every SBOM row;
  scans turn forbidden and ended licences into findings and list what waits
  for a review in one finding per target.
- Legal review: LEGAL (also IT_ADMIN and support) approves or rejects a
  component's licence (POST/DELETE /api/v1/licenses/review); an approval
  resolves a review, never a ban. Saving the licence again drops the review.
  The role gate lets LEGAL write on the policy and review routes only.
- Third-party notices (GET /api/v1/sbom/notices, text or markdown), in the
  evidence pack with license-check.json.
- MCP: license_check and get_third_party_notices; get_sbom and
  list_sbom_packages now carry the confirmed licences.
- Dashboard: licence check card with approve/reject (single and bulk), the
  policy dialog, the notices download and policy/review badges in the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang added 1 commit 2026-10-15 13:58:57 +00:00
docs(sbom): licence policy, legal review and third-party notices; dashboard closure fixes
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 3m41s
dc07d207f5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang added 1 commit 2026-10-15 14:03:36 +00:00
fix(dashboard): drop an unneeded mut
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 7m20s
0d99f98ad3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang added 1 commit 2026-10-15 14:11:45 +00:00
test(role_gate): list the notices route without its query
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 9m23s
67fc800b4d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit 41c337138d into main 2026-10-15 14:35:44 +00:00
sharang deleted branch feat/licence-v2 2026-10-15 14:35:45 +00:00
Sign in to join this conversation.