fix(explorer): fetch_batch_data_pointer in explorer reads the entire response body without any limitation#1198
Merged
Conversation
uri-99
approved these changes
Oct 9, 2024
uri-99
reviewed
Oct 9, 2024
uri-99
suggested changes
Oct 9, 2024
Contributor
uri-99
left a comment
There was a problem hiding this comment.
It would be best to have another state for the batch.
For this a new ecto migrate is needed, adding an is_valid bool to the batches table.
Also the schemas should be updated, and the value should be set to false if the batch is not valid.
Also in the frontend, invalid proofs should be shown a red invalid status.
| {:error, reason} -> | ||
| Logger.error("Error fetching batch content: #{inspect(reason)}") | ||
| # Returning something ensures we avoid attempting to fetch the invalid data again. | ||
| ["invalid batch"] |
Contributor
There was a problem hiding this comment.
This string is converted to hex in frontend, better handle invalids in a cleaner way
Contributor
Author
There was a problem hiding this comment.
Changed to [<<0>>] to show 0x0 in the frontend for now. I'm solving this in a different PR in case we need to merge this one.
entropidelic
reviewed
Oct 9, 2024
entropidelic
reviewed
Oct 9, 2024
Co-authored-by: Urix <43704209+uri-99@users.noreply.github.com>
uri-99
approved these changes
Oct 14, 2024
entropidelic
approved these changes
Oct 14, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The function
fetch_batch_data_pointerin the explorer reads the entire response body without anylimitations, which can lead to an OOM attack.
Description
Uses a
max_batch_sizelimit when reading request bodies.How to Test
See #1202
Closes #1016