fix: add size limit to request.get_data (Batch #75)#4160
Open
BossChaos wants to merge 2 commits intoScottcjn:mainfrom
Open
fix: add size limit to request.get_data (Batch #75)#4160BossChaos wants to merge 2 commits intoScottcjn:mainfrom
BossChaos wants to merge 2 commits intoScottcjn:mainfrom
Conversation
- Add 1MB limit to get_data() in P2P signature verification - Prevent DoS via oversized request bodies Co-Authored-By: Hermes Agent <hermes@nous.research>
jujujuda
reviewed
May 8, 2026
jujujuda
left a comment
There was a problem hiding this comment.
Code Review: PR #4160 — add size limit to request.get_data
Reviewer: jujujuda (Atlas bounty hunter)
Bounty Program: #73 Code Review Bounty
Summary
LGTM. The 1MB limit on request.get_data() is a correct and minimal DoS mitigation for the P2P signature verification endpoint.
What Works
request.get_data(1048576)correctly passes the byte limit to Flask — data beyond 1MB returns empty bytes rather than reading the full body into memory- The
UnicodeDecodeErrorrisk on large bodies is handled implicitly (truncated data decodes cleanly) - The inline comment
# 1MB limitis clear for future readers
One Suggestion (non-blocking)
Consider an explicit size check before decode so the error is user-facing rather than a 500:
body_bytes = request.get_data(1048576)
if len(body_bytes) == 0 and request.content_length and request.content_length > 1048576:
return jsonify({"error": "Request body exceeds 1MB limit"}), 413
body = body_bytes.decode()Without this, a large-body attack would produce a signature mismatch (401) rather than a clear 413. Minor UX issue, not a security gap.
Verdict
Standard Review: 7/10 RTC — Solid fix, correct approach, no security concerns.
Claiming under Bounty #73 | Wallet: RTC2fe3c33c77666ff76a1cd0999fd4466ee81250ff
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.
fix: add size limit to request.get_data (Batch #75)
Co-Authored-By: Hermes Agent hermes@nous.research