chore: sync upstream v4.8.2 API/P2P hardening fixes#55
Merged
nileTestNet merged 5 commits intoJun 24, 2026
Merged
Conversation
Improve the hand-rolled JsonFormat parser used by HTTP wallet APIs so field-heavy and deeply nested JSON no longer overflows the request thread stack. mergeField now consumes one field per call and leaves comma iteration to the caller. JsonFormat also enforces Constant.MAX_NESTING_DEPTH for object/array descent and returns ParseException instead of allowing StackOverflowError to escape. Compatibility notes: direct JsonFormat.merge callers now reject nesting beyond 100 levels; trailing commas on known-field parse paths (top-level fields, known message fields, and known repeated fields) may be accepted, while trailing commas inside unknown nested object/array fields remain rejected; malicious deep-nesting requests now surface as parse errors instead of container-level HTTP 500s.
* fix(jsonrpc): enforce maxBlockRange on eth_getFilterLogs * style(jsonrpc): fix styles and comments
…#6851) Validate the inventory type at the inbound entry points and reject any value other than TRX or BLOCK with P2pException(BAD_MESSAGE), before the type is used for cache insertion or outbound fetch construction: - P2pEventHandlerImpl.checkInvRateLimit: add else branch for unknown type - InventoryMsgHandler.check: add type allowlist check - FetchInvDataMsgHandler.check: validate raw getInventoryType() instead of getInvMessageType() (which mapped non-BLOCK types to TRX) Use getTypeValue() when building the error message to avoid calling getNumber() on an UNRECOGNIZED enum value. Add regression tests for all three entry points. Co-authored-by: wb <wb@wbdeMacBook-Air.local>
9a449b2
into
tron-nile-testnet:release_v4.8.2_build2
23 of 27 checks passed
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
Syncs the Nile branch with the latest hardening fixes from upstream
tronprotocol/java-tron:release_v4.8.2. This brings in 5 commits focusedon API input validation, JSON-RPC limits, and P2P message safety — no
consensus or protocol behavior changes.
Changes
fix(net): reject unknown inventory type in P2P inv/fetch-inv handling (fix(net): reject unknown inventory type in P2P inv/fetch-inv handling tronprotocol/java-tron#6851)
Validates the inventory type in
InventoryMsgHandler/FetchInvDataMsgHandlerso malformed
inv/fetch-invmessages are rejected instead of processed.fix(api): tighten JSON parsing limits (fix(api): tighten json parsing limits tronprotocol/java-tron#6844)
Hardens
JsonFormatparsing with stricter limits to guard againstoversized / malformed request payloads.
fix(jsonrpc): enforce maxBlockRange on eth_getFilterLogs (fix(jsonrpc): enforce maxBlockRange on eth_getFilterLogs tronprotocol/java-tron#6842)
Applies the
maxBlockRangecap toeth_getFilterLogsviaLogFilterWrapper,preventing unbounded log range queries.
refactor(http): improve JsonFormat parser robustness (refactor(http): improve JsonFormat parser robustness tronprotocol/java-tron#6845)
Makes the HTTP
JsonFormatparser more robust against edge-case input.fix(api): hide Jetty internals in oversized request 413 response (fix(api): hide jetty internals in oversized request 413 response tronprotocol/java-tron#6843)
Adds
HttpServicehandling so 413 (request too large) responses no longerleak internal Jetty details.