This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix join ratelimiter breaking profile updates and idempotency #8153
Merged
Conversation
This file contains 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
This was
linked to
issues
Aug 24, 2020
This was referenced Aug 24, 2020
Half-Shot
reviewed
Aug 24, 2020
erikjohnston
approved these changes
Aug 24, 2020
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.
I think this works fine.
We could instead honour the ratelimit
param, which would help with profile updates no longer working. However that breaks the flow for bots that send a join before every message, as currently the join ratelimiter doesn't honour the ratelimit override.
Since this is a hotfix I vote we land this as is
Co-authored-by: Erik Johnston <erik@matrix.org>
babolivier
added a commit
that referenced
this pull request
Aug 25, 2020
Synapse 1.19.1rc1 (2020-08-25) ============================== Bugfixes -------- - Fix a bug introduced in v1.19.0 where appservices with ratelimiting disabled would still be ratelimited when joining rooms. ([\#8139](#8139)) - Fix a bug introduced in v1.19.0 that would cause e.g. profile updates to fail due to incorrect application of rate limits on join requests. ([\#8153](#8153))
anoadragon453
added a commit
that referenced
this pull request
Aug 26, 2020
…r_param_ui_auth * 'develop' of github.com:matrix-org/synapse: (369 commits) Add functions to `MultiWriterIdGen` used by events stream (#8164) Do not allow send_nonmember_event to be called with shadow-banned users. (#8158) Changelog fixes 1.19.1rc1 Make StreamIdGen `get_next` and `get_next_mult` async (#8161) Wording fixes to 'name' user admin api filter (#8163) Fix missing double-backtick in RST document Search in columns 'name' and 'displayname' in the admin users endpoint (#7377) Add type hints for state. (#8140) Stop shadow-banned users from sending non-member events. (#8142) Allow capping a room's retention policy (#8104) Add healthcheck for default localhost 8008 port on /health endpoint. (#8147) Fix flaky shadow-ban tests. (#8152) Fix join ratelimiter breaking profile updates and idempotency (#8153) Do not apply ratelimiting on joins to appservices (#8139) Don't fail /submit_token requests on incorrect session ID if request_token_inhibit_3pid_errors is turned on (#7991) Do not apply ratelimiting on joins to appservices (#8139) Micro-optimisations to get_auth_chain_ids (#8132) Allow denying or shadow banning registrations via the spam checker (#8034) Stop shadow-banned users from sending invites. (#8095) ...
anoadragon453
added a commit
that referenced
this pull request
Aug 26, 2020
…sword_reset_confirmation * 'develop' of github.com:matrix-org/synapse: (22 commits) Update the test federation client to handle streaming responses (#8130) Do not propagate profile changes of shadow-banned users into rooms. (#8157) Make SlavedIdTracker.advance have same interface as MultiWriterIDGenerator (#8171) Convert simple_select_one and simple_select_one_onecol to async (#8162) Fix rate limiting unit tests. (#8167) Add functions to `MultiWriterIdGen` used by events stream (#8164) Do not allow send_nonmember_event to be called with shadow-banned users. (#8158) Changelog fixes 1.19.1rc1 Make StreamIdGen `get_next` and `get_next_mult` async (#8161) Wording fixes to 'name' user admin api filter (#8163) Fix missing double-backtick in RST document Search in columns 'name' and 'displayname' in the admin users endpoint (#7377) Add type hints for state. (#8140) Stop shadow-banned users from sending non-member events. (#8142) Allow capping a room's retention policy (#8104) Add healthcheck for default localhost 8008 port on /health endpoint. (#8147) Fix flaky shadow-ban tests. (#8152) Fix join ratelimiter breaking profile updates and idempotency (#8153) Do not apply ratelimiting on joins to appservices (#8139) ...
anoadragon453
added a commit
that referenced
this pull request
Aug 26, 2020
…rove_test_times * 'develop' of github.com:matrix-org/synapse: (160 commits) Update the test federation client to handle streaming responses (#8130) Do not propagate profile changes of shadow-banned users into rooms. (#8157) Make SlavedIdTracker.advance have same interface as MultiWriterIDGenerator (#8171) Convert simple_select_one and simple_select_one_onecol to async (#8162) Fix rate limiting unit tests. (#8167) Add functions to `MultiWriterIdGen` used by events stream (#8164) Do not allow send_nonmember_event to be called with shadow-banned users. (#8158) Changelog fixes 1.19.1rc1 Make StreamIdGen `get_next` and `get_next_mult` async (#8161) Wording fixes to 'name' user admin api filter (#8163) Fix missing double-backtick in RST document Search in columns 'name' and 'displayname' in the admin users endpoint (#7377) Add type hints for state. (#8140) Stop shadow-banned users from sending non-member events. (#8142) Allow capping a room's retention policy (#8104) Add healthcheck for default localhost 8008 port on /health endpoint. (#8147) Fix flaky shadow-ban tests. (#8152) Fix join ratelimiter breaking profile updates and idempotency (#8153) Do not apply ratelimiting on joins to appservices (#8139) ...
anoadragon453
added a commit
that referenced
this pull request
Aug 26, 2020
…anoa/amorgan.xyz * 'release-v1.19.1' of github.com:matrix-org/synapse: (197 commits) Changelog fixes 1.19.1rc1 Fix join ratelimiter breaking profile updates and idempotency (#8153) Do not apply ratelimiting on joins to appservices (#8139) Changelog changes 1.19.0 More changelog tweaks More changelog tweaks Remove unwanted changelog line 1.19.0rc1 Convert the roommember database to async/await. (#8070) Convert devices database to async/await. (#8069) Add type hints to handlers.message and events.builder (#8067) Convert account data, device inbox, and censor events databases to async/await (#8063) Convert appservice, group server, profile and more databases to async (#8066) Fix typing for notifier (#8064) Convert tags and metrics databases to async/await (#8062) Converts event_federation and registration databases to async/await (#8061) Add comment explaining cast Update changelog.d/8051.misc ...
babolivier
pushed a commit
that referenced
this pull request
Sep 1, 2021
* commit 'b79d69796': 1.19.1rc1 Fix join ratelimiter breaking profile updates and idempotency (#8153)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #8148 by not firing the ratelimiter if the join event isn't actually joining the user to the room (e.g. it's a profile change).
Fixes #8146 by not firing the ratelimiter if the join event is identical to the user's previous join event (in which case we don't actually send the event, to preserve idempotency on the join endpoints).
This fix is only targeting the ratelimiter on local joins, and not the one on remote joins, because we're sure the latter is only actually used to get a user in the room (afterwards we're already in that room and use the local one).
The main downside of this patch is that it doesn't save as many CPU cycles, and time, before ratelimiting as how it was done originally, but it looks to me like all that's done between the location we used to ratelimit and the new location is almost exclusively gathering data to perform these two checks, so it doesn't sound to me like we can do it any differently.
TODO: