Skip to content

Commit d0f750e

Browse files
motiz88facebook-github-bot
authored andcommitted
Disable max WebSocket message size validation in CDP proxy (#39833)
Summary: Pull Request resolved: #39833 Reland of D49642047 which got reverted because of a CI infra error. --- It's currently possible for RN to crash the dev server by sending down an exceptionally large CDP response/event. Instead of making assumptions on the protocol spoken over the proxy, let's assume clients on either side of the proxy can be trusted to be well behaved (and to degrade gracefully when a large message is encountered). Changelog: [General][Fixed] JS debugging: prevent dev server crash when a large CDP payload is returned from the device Reviewed By: huntie Differential Revision: D49955025 fbshipit-source-id: aa5b8b55c885e26dd5b8170660603173cfe54de0
1 parent 9252099 commit d0f750e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/dev-middleware/src/inspector-proxy/InspectorProxy.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ export default class InspectorProxy implements InspectorProxyQueries {
176176
const wss = new WS.Server({
177177
noServer: true,
178178
perMessageDeflate: true,
179+
// Don't crash on exceptionally large messages - assume the device is
180+
// well-behaved and the debugger is prepared to handle large messages.
181+
maxPayload: 0,
179182
});
180183
// $FlowFixMe[value-as-type]
181184
wss.on('connection', async (socket: WS, req) => {
@@ -228,6 +231,9 @@ export default class InspectorProxy implements InspectorProxyQueries {
228231
const wss = new WS.Server({
229232
noServer: true,
230233
perMessageDeflate: false,
234+
// Don't crash on exceptionally large messages - assume the debugger is
235+
// well-behaved and the device is prepared to handle large messages.
236+
maxPayload: 0,
231237
});
232238
// $FlowFixMe[value-as-type]
233239
wss.on('connection', async (socket: WS, req) => {

0 commit comments

Comments
 (0)