Skip to content

Fix structuredClone WeakMap/WeakSet/Promise prototype mutations for H… - #60003

Open
leotm wants to merge 2 commits into
react:mainfrom
leotm:fix/structuredclone-prototype-mutation
Open

leotm wants to merge 2 commits into
react:mainfrom
leotm:fix/structuredclone-prototype-mutation

Conversation

@leotm

@leotm leotm commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Fix: #60002

This is the minimal fix, if preferred here or followup, can be refactored to preserve original style e.g.

const NON_SERIALIZABLE_PROTOTYPES: Array<interface {}> = [];

function isNonSerializableObject<T extends interface {}>(obj: T): boolean {
  let proto = Object.getPrototypeOf(obj);
  while (proto != null) {
    if (NON_SERIALIZABLE_PROTOTYPES.includes(proto)) return true;
    proto = Object.getPrototypeOf(proto);
  }
  return false;
}

function markClassAsNonSerializable<T>(cls: Class<T>): void {
  NON_SERIALIZABLE_PROTOTYPES.push(cls.prototype);
}

// Non-serializable built-ins.
markClassAsNonSerializable(WeakMap);
markClassAsNonSerializable(WeakSet);
markClassAsNonSerializable(Promise);

then naturally storing the Array instead as a Set or better WeakSet

Changelog:

[INTERNAL] [SECURITY] - Fix structuredClone WeakMap/WeakSet/Promise prototype mutations

Test Plan:

Added unit tests for WeakMap, WeakSet and Promise

@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 Nov 13, 2026
@leotm
leotm marked this pull request as ready for review November 13, 2026 19:17
leotm added a commit to leotm/react-native-template-new-architecture that referenced this pull request Nov 14, 2026
Upgrade react-native from 0.88.1 to 0.89.0-rc.0 (#2123)

Bump RN (rc) and RNCLI (alpha) deps and devDeps
- rncli react-native-community/template#235
  + @react-native/community-cli-plugin
  - @react-native-community/cli-platform-android
  - @react-native-community/cli-platform-ios

Remove deprecated Android React fabricEnabled arg (old arch now removed)
- react-native-community/template#248

Bump Android NDK 27c to 28c
- no runtime change
- dx: new ndk dl, fresh native compile
- react/react-native#56222
- react-native-community/template#256
- react/react-native#58650
- facebookincubator/fbjni#119
- meta/fresco#2866
- meta/hermes#2196
- react-native-community/docker-android#253
- https://github.com/android/ndk/wiki/Changelog-r27
  - .so 16 KB mem page size (opt-in)
    - Google Play: Android 15+ / API 35+ apps must support 16K by Feb 1 2027 (64bit devices)
  - AGP 8 (default)
  - clang 18
  - cmake 3.6.0+
- https://github.com/android/ndk/wiki/Changelog-r28
  - .so 16 KB mem page size (default)
  - AGP 9 (default)
  - clang 19
  - cmake 3.10.0+

Opt in iOS image asset catalog
- before: loose js images next to bundle
- after: compiled catalog (RNAssets.xcassets -> RNAssets.bundle/Assets.car)
  - like Images.xcassets -> Assets.car (app icon, native images/colors)
- react-native-community/template#247
- react/react-native#30129

Fix RN WebAPIs structured clone minimally via patch
- fix: #2124
- react/react-native#60002
  - react/react-native#60003

Regen CocoaPods lockfile

Bump Jest snapshot test rendered version

Bump ReadMe RN version

- https://github.com/react/react-native/releases/tag/v0.89.0-rc.0
- react/react-native@v0.88.1...v0.89.0-rc.1

This branch has not been deployed

No deployments
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WebAPIs] structuredClone: WeakMap/WeakSet/Promise prototype mutations break initial render under Hardened JS (SES)

1 participant