-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add some throttling to the new /upload/ api #8537
Comments
@diox @wagnerand opinions on this? To quote myself from #8511: I deliberately didn't add any [throttles], because a user could end up having to submit multiple uploads if they didn't test with the linter before submission, or for non-linter validation errors, so the existing limits would be too low. But we potentially should have some throttling So, we can't use the same shared throttles as devhub, the old signing api, or the new addon submission api, because they're a calibrated for creating new add-ons. (And even if in the best scenario of a single upload plus a single addon submission, we'd be halving the threshold if we share the throttle). If want some throttling we need to settle on the limits. Starting point would be the existing submission throttle limits, but not shared. I'd lean toward higher limits though, because of the chances of linter or non-linter errors thrown at that first stage. |
Can the limit apply to submissions that passed validation? |
I don't believe so - the validation is running in a celery task so we don't know if a request turned out to be for a successful upload until long after the request has finished. |
Agreed it should be a separate throttle, more generous than the ones used for new add-on/version. Ultimately there is not much to gain for an attacker (besides costing us CPU/storage) by submitting a lot of uploads - there is not much information to gain as scanners actions will be applied in the following step, when the version is created, which already has rate-limiting. |
Reference the existing throttles: Duplicate the same 5 throttles but double the values? |
I think you could re-use the IP-based ones as-is and duplicate the user ones doubling the values, to start. Edit: actually you'll need to duplicate them all, even those we don't need to change the values of, because you want a separate scope. |
I've verified the rate limiting on stage and these are some of my results:
|
I read @diox 's comment as all the throttle classes needed to be duplicated (different scopes) with the user throttle limits doubled and the ip throttle limits kept the same. |
This. I don't think we need to be more generous with the IP based ones for now. We'll revisit if needed when the API starts getting more use. |
Follow up for #8511
Describe the problem and steps to reproduce it:
api/v5/addons/upload/
endpointWhat happened?
Each request is successfully processed
What did you expect to happen?
The API should be throttled after several consecutive requests
The text was updated successfully, but these errors were encountered: