Skip to content
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

[RPC] Enforce rate limiting #1161

Closed
666lcz opened this issue Mar 30, 2022 · 9 comments
Closed

[RPC] Enforce rate limiting #1161

666lcz opened this issue Mar 30, 2022 · 9 comments

Comments

@666lcz
Copy link
Contributor

666lcz commented Mar 30, 2022

Rate-limiting by IP address

@666lcz 666lcz changed the title [REST Server] Enforce rate limiting [Gateway] Enforce rate limiting Apr 18, 2022
@666lcz
Copy link
Contributor Author

666lcz commented Apr 18, 2022

@patrickkuo , would you like to take this one for the JSON-RPC server?

@gdanezis gdanezis added this to the DevNet milestone Apr 19, 2022
@666lcz 666lcz added the devx label Apr 20, 2022
@666lcz 666lcz assigned 666lcz and patrickkuo and unassigned 666lcz Apr 20, 2022
@666lcz
Copy link
Contributor Author

666lcz commented Apr 20, 2022

@patrickkuo , assigning this to you for now since you implement the RPC endpoint. We should implement the rate limiting as a middleware. Let me know if you are not the right owner

@patrickkuo
Copy link
Contributor

What's the priority of this issue? I can work on this after the OpenRPC doc and schema works.

@666lcz
Copy link
Contributor Author

666lcz commented Apr 20, 2022

I believe this one has a higher priority than the doc and schema, because we don't want the server to be overwhelmed by malicious attackers or a heavy application cc @todd-mystenlabs

@patrickkuo
Copy link
Contributor

jsonrpsee have build in resource limiting capability, can use this to enforce rate limiting very easily
https://github.com/paritytech/jsonrpsee/blob/20e6e5de40214e0b88e475d87bf14e465123eaba/core/src/server/resource_limiting.rs#L54-L86

@todd-mystenlabs
Copy link
Contributor

Talk to @bmwill / @mystenmark re: HAproxy.

Talk to @huitseeker re: application-layer rate limiting.

@mystenmark
Copy link
Contributor

For devnet, we need something very simple given the tight time frame. I suggest:

  • have some way to see where a DoS attack is coming from
  • have a script or well-documented method for adding the offending IP(s) to a firewall rule.

@patrickkuo
Copy link
Contributor

Do we want to build this into the JSON-RPC server?

Currently jsonrpsee only support very basic "resource limiting" functionality, it can limit number of concurrent requests but cannot enforce limit by IP, and the middleware api provided does not contain request header/ IP address (looks like they have plan to add it but there are no timeline).

Alternatively can we use something like AWS WAF?

@todd-mystenlabs
Copy link
Contributor

I think long-term we want something intelligent that the network can use that would help any operator. Short-term (for devnet launch), we have a few options that will apply to our own running node: (1) we can put HAproxy in front of this (@bmwill / @mystenmark); and (2) we may have additional protection via external means.

@666lcz 666lcz changed the title [Gateway] Enforce rate limiting [RPC] Enforce rate limiting Apr 25, 2022
@tharbert tharbert modified the milestones: DevNet, TestNet Jun 10, 2022
@666lcz 666lcz modified the milestones: TestNet, Pre Mainnet Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants