Open
Conversation
Mitigates API abuse that could take down the site by adding: - rack-attack gem with IP-based throttling (100 req/min for API) - GraphQL max_depth (10) and max_complexity (1500) limits
Member
Author
|
more gentle tidyup of things which shouldn't be quite as open as they are :) |
GraphQL::Client.load_schema fires an introspection query (__schema) that exceeds the complexity cap. Move max_complexity into the controller so introspection queries are exempt while regular queries remain protected.
Both max_depth and max_complexity need to be exempt for introspection queries (__schema), which are inherently deep and complex. Moving both limits to per-query execution in the controller fixes the system test failures.
Member
Author
|
@james-collapse just a headsup that when this hits prod fruit salad might hit the rate limit if youve not pulled the recent changes from trans-dimension in - previously it was doing a query per-event and splatting the server for a second |
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
rack-attackgem for IP-based request throttling (100 req/min on/api/*)max_depth(10) andmax_complexity(1500) limits to prevent expensive queriesCloses #2607
Test plan
spec/requests/rate_limiting_spec.rb)🤖 Generated with Claude Code