-
Notifications
You must be signed in to change notification settings - Fork 992
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
Do not parse block body before header has been validated #1642
Comments
I guess this was already been implemented. Lines 303 to 309 in 9c32321
|
Edit: Actually that is one scenario where header parsing would halt the block processing. The issue is more around how we pass a "full block" into |
I will then fix it |
Curretnly we have some lightweigt validation implemented as part of entity deserialization, which is safer and allows us to not parse the entire object if some part is invalid. At the same time this logic always applies when we read an entity, eg when reading from DB. This PR introduces UntrustedHeader/Block which is used when we read from the network. It does partial validation during read, then it is supposed to be converted into regular header/block which doesn't validate itself. Also this PR adds "lightweight" validation to block header read like we have for block body, so we don't parse block body if the header is invalid. Fixes mimblewimble#1642
Curretnly we have some lightweigt validation implemented as part of entity deserialization, which is safer and allows us to not parse the entire object if some part is invalid. At the same time this logic always applies when we read an entity, eg when reading from DB. This PR introduces UntrustedHeader/Block which is used when we read from the network. It does partial validation during read, then it is supposed to be converted into regular header/block which doesn't validate itself. Also this PR adds "lightweight" validation to block header read like we have for block body, so we don't parse block body if the header is invalid. Fixes mimblewimble#1642
* Verify headers and blocks only when needed Curretnly we have some lightweigt validation implemented as part of entity deserialization, which is safer and allows us to not parse the entire object if some part is invalid. At the same time this logic always applies when we read an entity, eg when reading from DB. This PR introduces UntrustedHeader/Block which is used when we read from the network. It does partial validation during read, then it is supposed to be converted into regular header/block which doesn't validate itself. Also this PR adds "lightweight" validation to block header read like we have for block body, so we don't parse block body if the header is invalid. Fixes #1642 * Move version validation to untrusted header * update fuzz tests
The current code and data structures read a full block all at once. This could make a short-lived (because banning would still be relatively quick) DDoS attack.
The text was updated successfully, but these errors were encountered: