You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Flight] Enforce "simple object" rule in production (#27502)
We only allow plain objects that can be faithfully serialized and
deserialized through JSON to pass through the serialization boundary.
It's a bit too expensive to do all the possible checks in production so
we do most checks in DEV, so it's still possible to pass an object in
production by mistake. This is currently exaggerated by frameworks
because the logs on the server aren't visible enough. Even so, it's
possible to do a mistake without testing it in DEV or just testing a
conditional branch. That might have security implications if that object
wasn't supposed to be passed.
We can't rely on only checking if the prototype is `Object.prototype`
because that wouldn't work with cross-realm objects which is
unfortunate. However, if it isn't, we can check wether it has exactly
one prototype on the chain which would catch the common error of passing
a class instance.
Copy file name to clipboardExpand all lines: scripts/error-codes/codes.json
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -482,5 +482,7 @@
482
482
"494": "taintUniqueValue cannot taint objects or functions. Try taintObjectReference instead.",
483
483
"495": "Cannot taint a %s because the value is too general and not unique enough to block globally.",
484
484
"496": "Only objects or functions can be passed to taintObjectReference. Try taintUniqueValue instead.",
485
-
"497": "Only objects or functions can be passed to taintObjectReference."
485
+
"497": "Only objects or functions can be passed to taintObjectReference.",
486
+
"498": "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.",
487
+
"499": "Only plain objects, and a few built-ins, can be passed to Server Actions. Classes or null prototypes are not supported."
0 commit comments