-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: Improve input size validation for large HTTP JSON requests #8432
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
fix: Improve input size validation for large HTTP JSON requests #8432
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.
Pull Request Overview
This PR fixes a server crash issue by adding input size validation for large HTTP JSON requests. The change prevents std::length_error exceptions by checking the JSON payload size against the configured --http-max-input-size limit before processing.
- Added validation check in
EVBufferToJsonfunction to compare incoming JSON size against the maximum allowed size - Updated test cases to verify the new error handling behavior
- Added new test case specifically for large string payloads in JSON requests
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/http_server.cc | Added size validation check with descriptive error message |
| qa/L0_http/test.sh | Added test execution for large string in JSON scenario |
| qa/L0_http/http_test.py | Updated error message assertions to match new validation |
| qa/L0_http/http_input_size_limit_test.py | Added new test case and debug logging for large string payloads |
| qa/L0_cuda_shared_memory/cuda_shared_memory_test.py | Updated error message assertions to match new validation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
LGTM and Matt already commented on everything that I noticed 👍 |
yinggeh
left a comment
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.
LGTM
mattwittwer
left a comment
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.
LGTM
What does the PR do?
This change addresses an issue where an excessively large HTTP JSON payload could cause an unhandled
std::length_errorexception and terminate the server unexpectedly.A validation check is now performed in the
EVBufferToJsonfunction. It compares the incoming JSON data size against the configured--http-max-input-size limit. Requests that exceed this limit are now gracefully rejected.--http-max-input-sizelimit.Checklist
<commit_type>: <Title>Commit Type:
Check the conventional commit type
box here and add the label to the github PR.
Related PRs:
Where should the reviewer start?
Test plan:
Caveats:
Background
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)