Skip to content

fix: replace vulnerable image-size with image-size-next (CVE-2025-71329/71330) - #1852

Closed
lcf2212dev wants to merge 1 commit into
react:mainfrom
lcf2212dev:fix/image-size-next-cve
Closed

fix: replace vulnerable image-size with image-size-next (CVE-2025-71329/71330)#1852
lcf2212dev wants to merge 1 commit into
react:mainfrom
lcf2212dev:fix/image-size-next-cve

Conversation

@lcf2212dev

Copy link
Copy Markdown

Summary

Metro depends on image-size@^1.0.2, used in Assets.js to read image dimensions. Upstream image-size is 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 / imageSize export used as getImageSize(buffer)).

npm https://www.npmjs.com/package/image-size-next
GitHub https://github.com/lcf2212dev/image-size-next
Related RN resolution PR react/react-native#57894

Not affiliated with the original image-size maintainer.

Code changes

  • packages/metro/package.jsonimage-sizeimage-size-next@2.1.0
  • packages/metro/src/Assets.js — import from image-size-next
  • packages/metro/src/__tests__/Assets-test.js — jest mock path
  • yarn.lock — lock entry for image-size-next@2.1.0

Test plan

  • yarn install in monorepo
  • Run Metro asset tests: package metro / Assets-test.js
  • Smoke: resolve dimensions for png/jpg asset via getAssetSize
  • Confirm no remaining require('image-size') / from 'image-size' in packages/metro

Note

A monorepo-level Yarn resolution was also proposed on React Native (#57894) as a temporary shield for nested installs. Landing the dependency change here is the durable fix for all Metro consumers.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 11, 2026
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).
@lcf2212dev
lcf2212dev force-pushed the fix/image-size-next-cve branch from 5098c65 to 2d87737 Compare August 11, 2026 03:00
@lcf2212dev

Copy link
Copy Markdown
Author

Closing in favor of a new PR with a properly signed commit (no force-push on this branch).

@lcf2212dev lcf2212dev closed this Aug 11, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant