-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(codec): Configure max request message size #1274
feat(codec): Configure max request message size #1274
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome! Really great work, I think I would like to see one integration test as well that shows that we can produce this error and then continue to make normal requests etc. I think once we have that we should be good, I would also try to think about where we could document this that would be helpful.
Hi @aoudiamoncef, I have an issue with tonic-build client, I added the two parameters to the client config, but I got an error when I tried to add it in the generator side. I haven't any issue in the server side. |
@aoudiamoncef commented I think those two lines in the client.rs of tonic-build need to just remove the |
I tired a couple of things without success. It's strange, as we have similar code above |
@aoudiamoncef I think you need to call the fn on |
Ohhhhh yeah, copy and past is evil, my brain is fucked |
All good xD |
Are you interested by
|
I was fucked by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the docs should state the default value beyond that everything looks pretty good. Left a few comments.
Also you will need to rebase your branch and run |
I wrote some instructions here https://github.com/hyperium/tonic/blob/master/CONTRIBUTING.md#generated-code |
e4ccacb
to
af05770
Compare
af05770
to
b5adfd5
Compare
@LucioFranco, I corrected all the typos, tests passes locally and I tested the new feature in my projet with success 💯 |
The CI is green https://github.com/hyperium/tonic/actions/runs/4198616103 I just rebased from master to include the changes in the contributing file. |
hi @LucioFranco, sorry for bother you in a merged PR, here's I want to ask a short but essential question. I want to know does this change have any document or explain about how I can configure when I create an tonic grpc client? |
I'll try to write an example to show the usage of this feature |
This PR adds new defaults for both client and server max encoding/decoding message size limits. By default, the max message decoding size is `4MB` and the max message encoding size is `usize::MAX`. This is follow up work from #1274 BREAKING: Default max message encoding/decoding limits
* feat(core): Default encoding/decoding limits This PR adds new defaults for both client and server max encoding/decoding message size limits. By default, the max message decoding size is `4MB` and the max message encoding size is `usize::MAX`. This is follow up work from #1274 BREAKING: Default max message encoding/decoding limits * update generated code
Motivation
In gRPC specs, by default there is a limit for the length of messages(4MB). Actually, Tonic Codec doesn't set a limit which could cause security concerns. If an attacker decides to send us heavy messages, It'll be decoded and could fill all available RAM.
See #1097
Solution
Support changing the max message size via a configuration. Set the limit to 4MB by default.
resolves #1097