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
I'm working on securing gRPC communications between Java applications by encrypting payloads at the application level. On the client side, I was able to implement this cleanly using a ClientInterceptor that replaces the marshallers with custom ones that handle encryption and decryption.
However, on the server side, I’ve found that ServerInterceptor and ServerCallHandler don't allow replacing the MethodDescriptor or its marshallers dynamically. Since the marshaller is used before the interceptor runs, it’s not possible to decrypt the payload based on request-specific metadata — such as a sessionId passed in the headers.
The only workaround I’ve found is to use a wrapper protobuf message (e.g., EncryptedRequest) and manually decrypt the payload inside the service logic. While this works, it mixes transport-level concerns with business logic and reduces maintainability.
Is there currently a way to dynamically replace or configure marshallers per request on the server side?