-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
chore: rate limit requests #24324
chore: rate limit requests #24324
Conversation
superset/config.py
Outdated
RATELIMIT_ENABLED = True | ||
AUTH_RATE_LIMITED = True | ||
AUTH_RATE_LIMIT = "2 per 5 second" | ||
RATELIMIT_APPLICATION = "50 per second" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dpgaspar I know these were introduced in FAB 4.3.0. Do you have an idea of what sensible defaults would be for Superset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Airflow implemented the same, their using auth_rate_limit = 5 per 40 second
. Not sure about rate limiting the entire application this way, rate limits are better when tied to a user and state is set globally, this is possible with flask-limiter (what FAB is using for this) but needs further configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, I though these configuration keys would enable flask-limiter
in FAB? That's not the case? How do we do that then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's done exactly like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 per 5 seconds could be an harsh limit. Would be nice to add some docs, and reference RATELIMIT_STORAGE_URI
and RATELIMIT_REQUEST_IDENTIFIER
since as is flask-limiter is too simplistic. It's way better to limit an entire application by user request
Codecov Report
@@ Coverage Diff @@
## master #24324 +/- ##
==========================================
- Coverage 69.00% 68.93% -0.08%
==========================================
Files 1906 1906
Lines 74149 74153 +4
Branches 8211 8211
==========================================
- Hits 51169 51114 -55
- Misses 20856 20915 +59
Partials 2124 2124
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 18 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
(cherry picked from commit 4bc4600)
SUMMARY
Rate limit the export dashboard endpoint.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION