summary refs log tree commit diff
path: root/tests/api/test_ratelimiting.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add a short sleep if the request is rate-limited (#17210)Erik Johnston2024-05-181-2/+3
| | | This helps prevent clients from "tight-looping" retrying their request.
* Describe which rate limiter was hit in logs (#16135)David Robertson2023-08-301-25/+42
|
* Properly typecheck tests.api (#14983)David Robertson2023-02-031-9/+9
|
* Add type hints to `TestRatelimiter` (#14885)Andrew Morgan2023-01-211-15/+51
|
* Allow rate limiters to passively record actions they cannot limit (#13253)David Robertson2022-07-131-0/+74
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Fix a long-standing bug which meant that rate limiting was not restrictive ↵reivilibre2022-06-151-11/+40
| | | | enough in some cases. (#13018)
* Remove remaining bits of groups code. (#12936)Patrick Cloke2022-06-011-2/+0
| | | | | | * Update worker docs to remove group endpoints. * Removes an unused parameter to `ApplicationService`. * Break dependency between media repo and groups. * Avoid copying `m.room.related_groups` state events during room upgrades.
* Replace assertEquals and friends with non-deprecated versions. (#12092)Patrick Cloke2022-02-281-14/+14
|
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-9/+9
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Correctly ratelimit invites when creating a room (#9968)Brendan Abolivier2021-05-121-0/+57
| | | | | * Correctly ratelimit invites when creating a room Also allow ratelimiting for more than one action at a time.
* Make RateLimiter class check for ratelimit overrides (#9711)Erik Johnston2021-03-301-60/+108
| | | | | | | This should fix a class of bug where we forget to check if e.g. the appservice shouldn't be ratelimited. We also check the `ratelimit_override` table to check if the user has ratelimiting disabled. That table is really only meant to override the event sender ratelimiting, so we don't use any values from it (as they might not make sense for different rate limits), but we do infer that if ratelimiting is disabled for the user we should disabled all ratelimits. Fixes #9663
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-4/+18
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Add ability for access tokens to belong to one user but grant access to ↵Erik Johnston2020-10-291-2/+2
| | | | | | | | | | another user. (#8616) We do it this way round so that only the "owner" can delete the access token (i.e. `/logout/all` by the "owner" also deletes that token, but `/logout/all` by the "target user" doesn't). A future PR will add an API for creating such a token. When the target user and authenticated entity are different the `Processed request` log line will be logged with a: `{@admin:server as @bob:server} ...`. I'm not convinced by that format (especially since it adds spaces in there, making it harder to use `cut -d ' '` to chop off the start of log lines). Suggestions welcome.
* Do not apply ratelimiting on joins to appservices (#8139)Will Hunt2020-08-211-0/+73
| | | | | | Add new method ratelimiter.can_requester_do_action and ensure that appservices are exempt from being ratelimited. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Erik Johnston <erik@matrix.org>
* Performance improvements and refactor of Ratelimiter (#7595)Andrew Morgan2020-06-051-19/+77
| | | | | | | | | | While working on https://github.com/matrix-org/synapse/issues/5665 I found myself digging into the `Ratelimiter` class and seeing that it was both: * Rather undocumented, and * causing a *lot* of config checks This PR attempts to refactor and comment the `Ratelimiter` class, as well as encourage config file accesses to only be done at instantiation. Best to be reviewed commit-by-commit.
* Run Black on the tests again (#5170)Amber Brown2019-05-101-3/+3
|
* Add rate-limiting on registration (#4735)Brendan Abolivier2019-03-051-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Rate-limiting for registration * Add unit test for registration rate limiting * Add config parameters for rate limiting on auth endpoints * Doc * Fix doc of rate limiting function Co-Authored-By: babolivier <contact@brendanabolivier.com> * Incorporate review * Fix config parsing * Fix linting errors * Set default config for auth rate limiting * Fix tests * Add changelog * Advance reactor instead of mocked clock * Move parameters to registration specific config and give them more sensible default values * Remove unused config options * Don't mock the rate limiter un MAU tests * Rename _register_with_store into register_with_store * Make CI happy * Remove unused import * Update sample config * Fix ratelimiting test for py2 * Add non-guest test
* Run black.black2018-08-101-4/+3
|
* Fix flake8 warnings for testsMark Haines2016-02-191-0/+1
|
* Have all unit tests import from our own subclass of trial's unittest ↵Paul "LeoNerd" Evans2014-09-121-1/+1
| | | | TestCase; set up logging in ONE PLACE ONLY
* Test ratelimiterMark Haines2014-09-021-0/+39