feat(sbom): npm and Maven licenses from their public registries (#467 follow-up)
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 9m16s

Lockfiles name versions, not licenses; npm and Maven/Gradle components
stayed without one. On the pattern of the NuGet lookup (#467):

- sbom/registry_license.rs: npm from registry.npmjs.org/<name>/<version>
  (license as an expression, {type}, or the older licenses list, "SEE
  LICENSE IN" → LicenseRef-file); Maven from the POM on Maven Central, or
  on Google's Maven repository for androidx./com.google.android./
  com.android. groups, following up to three parent POMs; common license
  names mapped to SPDX ids, else the URL's meaning, else the name.
- Only names and versions leave, through the guarded client (the NuGet
  HttpFetch), bounded like NuGet's and cached across tenants with the
  NuGet licenses (keys npm:<name>, maven:<group>:<artifact>).
- Never a name a private registry may serve: .npmrc/.yarnrc.yml default
  registry elsewhere stops npm, a scope routed elsewhere stops that
  scope; a Maven or Gradle build naming a repository besides the public
  ones stops every Maven lookup.
- REGISTRY_LICENSE_LOOKUP=false turns it off.
- Tests: fake registries (npm plain and scoped, Maven via a parent POM,
  unknown package), private scope and repository sending nothing, license
  shapes, repository parsing; an ignored test against the real registries
  (lodash, @babel/core, okhttp via parent, androidx.core via Google, gson)
  passes with every license found.
- Docs (sbom guide, tools incl. egress); staging test plan: check 17.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-10-06 11:07:37 +02:00
1 parent d7ab09f634
commit 13cb98c07f
7 files changed
+833 -6

No files matched your search

@@ -17,6 +17,7 @@ together on stage in one pass before the next prod promotion.
| #486 | The clone cache heals itself after an interrupted clone or fetch |
| #465 | Malware stage (ClamAV), committed binaries, unchanged scheduled rescans skipped |
| #461 | Transitive NuGet packages of `<PackageReference>` projects resolved from nuget.org |
| #467 (follow-up) | npm and Maven licenses from their public registries |
**Customer-visible on the next prod rescan** is marked **[visible]**: these
change what a customer sees on their existing targets, without them doing
@@ -288,6 +289,22 @@ Unchanged rescans:
transitive packages (and their CVEs) in the SBOM, and the "Nicht
ausgeführt" list shrinks to one entry. On stage now.
### 17. #467 follow-up: npm and Maven licenses
- **Do:** scan `fixtures/nightly/js-npm-lock-v3` and
`fixtures/nightly/mobile/android-gradle-lock` (or any npm and Gradle
target); then add an `.npmrc` with `@corp:registry=https://npm.corp.example.com/`
and a `maven { url 'https://nexus.corp.example.com/repo' }` repository to a
copy and scan that.
- **Expect:** **Lizenzen** shows MIT, Apache-2.0 … for the npm and Maven
components (okhttp's comes from its parent POM, AndroidX from Google's
repository). In the copy, `@corp/*` and every Maven component stay without
a license; nothing about them leaves the agent.
- **Log:** only when something is missing: `npm/Maven license lookup
incomplete`; with the private Maven repository: `Maven licenses not looked up`.
- **[visible]** npm and Maven components gain licenses in the SBOM and the
**Lizenzen** tab (and copyleft warnings where they apply).
## After the pass
- The nightly job on `main` is green with the new mobile targets.