Follow-up to #467, requested by the platform session. Stage only.
Problem
Lockfiles name versions, not licences, so npm and Maven/Gradle components stayed without one. This adds a lookup on the same pattern as the NuGet one (sbom/nuget_license.rs), in sbom/registry_license.rs.
What it looks up
npm:registry.npmjs.org/<name>/<version>. Reads license (an expression or {type}) or the older licenses list; "SEE LICENSE IN" becomes LicenseRef-file.
Maven/Gradle: the POM on Maven Central, or on Google's Maven repository for androidx., com.google.android. and com.android..
A POM without <licenses> inherits its parent's; up to 3 levels are followed.
Common names map to SPDX ids (Apache-2.0, MIT, BSD-3/2-Clause, EPL-1.0/2.0, MPL-2.0); otherwise the URL's meaning, otherwise the name as written.
Egress
Only names and versions leave, through the guarded client (the NuGet HttpFetch).
Bounds: 8 at once, 10 s per request, 60 s and 300 uncached lookups per scan.
Cache: shared across tenants with the NuGet licences (keys npm:<name>, maven:<group>:<artifact>).
Nothing a private registry may serve is sent:
.npmrc/.yarnrc.yml default registry elsewhere → no npm lookups;
a scope routed elsewhere → none for that scope;
a Maven or Gradle build naming a repository besides the public ones → no Maven lookups at all, since nothing says which groups the private one serves.
Switch:REGISTRY_LICENSE_LOOKUP=false.
Tests
Fake registries: npm plain and scoped, Maven via a parent POM, unknown package stays empty.
A private scope and a private repository send nothing: only react is asked about.
Licence shapes and repository parsing.
Against the real registries (#[ignore]): lodash 4.17.20 → MIT, @babel/core → MIT, okhttp 3.12.0 → Apache-2.0 via its parent POM, androidx.core → Apache-2.0 via Google, gson → Apache-2.0.
fmt and clippy -D warnings. Agent lib: 708 tests. The nightly baselines record no licences, so they're unchanged.
To check on stage
Check 17 in docs/release/staging-test-plan-after-v0.4.5.md:
npm and Gradle targets show licences in the Lizenzen tab;
a copy with a private scope or repository shows none for those components.
Follow-up to #467, requested by the platform session. Stage only.
## Problem
Lockfiles name versions, not licences, so npm and Maven/Gradle components stayed without one. This adds a lookup on the same pattern as the NuGet one (`sbom/nuget_license.rs`), in `sbom/registry_license.rs`.
## What it looks up
- **npm:** `registry.npmjs.org/<name>/<version>`. Reads `license` (an expression or `{type}`) or the older `licenses` list; "SEE LICENSE IN" becomes `LicenseRef-file`.
- **Maven/Gradle:** the POM on **Maven Central**, or on **Google's Maven repository** for `androidx.`, `com.google.android.` and `com.android.`.
- A POM without `<licenses>` inherits its **parent's**; up to 3 levels are followed.
- Common names map to SPDX ids (Apache-2.0, MIT, BSD-3/2-Clause, EPL-1.0/2.0, MPL-2.0); otherwise the URL's meaning, otherwise the name as written.
## Egress
- Only names and versions leave, through the **guarded client** (the NuGet `HttpFetch`).
- **Bounds:** 8 at once, 10 s per request, 60 s and 300 uncached lookups per scan.
- **Cache:** shared across tenants with the NuGet licences (keys `npm:<name>`, `maven:<group>:<artifact>`).
- **Nothing a private registry may serve is sent:**
- `.npmrc`/`.yarnrc.yml` default registry elsewhere → no npm lookups;
- a scope routed elsewhere → none for that scope;
- a Maven or Gradle build naming a repository besides the public ones → no Maven lookups at all, since nothing says which groups the private one serves.
- **Switch:** `REGISTRY_LICENSE_LOOKUP=false`.
## Tests
- Fake registries: npm plain and scoped, Maven via a parent POM, unknown package stays empty.
- A private scope and a private repository send nothing: only `react` is asked about.
- Licence shapes and repository parsing.
- **Against the real registries** (`#[ignore]`): lodash 4.17.20 → MIT, @babel/core → MIT, okhttp 3.12.0 → Apache-2.0 via its parent POM, androidx.core → Apache-2.0 via Google, gson → Apache-2.0.
- fmt and clippy `-D warnings`. Agent lib: 708 tests. The nightly baselines record no licences, so they're unchanged.
## To check on stage
Check 17 in `docs/release/staging-test-plan-after-v0.4.5.md`:
- npm and Gradle targets show licences in the **Lizenzen** tab;
- a copy with a private scope or repository shows none for those components.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
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
sharang
merged commit bdf7fa4268 into main2026-10-06 09:17:32 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Follow-up to #467, requested by the platform session. Stage only.
Problem
Lockfiles name versions, not licences, so npm and Maven/Gradle components stayed without one. This adds a lookup on the same pattern as the NuGet one (
sbom/nuget_license.rs), insbom/registry_license.rs.What it looks up
registry.npmjs.org/<name>/<version>. Readslicense(an expression or{type}) or the olderlicenseslist; "SEE LICENSE IN" becomesLicenseRef-file.androidx.,com.google.android.andcom.android..<licenses>inherits its parent's; up to 3 levels are followed.Egress
HttpFetch).npm:<name>,maven:<group>:<artifact>)..npmrc/.yarnrc.ymldefault registry elsewhere → no npm lookups;REGISTRY_LICENSE_LOOKUP=false.Tests
reactis asked about.#[ignore]): lodash 4.17.20 → MIT, @babel/core → MIT, okhttp 3.12.0 → Apache-2.0 via its parent POM, androidx.core → Apache-2.0 via Google, gson → Apache-2.0.-D warnings. Agent lib: 708 tests. The nightly baselines record no licences, so they're unchanged.To check on stage
Check 17 in
docs/release/staging-test-plan-after-v0.4.5.md:🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p