New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: allow direct access to message binary #19321
Conversation
Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement. After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.
Regards, |
I haven't taken the time to fully digest the implications of this change yet, but I have two initial observations:
|
@gnossen the method has been added to the If any python devs know a way to get access to the gRPC message binary pre deserialization then that's my main requirement: the signing procedure being used requires direct access to those bytes. |
@adamkewley Would it be possible to accomplish your use case with a custom deserializer? |
@gnossen possibly, but the deserializers that are currently matched against each gRPC method are generated using |
Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement. After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.
Regards, |
So, for my purposes (signing/encrypting a gRPC message), I needed to mod in the latest push I made. Essentially, it required adding a |
I can't help but wonder if this use case wouldn't be better served by a complete set of client-side and server-side interceptors. The client-side support is already there, but server-side support is pending. |
Yes, something like that is pretty much exactly what's needed for this particular use-case. I wasn't sure what that type of feature would be called (the existing api already uses "interceptors"), so I missed this existing work. Thanks for pointing it out: I'll look into it. |
This issue/PR has been automatically marked as stale because it has not had any update (including commits, comments, labels, milestones, etc) for 180 days. It will be closed automatically if no further update occurs in 1 day. Thank you for your contributions! |
A gRPC-based project I'm working on requires signing requests (with RSA or HMAC). In our implementation, we concatenate the method name, relevant headers, and the message binary to create a digest (inspiration stole from this RFC draft). However, I couldn't find an easy way of accessing the message binary server-side (interceptors only give access to method + headers), so I had to hack this in.
I understand that this may not be suitable for streaming messages, etc. but I thought I'd contribute this PR to open a discussion on the idea. Overall, this change increases the lifetime of a message's binary buffer to be the same as the lifetime of the context, which will increase the overall (on-average) memory usage of a gRPC server because it gives the GC less to play with across the lifetime of one gRPC request.