Add configurable rate limiting for user asset uploads#680
Open
Vaibhav701161 wants to merge 2 commits intoaiondemand:developfrom
Open
Add configurable rate limiting for user asset uploads#680Vaibhav701161 wants to merge 2 commits intoaiondemand:developfrom
Vaibhav701161 wants to merge 2 commits intoaiondemand:developfrom
Conversation
Signed-off-by: Vaibhav mittal <vaibhavmittal929@gmail.com>
Signed-off-by: Vaibhav mittal <vaibhavmittal929@gmail.com>
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.
Change(s)
Change Type:
Added
Change Category:
Internal
Changelog Entry:
Added configurable, user-scoped rate limiting for asset uploads to prevent abuse and reduce congestion in the review pipeline.
This introduces a rolling-window upload limit configurable via
config.toml, enforces limits before asset persistence and review enqueueing, and returns clear HTTP429responses when limits are exceeded. Connector-based uploads are explicitly exempted to support bulk migration workflows.How to Test
Automated testing
Unit tests have been added covering:
Tests are expected to pass in CI environments using MySQL.
Local testing
Configure strict limits in
src/config.default.toml, for example:Start the API.
Perform two consecutive asset uploads as a regular user:
429 Too Many Requestswith aRetry-AfterheaderPerform multiple uploads as a connector user:
Note on local test execution
MySQL-specific
BINARY()CHECK constraints in unrelated models.Checklist
Tests have been added to reflect the changes; local SQLite failures are explicitly explained.
Documentation has been added describing configuration, behavior, and tradeoffs (
docs/developer/rate-limiting.md).A self-review has been conducted checking:
All applicable CI checks pass (linting, formatting, type checking); test execution depends on MySQL-backed CI.
The PR title matches the changelog entry’s one-line description.
Related Issues
Closes #661