connectrpc / connect-go

The Go implementation of Connect: Protobuf RPC that works.
https://connectrpc.com
Apache License 2.0
2.94k stars 96 forks source link

Restrict metadata headers in error propagation #711

Closed emcfarlane closed 6 months ago

emcfarlane commented 6 months ago

This PR addresses issues when propagating errors from a client back to a handler. On the client side connect errors will contain all response headers: transport (Content-Type, Content-Length, etc), protocol and application headers. These could break the transport when trying to re-encode the error or leak sensitive information between services. For any wire errors (errors decoded from a client response) we now disable meta propagation. For other errors we now also restrict the headers propagated.

akshayjshah commented 6 months ago

Haven't looked at the logic in depth, but we should explain this behavior in the docs (IsWireError, ConnectError.Meta, or both).