fix(discord): bound server tool response reads - #55285
Closed
ooiuuii wants to merge 1 commit into
Closed
Conversation
tonydwb
reviewed
Jun 30, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Discord server tool response bounding for security.
Looks Good
- Caps success bodies with bounded read(limit + 1)
- Caps error bodies before building DiscordAPIError
- 36 lines of regression tests for oversized responses
- Security fix: prevents unbounded memory consumption from large API responses
Contributor
|
Thanks for the report and the fix — but this duplicates your own earlier PR #54747, which bounds the same reads in the same function ( #54747 has been salvaged onto current main via #60112 with your authorship preserved. Closing this one as the duplicate. Appreciate the thorough hardening work across these Discord surfaces! |
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.
Summary
tools.discord_tool._discord_request()success bodies with a boundedread(limit + 1)DiscordAPIErrorFixes #55284.
This is separate from #54747 and #55209: those cover the Discord platform adapter / standalone send paths, while this PR only covers the Discord server tool in
tools/discord_tool.py.Test plan
C:\Users\Administrator\Documents\Codex\2026-06-29\hermes-main-latest-scan\.venv\Scripts\python.exe -m pytest tests\tools\test_discord_tool.py -q --basetemp .pytest-tmp-discord-tool-capC:\Users\Administrator\Documents\Codex\2026-06-29\hermes-main-latest-scan\.venv\Scripts\python.exe -m ruff check tools\discord_tool.py tests\tools\test_discord_tool.pygit diff --check