Skip to content

[Flight Reply] Early bailout if backing entry for Blob deserialization is not a Blob#36055

Merged
eps1lon merged 2 commits intofacebook:mainfrom
eps1lon:sebbie/did
Mar 17, 2026
Merged

[Flight Reply] Early bailout if backing entry for Blob deserialization is not a Blob#36055
eps1lon merged 2 commits intofacebook:mainfrom
eps1lon:sebbie/did

Conversation

@eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Mar 17, 2026

Additional security hardening to bail out early for malformed Server Action payloads.

The $B (Blob) case in parseModelString returned whatever FormData.get() returned without validating its type. Since FormData.get() returns either a string or a File/Blob, an attacker could store a large string in a FormData slot and reference it via $B, bypassing the bumpArrayCount size guard that applies to regular string values. However, this does not lead to a real attack vector because it doesn't produce amplification. For that, it would need to be combined with regular references in nested arrays, which are covered by the array counting mitigation.

As a defense-in-depth mitigation, this adds an instanceof Blob check that rejects non-Blob backing entries. Bumping the array count for Blob size is not necessary because real Blobs are opaque handles — they don't expand during common operations like JSON.stringify (which produces {}), .flat(), or .toString(). The data only materializes through explicit reads like .text() or .arrayBuffer(), and since all references to the same $B ID resolve to the same object, there is no memory duplication.

@eps1lon eps1lon requested a review from unstubbable March 17, 2026 10:41
@meta-cla meta-cla bot added the CLA Signed label Mar 17, 2026
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Mar 17, 2026
@react-sizebot
Copy link

Comparing: c80a075...a46c5af

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 612.78 kB 612.78 kB = 108.29 kB 108.29 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 678.71 kB 678.71 kB = 119.25 kB 119.25 kB
facebook-www/ReactDOM-prod.classic.js = 697.76 kB 697.76 kB = 122.60 kB 122.60 kB
facebook-www/ReactDOM-prod.modern.js = 688.08 kB 688.08 kB = 120.98 kB 120.98 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against a46c5af

@eps1lon eps1lon marked this pull request as ready for review March 17, 2026 10:45
@eps1lon eps1lon merged commit 12ba7d8 into facebook:main Mar 17, 2026
245 checks passed
@eps1lon eps1lon deleted the sebbie/did branch March 17, 2026 10:50
@ericadalton124-stack
Copy link

ericadalton124-stack commented Mar 17, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants