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

Fixed window rate limiting #338

Open
FluorescentHallucinogen opened this issue May 19, 2019 · 2 comments
Open

Fixed window rate limiting #338

FluorescentHallucinogen opened this issue May 19, 2019 · 2 comments
Labels
Community 👨‍👧 Something initiated by a community Discussion 💬 Brainstorm about the idea Enhancement 🆕 New feature or request

Comments

@FluorescentHallucinogen

Query cost/complexity validation/analysis is not enough. See the following thread for more info: ravangen/graphql-rate-limit#48.

TL;DR: Cost analysis won't care if you receive one request per second or a thousand. A malicious actor could craft an operation that remains under a cost limit, but send a large number of requests.

@19majkel94 Could you please add an example how to use the fixed window rate limiting in addition to query cost/complexity validation/analysis in type-graphql?

PTAL at https://github.com/ravangen/graphql-rate-limit and https://github.com/teamplanes/graphql-rate-limit.

@MichalLytek
Copy link
Owner

MichalLytek commented May 19, 2019

Cost analysis won't care if you receive one request per second or a thousand. A malicious actor could craft an operation that remains under a cost limit, but send a large number of requests.

You can grant a user N complexity points per hour and substract the cost value for each query, then deny resolving it after reaching the limit.

You can use teamplanes/graphql-rate-limit (Using the base rate limiter function) in a middleware to attach the rate limiter to query/mutation.

@MichalLytek MichalLytek added Community 👨‍👧 Something initiated by a community Discussion 💬 Brainstorm about the idea Enhancement 🆕 New feature or request labels May 19, 2019
@MichalLytek MichalLytek added this to the Future release milestone May 3, 2020
@sbilello
Copy link

@MichalLytek Is there an example of how to use graphql-rate-limit in a federated graph?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community 👨‍👧 Something initiated by a community Discussion 💬 Brainstorm about the idea Enhancement 🆕 New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants