Conversation
…unsafe values in post messages
🦋 Changeset detectedLatest commit: 05b98a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 45 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05b98a1e11
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!(value instanceof Object)) { | ||
| return NON_SERIALIZABLE_PLACEHOLDER; |
There was a problem hiding this comment.
Treat null-prototype records as serializable objects
The instanceof Object guard rejects Object.create(null) values before they reach the object-walk logic, so they are replaced with [unserializable] instead of being traversed. Webpack/module-federation metadata commonly uses null-prototype dictionaries, so this can drop large parts of moduleInfo/share payloads after this change.
Useful? React with 👍 / 👎.
| if (ArrayBuffer.isView(value)) { | ||
| return Array.from(new Uint8Array(value.buffer)); |
There was a problem hiding this comment.
Serialize typed-array views with offset and length
For ArrayBuffer views, converting value.buffer serializes the full backing buffer and ignores byteOffset/byteLength. When the payload contains a subarray or DataView, this forwards extra bytes (possibly unrelated data) and produces incorrect message content.
Useful? React with 👍 / 👎.
| if (value instanceof Date) { | ||
| return value.toISOString(); |
There was a problem hiding this comment.
Handle invalid Date objects without throwing
toISOString() throws on invalid dates (for example new Date(NaN)), and this call is unconditional. In array/map/set/root paths that exception is not caught, so a single invalid Date can still crash sanitization and prevent postMessage forwarding, which defeats the purpose of this safety layer.
Useful? React with 👍 / 👎.
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/data-prefetch
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
Bundle Size Report10 package(s) changed, 30 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 6.33 MB (+8.2 kB (+0.1%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
…nsafe values in post messages (module-federation#4600)
Description
implement sanitizePostMessagePayload to handle unsafe values in post messages
Related Issue
Types of changes
Checklist