Bug 16105 - NPM fetcher is insecure
Summary: NPM fetcher is insecure
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 6.99
Assignee: Thomas Perrot
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks: 15551 15607
  Show dependency tree
 
Reported: 2025-12-17 16:35 UTC by Paul Barker
Modified: 2026-09-29 08:19 UTC (History)
10 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Barker 2025-12-17 16:35:30 UTC
The NPM fetcher is being disabled as it is insecure. To re-enable this, we need the security issues to be resolved *AND* tests to be added.

The NPM fetcher gets the checksum for each source from the remote registry. This contradicts our usual policy of storing checksums in the recipe so that we can ensure that the remote file has not been altered. If the remote is in charge of both the checksum and the source contents, we can't detect tampering from a compromised NPM registry.
Comment 1 Randy MacLeod 2025-12-18 15:52:23 UTC
Richard to disable for M1.
Then lower to medium, 60 priority and unassigned.
We need help from npm users here.
Comment 2 Paul Barker 2026-01-07 14:39:14 UTC
If we need something to test with, there are recipes on the master branch of meta-luneos (https://layers.openembedded.org/layerindex/branch/master/layer/meta-luneos/) which use npm:// and npmsw:// SRC_URIs.
Comment 3 Richard Purdie 2026-01-23 12:01:07 UTC
NPM fetcher has been disabled:

https://git.openembedded.org/bitbake/commit/?id=355cd226e0720a9ed7683bb01c8c0a58eee03664

Reclassifiy the bug as a medium+ unassigned as a result.
Comment 4 Walter Werner Schneider 2026-02-16 17:28:31 UTC
There are multiple package managers for JS that can use the same registries, I'm thinking that there's some sort of standard API, I'll look it up and see what other fetches do and I'll try to implement something.

Not sure what npmsw does, but the npm fetcher doesn't even lock direct dependencies, meaning that you will end up with different dependencies once those dependencies have new releases.
Comment 5 Thomas Perrot 2026-06-05 11:03:16 UTC
Hello,

I propose to discard any checksum obtained from the registry and instead require the recipe author to supply the checksum directly in SRC_URI (sha512sum=, sha256sum=).
The .resolved cache file would then store only the bare tarball URL.

Kind regard,
Thomas
Comment 6 Thomas Perrot 2026-06-30 12:41:35 UTC
I submitted a patch series:
https://lore.kernel.org/all/20260616-dev-tprrt-fix-npm-v1-0-6fde95bf0a8b@bootlin.com/
Comment 8 Paul Barker 2026-09-29 08:19:37 UTC
This has been resolved by the commits Mathieu linked to above. Further hardening of the npm fetcher is likely possible but that's a job for another bug.