Disable max WebSocket message size validation in CDP proxy (#39809)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39809

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: D49642047

fbshipit-source-id: 07b134c9fa6aba7ce2208f71981d6d862281395f
This commit is contained in:
Moti Zilberman 2023-10-04 11:57:43 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 4416de35f7
Коммит 2000acc6c6
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -176,6 +176,9 @@ export default class InspectorProxy implements InspectorProxyQueries {
const wss = new WS.Server({
noServer: true,
perMessageDeflate: true,
// Don't crash on exceptionally large messages - assume the device is
// well-behaved and the debugger is prepared to handle large messages.
maxPayload: 0,
});
// $FlowFixMe[value-as-type]
wss.on('connection', async (socket: WS, req) => {
@ -228,6 +231,9 @@ export default class InspectorProxy implements InspectorProxyQueries {
const wss = new WS.Server({
noServer: true,
perMessageDeflate: false,
// Don't crash on exceptionally large messages - assume the debugger is
// well-behaved and the device is prepared to handle large messages.
maxPayload: 0,
});
// $FlowFixMe[value-as-type]
wss.on('connection', async (socket: WS, req) => {