fix(sbom): npm registry policy per project, from nested .npmrc/.yarnrc.yml
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 11m37s

The npm private-registry policy read .npmrc and .yarnrc.yml only at the
archive root, so a monorepo project in a subfolder with its own
`@corp:registry=...` had its private-scope names looked up on
registry.npmjs.org. The policy of an npm package now comes from the files
next to the lockfile Syft read it from and every parent directory up to
the root: the nearest file names a scope's registry, and a non-public
default registry anywhere on the way stops every lookup for that project.
A package found in several projects is looked up only if all of them
take it from the public registry. The same policy gates the fallback
tarball URL in the SBOM's distribution references.

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-08 23:29:38 +02:00
1 parent e1bf9e861c
commit 595de73c4a
7 files changed
+321 -52

No files matched your search

+5 -2
View File
@@ -154,8 +154,11 @@ 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.
stops those lookups. In a monorepo each npm project has its own: the
`.npmrc`/`.yarnrc.yml` next to its lockfile and in every folder above it up
to the archive root count (the nearest one names a scope's registry; a
private default registry anywhere on the way stops every lookup for that
project). A component whose license could not be found stays without one.
### Copyleft Warnings
+1 -1
View File
@@ -256,7 +256,7 @@ Licenses of NuGet packages that no `.nuspec` in the tree gives, and the project
## npm and Maven -- Licenses
Licenses of npm packages come from their version document on `registry.npmjs.org` (`license`, or the older `licenses` list), with the project URL (`homepage`, else `repository`); those of Maven and Gradle dependencies, with the project URL (`<url>`, else `<scm><url>`), 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.
Licenses of npm packages come from their version document on `registry.npmjs.org` (`license`, or the older `licenses` list), with the project URL (`homepage`, else `repository`); those of Maven and Gradle dependencies, with the project URL (`<url>`, else `<scm><url>`), 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 `.npmrc`/`.yarnrc.yml` of the package's project (next to its lockfile or in a folder above it) 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