fix: replace vulnerable image-size with image-size-next (CVE-2025-71329/71330) - #1853
fix: replace vulnerable image-size with image-size-next (CVE-2025-71329/71330)#1853lcf2212dev wants to merge 1 commit into
Conversation
image-size is archived and still affected by CVE-2025-71329 / CVE-2025-71330 (DoS infinite loops). Switch Metro's direct dependency and Assets imports/tests to the community MIT drop-in image-size-next@2.1.0 (same public API).
This is incorrect. The GitHub repo is archived because the maintainer has recently moved the project to Codeberg. The npm distribution is not archived or deprecated. Aside from that, I’m very wary of accepting dependencies on new packages proposed by the creators of that package with no proven record of trust - that is a real security risk, whereas the CVEs are audit noise that don’t impact Metro users. |
Thanks for your attention, @robhogan . I tried that because in our banking app we use React Native with Re.pack for federation. Because of this, we have to manage hundreds of repositories within this project. Is there anything that can be done in metro to eliminate these security alerts from GitHub? |
Summary
Metro depends on
image-size@^1.0.2, used inAssets.jsto read image dimensions. Upstreamimage-sizeis archived and remains affected by:This PR switches the direct dependency and source/tests to the community MIT drop-in
image-size-next@2.1.0, which keeps the same public API (default/imageSizeexport used asgetImageSize(buffer)).Not affiliated with the original
image-sizemaintainer.Code changes
packages/metro/package.json—image-size→image-size-next@2.1.0packages/metro/src/Assets.js— import fromimage-size-nextpackages/metro/src/__tests__/Assets-test.js— jest mock pathyarn.lock— lock entry forimage-size-next@2.1.0Changelog: [Fix] Replace vulnerable archived
image-sizewith maintained drop-inimage-size-next@2.1.0(CVE-2025-71329 / CVE-2025-71330)Test plan
image-size-next@2.1.0exposes a default/imageSizeexport compatible withgetImageSize(buffer)as used inAssets.js.Assets-test.jsmocks toimage-size-next.Assets-test.js) + smoke resolving png/jpg asset dimensions viagetAssetSize.from 'image-size'/require('image-size')underpackages/metro.Note
A monorepo-level Yarn resolution was proposed on React Native (#57895) as a temporary shield for nested installs. Landing the dependency change here is the durable fix for all Metro consumers.
(Replaces closed PR #1852 — fresh branch with signed commit.)