grpc-web icon indicating copy to clipboard operation
grpc-web copied to clipboard

Errors in deserializeBinary causes uncaught exception

Open tlrobinson opened this issue 5 years ago • 1 comments

Versions of relevant software used

0.13.0

What happened

A corrupted gRPC response can lead to an uncaught exception, which will crash React Native applications.

It seems this happens because errors in deserializeBinary are not caught here: https://github.com/improbable-eng/grpc-web/blob/master/client/grpc-web/src/client.ts#L128

What you expected to happen

Errors in deserializeBinary should be caught and returned via rawOnError.

How to reproduce it (as minimally and precisely as possible):

The easiest way I found is to modify your generated code to throw an exception inside a deserializeBinaryFromReader method, for example. throw new Error() should be sufficient.

tlrobinson avatar Jan 05 '21 00:01 tlrobinson

I don't think we control the implementation of deserializeBinaryFromReader, I think that comes from the generated javascript produced by protoc. Do you think it would be appropriate for us to catch around the call itself?

johanbrandhorst avatar Jan 05 '21 10:01 johanbrandhorst