fix 502 on invalid limit params in tx query endpoints#24
Open
fix 502 on invalid limit params in tx query endpoints#24
Conversation
/api/upow/seed: max 10 req/min per IP /api/upow/seed_with_matrix_a_b: max 2 req/min per IP (16MB response) Returns HTTP 429 when limit exceeded. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace :erlang.binary_to_integer with Integer.parse in tx_events_by_account and tx_by_filter handlers so invalid or negative limit/offset values return 400 instead of crashing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
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
GET /api/chain/tx_events_by_account/andGET /api/chain/tx_by_filterwere calling:erlang.binary_to_integeron user-supplied query params without validationbadargexception that crashed the handler process → 502 responseFix
Replaced
:erlang.binary_to_integerwithInteger.parse/1and added guards (>= 0) on both endpoints. Invalid or negativelimit/offsetnow return400 {error: "invalid_parameters"}.Test plan
GET /api/chain/tx_events_by_account/<addr>?limit=abc→ 400GET /api/chain/tx_events_by_account/<addr>?limit=-1→ 400GET /api/chain/tx_events_by_account/<addr>?offset=-5→ 400GET /api/chain/tx_by_filter?limit=abc→ 400GET /api/chain/tx_by_filter?limit=-1→ 400🤖 Generated with Claude Code