You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
jsonrpc: add a batch size limit for RPC requests #2867
Our homemade RPC implementation, jsonrpc, allows users to invoke multiple RCP methods using a single request, using batching. While this is not a problem, it may constitute a form of attack vector.
By investigating the code, batching is implemented by this method:
// first try to unmarshal the incoming request as an array of RPC requests
Not sure if this is the only method implementing batched requests, but this one was identified by running a test client.
We should consider adding a configuration parameter to limit the size/length of batched RPC requests submitted to Comet. To preserve backwards compatibility, the default value for this parameter can be 0, meaning no limit.
Activity
cason commentedon Apr 22, 2024
This solution was adopted in a fork, using a hard-coded batch size limit:
https://github.com/sei-protocol/sei-tendermint/blob/5e8e9a2c60a3989e48b600cebe524c475d34bed4/rpc/jsonrpc/server/http_json_handler.go#L46-L50
ValarDragon commentedon Apr 22, 2024
I'm very supportive of doing this w/ a config option!
andynog commentedon Apr 24, 2024
I'll look into this and try to push a PR in the next couple of days
adding config parameter logic (#2867)
adding rpc batch size parameter to config template (#2867)
added info to the config manual (#2867)
implemented Middleware to check batch size (#2867)
adding changelog entry (#2867)
5 remaining items
improve test check error message (#2867)
reverting default value for max req batch size to 10 (#2867)
feat: add a configurable maximum batch size for RPC requests (#2939)
feat: add a configurable maximum batch size for RPC requests (#2939)
feat: add a configurable maximum batch size for RPC requests (#2939)
feat: add a configurable maximum batch size for RPC requests (backport …
remove comment about default value (#2867)
fix: remove comment about default value (#2867) (#3000)
fix: remove comment about default value (#2867) (#3000)
fix: remove comment about default value (#2867) (#3000)
fix: remove comment about default value (#2867) (backport #3000) (#3013)
fix: remove comment about default value (#2867) (backport #3000) (#3012)