feat(sbom): npm and Maven licenses from their public registries (#467 follow-up) (#490)
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy Dashboard (push) Skipped
CI / Deploy MCP (push) Skipped
CI / Deploy Docs (push) Successful in 1m8s
CI / Deploy Agent (push) Successful in 4m47s

This commit was merged in pull request #490.
This commit is contained in:
sharang committed 2026-10-06 09:17:32 +00:00
1 parent d7ab09f634
commit bdf7fa4268
7 files changed
+833 -6

No files matched your search

+11
View File
@@ -127,6 +127,17 @@ database, the severity where known, and **Hinweis ansehen →** (View advisory).
The **Lizenzen** tab summarises the licenses.
Lockfiles name versions, not licenses. Where the tree does not carry them,
they are looked up on the public registry of the package: nuget.org for
NuGet, `registry.npmjs.org` for npm, and Maven Central (or Google's Maven
repository for AndroidX and Play services) for Maven and Gradle, where a
POM without a license inherits its parent's. Only package names and versions
are sent, and none a private registry may serve: an `.npmrc` or `.yarnrc.yml`
that points elsewhere (for all packages or a scope), a `nuget.config` routing,
or a Maven or Gradle build that names a repository besides the public ones
stops those lookups. A component whose license could not be found stays
without one.
### Copyleft Warnings
If any component uses a copyleft license (GPL, AGPL, LGPL, MPL and their
+6
View File
@@ -138,6 +138,10 @@ Only package URLs (purl), CVE ids and CPE product prefixes are sent. Both source
Licenses of NuGet packages that no `.nuspec` in the tree gives are read from the [nuget.org registration API](https://learn.microsoft.com/nuget/api/registration-base-url-resource) (`api.nuget.org`). Only the package id and version are sent, never for an id a `nuget.config` routes to another feed (see [.NET projects](/guide/dotnet-en)). The lookup is bounded per scan (8 requests at once, 10 s per request, 60 s and 300 uncached packages in total); answers are cached for all tenants. Set `NUGET_LICENSE_LOOKUP=false` to keep the agent from contacting nuget.org.
## npm and Maven -- Licenses
Licenses of npm packages come from their version document on `registry.npmjs.org` (`license`, or the older `licenses` list), those of Maven and Gradle dependencies from their POM on Maven Central or, for AndroidX and Google Play services, Google's Maven repository; a POM without `<licenses>` inherits its parent's (followed up to three levels). Only names and versions are sent, never for a scope or registry the tree's `.npmrc`/`.yarnrc.yml` routes elsewhere, and no Maven name at all when a build names a repository besides the public ones. Bounded and cached like the NuGet lookup; `REGISTRY_LICENSE_LOOKUP=false` turns it off.
## ClamAV -- Malware
[ClamAV](https://www.clamav.net/) (GPL-2.0, the official image unchanged) runs
@@ -245,6 +249,8 @@ Every connection the agent opens, in one place. **Guarded** means: the HTTP clie
| `api.osv.dev` (`/v1/querybatch`, `/v1/vulns/{id}`) | purls of SBOM components, advisory ids | `pipeline/cve.rs` | guarded | 10 s per request, 5 s connect, body ≤ 16 MiB, 8 advisory reads at once | none (CVE stage) |
| `services.nvd.nist.gov` (`/rest/json/cves/2.0`) | CVE ids (CVSS score), CPE product prefixes (CODESYS, embedded libraries) | `pipeline/cve.rs`, `pipeline/nvd_cpe.rs` | guarded | 30 s per request, 5 s connect, body ≤ 16 MiB, 3 retries after 6/12/24 s, answers cached 6 h | `NVD_API_KEY` (optional, raises NVD's rate limit) |
| `api.nuget.org` (registration, catalog) | NuGet package ids and versions, not for ids a `nuget.config` routes to another feed | `pipeline/sbom/nuget_license.rs` | guarded | 10 s per request, 5 s connect, body ≤ 2 MiB, 8 at once, 60 s and 300 uncached packages per scan | `NUGET_LICENSE_LOOKUP=false` |
| `registry.npmjs.org` | npm package names and versions, not for a registry or scope `.npmrc`/`.yarnrc.yml` routes elsewhere | `pipeline/sbom/registry_license.rs` | guarded | as nuget.org (bounds per scan; answers cached for all tenants) | `REGISTRY_LICENSE_LOOKUP=false` |
| `repo1.maven.org`, `dl.google.com` (POMs) | Maven group, artifact and version (and parent POMs), not when the build names a non-public repository | `pipeline/sbom/registry_license.rs` | guarded | as nuget.org | `REGISTRY_LICENSE_LOOKUP=false` |
| Package registries (Go proxy, npm, PyPI, Maven Central) | package names and versions | Syft (`pipeline/sbom/syft.rs`, remote license lookups) and lockfile generation (`npm`, `cargo`, `pip-compile` in `pipeline/sbom/mod.rs`) | not guarded: subprocesses with their own HTTP | Syft 10 min per scan | lockfile generation follows the execution policy |
### Tenant-chosen addresses
@@ -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.