-
Notifications
You must be signed in to change notification settings - Fork 180
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
CBOR Encoding is compatible with stricter network decode mode #6879
CBOR Encoding is compatible with stricter network decode mode #6879
Conversation
this is failing a few tests, where we encode then decode. The decoded version has all empty ChunkBody fields
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/efm-recovery #6879 +/- ##
========================================================
+ Coverage 41.12% 41.13% +0.01%
========================================================
Files 2123 2123
Lines 187163 187163
========================================================
+ Hits 76968 76993 +25
+ Misses 103745 103723 -22
+ Partials 6450 6447 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
If it's not too much trouble, I would be great if you take a brief look at the Based on my understanding of the code, the
I haven't scanned through the code entirely and properly analyzed every usage, but based on a preliminary investigation, I think we may have major vulnerabilities for a resource exhaustion attacks in our code base 😱. I created this issue for further investigation by the execution team 👉 #6899 . Thanks |
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.
Thank you for the great work. While reviewing it, I got very worried about possibly non-BFT usages of the encoder-decoder definitions. Based on my experience, this is not very surprising to me, because too many engineers on the team are content with their code working on the happy path and don't inspect lower layers of the code to confirm that their usage of the code is in fact BFT.
It sucks, but I think the only way to address this problem is to make it unambiguously clear on all levels of the code when some components or structs are not BFT. While my suggestions are not a complete solution, it would be great to call out all non-BFT aspects in the portions of the code that we are touching ... and thereby increase the chances that engineers will randomly come across those callouts.
Sorry that those change requests are now popping up as part of your PR. 😅 I tried to be pragmatic and limit my requests to lightweight changes. Please don't hesitate to call out any instances, where you think my change requests are beyond the scope of this PR or you disagree with my suggestion. Appreciate your help in this regard, thanks 🙇
Co-authored-by: Alexander Hentschel <alex.hentschel@flowfoundation.org>
…low/flow-go into jord/chunk-srv-evt-count-cbor-encode
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.
Looks good. I would take this a step further and leave a global variable/constructor only for SAFE decoder/encoder. Everything unsafe should be a specific case where caller understands what he is doing and creates an instance on its own. Not sure that is practical though.
This PR modifies CBOR encoding of
flow.Chunk
to make it compatible with the stricter decoding rules used for the networking layer codec. It also moves the definition of the networking layer's decode mode into the same file where other encoding modes are defined.