summary refs log tree commit diff
path: root/synapse/handlers/room_member.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Refactor and convert `Linearizer` to async (#12357)Sean Quah2022-04-051-2/+2
| | | | | | | | | | | Refactor and convert `Linearizer` to async. This makes a `Linearizer` cancellation bug easier to fix. Also refactor to use an async context manager, which eliminates an unlikely footgun where code that doesn't immediately use the context manager could forget to release the lock. Signed-off-by: Sean Quah <seanq@element.io>
* Remove unused `auth_event_ids` argument plumbing (#12304)Eric Eastwood2022-03-291-19/+0
| | | | | | | | | | | | | | Follow-up to https://github.com/matrix-org/synapse/pull/12083 Since we are now using the new `state_event_ids` parameter to do all of the heavy lifting. We can remove any spots where we plumbed `auth_event_ids` just for MSC2716 things in https://github.com/matrix-org/synapse/pull/9247/files. Removing `auth_event_ids` from following functions: - `create_and_send_nonmember_event` - `_local_membership_update` - `update_membership` - `update_membership_locked`
* Refactor `create_new_client_event` to use a new parameter, ↵Eric Eastwood2022-03-251-0/+31
| | | | | | | `state_event_ids`, which accurately describes the usage with MSC2716 instead of abusing `auth_event_ids` (#12083) Spawned from https://github.com/matrix-org/synapse/pull/10975#discussion_r813183430 Part of [MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716)
* Avoid generating state groups for local out-of-band leaves (#12154)Richard van der Hoff2022-03-031-1/+1
| | | | | | | | | If we locally generate a rejection for an invite received over federation, it is stored as an outlier (because we probably don't have the state for the room). However, currently we still generate a state group for it (even though the state in that state group will be nonsense). By setting the `outlier` param on `create_event`, we avoid the nonsensical state.
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-1/+1
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Limit concurrent AS joins (#11996)Brendan Abolivier2022-02-161-19/+27
| | | | | | | Initially introduced in matrix-org-hotfixes by e5537cf (and tweaked by later commits). Fixes #11995 See also #4826
* Fix historical messages backfilling in random order on remote homeservers ↵Eric Eastwood2022-02-071-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (MSC2716) (#11114) Fix https://github.com/matrix-org/synapse/issues/11091 Fix https://github.com/matrix-org/synapse/issues/10764 (side-stepping the issue because we no longer have to deal with `fake_prev_event_id`) 1. Made the `/backfill` response return messages in `(depth, stream_ordering)` order (previously only sorted by `depth`) - Technically, it shouldn't really matter how `/backfill` returns things but I'm just trying to make the `stream_ordering` a little more consistent from the origin to the remote homeservers in order to get the order of messages from `/messages` consistent ([sorted by `(topological_ordering, stream_ordering)`](https://github.com/matrix-org/synapse/blob/develop/docs/development/room-dag-concepts.md#depth-and-stream-ordering)). - Even now that we return backfilled messages in order, it still doesn't guarantee the same `stream_ordering` (and more importantly the [`/messages` order](https://github.com/matrix-org/synapse/blob/develop/docs/development/room-dag-concepts.md#depth-and-stream-ordering)) on the other server. For example, if a room has a bunch of history imported and someone visits a permalink to a historical message back in time, their homeserver will skip over the historical messages in between and insert the permalink as the next message in the `stream_order` and totally throw off the sort. - This will be even more the case when we add the [MSC3030 jump to date API endpoint](https://github.com/matrix-org/matrix-doc/pull/3030) so the static archives can navigate and jump to a certain date. - We're solving this in the future by switching to [online topological ordering](https://github.com/matrix-org/gomatrixserverlib/issues/187) and [chunking](https://github.com/matrix-org/synapse/issues/3785) which by its nature will apply retroactively to fix any inconsistencies introduced by people permalinking 2. As we're navigating `prev_events` to return in `/backfill`, we order by `depth` first (newest -> oldest) and now also tie-break based on the `stream_ordering` (newest -> oldest). This is technically important because MSC2716 inserts a bunch of historical messages at the same `depth` so it's best to be prescriptive about which ones we should process first. In reality, I think the code already looped over the historical messages as expected because the database is already in order. 3. Making the historical state chain and historical event chain float on their own by having no `prev_events` instead of a fake `prev_event` which caused backfill to get clogged with an unresolvable event. Fixes https://github.com/matrix-org/synapse/issues/11091 and https://github.com/matrix-org/synapse/issues/10764 4. We no longer find connected insertion events by finding a potential `prev_event` connection to the current event we're iterating over. We now solely rely on marker events which when processed, add the insertion event as an extremity and the federating homeserver can ask about it when time calls. - Related discussion, https://github.com/matrix-org/synapse/pull/11114#discussion_r741514793 Before | After --- | --- ![](https://user-images.githubusercontent.com/558581/139218681-b465c862-5c49-4702-a59e-466733b0cf45.png) | ![](https://user-images.githubusercontent.com/558581/146453159-a1609e0a-8324-439d-ae44-e4bce43ac6d1.png) #### Why aren't we sorting topologically when receiving backfill events? > The main reason we're going to opt to not sort topologically when receiving backfill events is because it's probably best to do whatever is easiest to make it just work. People will probably have opinions once they look at [MSC2716](https://github.com/matrix-org/matrix-doc/pull/2716) which could change whatever implementation anyway. > > As mentioned, ideally we would do this but code necessary to make the fake edges but it gets confusing and gives an impression of “just whyyyy” (feels icky). This problem also dissolves with online topological ordering. > > -- https://github.com/matrix-org/synapse/pull/11114#discussion_r741517138 See https://github.com/matrix-org/synapse/pull/11114#discussion_r739610091 for the technical difficulties
* Add a ratelimiter for 3pid invite (#11892)Brendan Abolivier2022-02-031-1/+8
|
* Configurable limits on avatars (#11846)Brendan Abolivier2022-01-281-0/+6
| | | | | | Only allow files which file size and content types match configured limits to be set as avatar. Most of the inspiration from the non-test code comes from matrix-org/synapse-dinsic#19
* Add type hints to `synapse/storage/databases/main/room.py` (#11575)Sean Quah2021-12-151-2/+4
|
* Allow events to be created with no `prev_events` (MSC2716) (#11243)Eric Eastwood2021-12-101-1/+2
| | | | | The event still needs to have `auth_events` defined to be valid. Split out from https://github.com/matrix-org/synapse/pull/11114
* Prevent historical state from being pushed to an application service via ↵Eric Eastwood2021-11-181-0/+15
| | | | | | | | | `/transactions` (MSC2716) (#11265) Mark historical state from the MSC2716 `/batch_send` endpoint as `historical` which makes it `backfilled` and have a negative `stream_ordering` so it doesn't get queried by `/transactions`. Fix https://github.com/matrix-org/synapse/issues/11241 Complement tests: https://github.com/matrix-org/complement/pull/221
* Add remaining type hints to `synapse.events`. (#11098)Patrick Cloke2021-11-021-1/+3
|
* Remove the deprecated BaseHandler. (#11005)Patrick Cloke2021-10-081-6/+2
| | | | | | | | The shared ratelimit function was replaced with a dedicated RequestRatelimiter class (accessible from the HomeServer object). Other properties were copied to each sub-class that inherited from BaseHandler.
* Add a spamchecker method to allow or deny 3pid invites (#10894)Brendan Abolivier2021-10-061-0/+12
| | | | | This is in the context of creating new module callbacks that modules in https://github.com/matrix-org/synapse-dinsic can use, in an effort to reconcile the spam checker API in synapse-dinsic with the one in mainline. Note that a module callback already exists for 3pid invites (https://matrix-org.github.io/synapse/develop/modules/third_party_rules_callbacks.html#check_threepid_can_be_invited) but it doesn't check whether the sender of the invite is allowed to send it.
* Require direct references to configuration variables. (#10985)Patrick Cloke2021-10-061-2/+5
| | | | | | This removes the magic allowing accessing configurable variables directly from the config object. It is now required that a specific configuration class is used (e.g. `config.foo` must be replaced with `config.server.foo`).
* Add a spamchecker callback to allow or deny room joins (#10910)Brendan Abolivier2021-10-061-0/+31
| | | Co-authored-by: Erik Johnston <erik@matrix.org>
* Use direct references for configuration variables (part 7). (#10959)Patrick Cloke2021-10-041-1/+1
|
* Strip "join_authorised_via_users_server" from join events which do not need ↵Patrick Cloke2021-09-301-1/+9
| | | | | | | it. (#10933) This fixes a "Event not signed by authorising server" error when transition room member from join -> join, e.g. when updating a display name or avatar URL for restricted rooms.
* Use direct references for configuration variables (part 6). (#10916)Patrick Cloke2021-09-291-7/+7
|
* Use direct references for configuration variables (part 5). (#10897)Patrick Cloke2021-09-241-1/+1
|
* Allow sending a membership event to unban a user (#10807)Aaron Raimist2021-09-211-1/+1
| | | | | * Allow membership event to unban user Signed-off-by: Aaron Raimist <aaron@raim.ist>
* Require type hints in the handlers module. (#10831)Patrick Cloke2021-09-201-4/+4
| | | | | | | Adds missing type hints to methods in the synapse.handlers module and requires all methods to have type hints there. This also removes the unused construct_auth_difference method from the FederationHandler.
* Move `maybe_kick_guest_users` out of `BaseHandler` (#10744)Richard van der Hoff2021-09-061-6/+59
| | | This is part of my ongoing war against BaseHandler. I've moved kick_guest_users into RoomMemberHandler (since it calls out to that handler anyway), and split maybe_kick_guest_users into the two places it is called.
* Enforce the max length for per-room display names / avatar URLs. (#10654)Azrenbeth2021-08-231-1/+16
| | | To match the maximum lengths allowed for profile data.
* Send unstable-prefixed room_type in store-invite IS API requests (#10435)Michael Telatynski2021-08-041-1/+12
| | | | | | | | The room type is per MSC3288 to allow the identity-server to change invitation wording based on whether the invitation is to a room or a space. The prefixed key will be replaced once MSC3288 is accepted into the spec.
* Update the MSC3083 support to verify if joins are from an authorized server. ↵Patrick Cloke2021-07-261-8/+167
| | | | (#10254)
* Add endpoints for backfilling history (MSC2716) (#9247)Eric Eastwood2021-06-221-0/+90
| | | Work on https://github.com/matrix-org/matrix-doc/pull/2716
* Remove the experimental flag for knocking and use stable prefixes / ↵Patrick Cloke2021-06-151-4/+1
| | | | | | | endpoints. (#10167) * Room version 7 for knocking. * Stable prefixes and endpoints (both client and federation) for knocking. * Removes the experimental configuration flag.
* Implement knock feature (#6739)Sorunome2021-06-091-31/+166
| | | | | | This PR aims to implement the knock feature as proposed in https://github.com/matrix-org/matrix-doc/pull/2403 Signed-off-by: Sorunome mail@sorunome.de Signed-off-by: Andrew Morgan andrewm@element.io
* Refactor checking restricted join rules (#10007)Patrick Cloke2021-05-181-15/+5
| | | | | To be more consistent with similar code. The check now automatically raises an AuthError instead of passing back a boolean. It also absorbs some shared logic between callers.
* Correctly ratelimit invites when creating a room (#9968)Brendan Abolivier2021-05-121-0/+25
| | | | | * Correctly ratelimit invites when creating a room Also allow ratelimiting for more than one action at a time.
* Add missing type hints to handlers and fix a Spam Checker type hint. (#9896)Patrick Cloke2021-04-291-1/+1
| | | | | The user_may_create_room_alias method on spam checkers declared the room_alias parameter as a str when in reality it is passed a RoomAlias object.
* Check for space membership during a remote join of a restricted room (#9814)Patrick Cloke2021-04-231-59/+3
| | | | | | When receiving a /send_join request for a room with join rules set to 'restricted', check if the user is a member of the spaces defined in the 'allow' key of the join rules. This only applies to an experimental room version, as defined in MSC3083.
* Revert "Check for space membership during a remote join of a restricted ↵Patrick Cloke2021-04-141-3/+59
| | | | | | | | room. (#9763)" This reverts commit cc51aaaa7adb0ec2235e027b5184ebda9b660ec4. The PR was prematurely merged and not yet approved.
* Check for space membership during a remote join of a restricted room. (#9763)Patrick Cloke2021-04-141-59/+3
| | | | | | | When receiving a /send_join request for a room with join rules set to 'restricted', check if the user is a member of the spaces defined in the 'allow' key of the join rules. This only applies to an experimental room version, as defined in MSC3083.
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* MSC3083: Check for space membership during a local join of restricted rooms. ↵Patrick Cloke2021-04-081-1/+74
| | | | | | | | (#9735) When joining a room with join rules set to 'restricted', check if the user is a member of the spaces defined in the 'allow' key of the join rules. This only applies to an experimental room version, as defined in MSC3083.
* Make RateLimiter class check for ratelimit overrides (#9711)Erik Johnston2021-03-301-8/+15
| | | | | | | 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
* Add type hints to the room member handler. (#9631)Patrick Cloke2021-03-171-0/+4
|
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-8/+19
| | | | | | | - 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
* Honour ratelimit flag for application services for invite ratelimiting (#9302)Erik Johnston2021-02-031-3/+9
|
* Ratelimit invites by room and target user (#9258)Erik Johnston2021-01-291-2/+23
|
* Allow moving account data and receipts streams off master (#9104)Erik Johnston2021-01-181-2/+5
|
* Allow spam-checker modules to be provide async methods. (#8890)David Teller2020-12-111-1/+1
| | | | Spam checker modules can now provide async methods. This is implemented in a backwards-compatible manner.
* Don't ratelimit autojoining of rooms (#8921)Erik Johnston2020-12-111-10/+13
| | | Fixes #8866
* Allow per-room profile to be used for server notice user (#8799)Mathieu Velten2020-11-301-1/+9
| | | | This applies even if the feature is disabled at the server level with `allow_per_room_profiles`. The server notice not being a real user it doesn't have an user profile.
* Speed up remote invite rejection database call (#8815)Andrew Morgan2020-11-251-5/+11
| | | | | | | | | | | | | This is another PR that grew out of #6739. The existing code for checking whether a user is currently invited to a room when they want to leave the room looks like the following: https://github.com/matrix-org/synapse/blob/f737368a26bb9eea401fcc3a5bdd7e0b59e91f09/synapse/handlers/room_member.py#L518-L540 It calls `get_invite_for_local_user_in_room`, which will actually query *all* rooms the user has been invited to, before iterating over them and matching via the room ID. It will then return a tuple of a lot of information which we pull the event ID out of. I need to do a similar check for knocking, but this code wasn't very efficient. I then tried to write a different implementation using `StateHandler.get_current_state` but this actually didn't work as we haven't *joined* the room yet - we've only been invited to it. That means that only certain tables in Synapse have our desired `invite` membership state. One of those tables is `local_current_membership`. So I wrote a store method that just queries that table instead
* Add admin API for logging in as a user (#8617)Erik Johnston2020-11-171-1/+4
|
* Generalise _locally_reject_invite (#8751)Andrew Morgan2020-11-161-17/+19
| | | | | | | | | `_locally_reject_invite` generates an out-of-band membership event which can be passed to clients, but not other homeservers. This is used when we fail to reject an invite over federation. If this happens, we instead just generate a leave event locally and send it down /sync, allowing clients to reject invites even if we can't reach the remote homeserver. A similar flow needs to be put in place for rescinding knocks. If we're unable to contact any remote server from the room we've tried to knock on, we'd still like to generate and store the leave event locally. Hence the need to reuse, and thus generalise, this method. Separated from #6739.
* Optimise createRoom with multiple invites (#8559)Richard van der Hoff2020-10-291-2/+6
| | | | | By not dropping the membership lock between invites, we can stop joins from grabbing the lock when we're half-done and slowing the whole thing down.
* Simplify `_locally_reject_invite`Richard van der Hoff2020-10-131-43/+15
| | | | | Update `EventCreationHandler.create_event` to accept an auth_events param, and use it in `_locally_reject_invite` instead of reinventing the wheel.
* Remove redundant `token_id` parameter to create_eventRichard van der Hoff2020-10-131-1/+0
| | | | this is always the same as requester.access_token_id.
* Fix message duplication if something goes wrong after persisting the event ↵Erik Johnston2020-10-131-1/+12
| | | | | (#8476) Should fix #3365.
* Remove the deprecated Handlers object (#8494)Patrick Cloke2020-10-091-3/+3
| | | All handlers now available via get_*_handler() methods on the HomeServer.
* De-duplicate duplicate handlingRichard van der Hoff2020-10-051-20/+9
| | | | | move the "duplicate state event" handling down into `handle_new_client_event` where it can be shared between multiple call paths.
* Remove stream ordering from Metadata dict (#8452)Richard van der Hoff2020-10-051-6/+7
| | | | | | | | There's no need for it to be in the dict as well as the events table. Instead, we store it in a separate attribute in the EventInternalMetadata object, and populate that on load. This means that we can rely on it being correctly populated for any event which has been persited to the database.
* Do not assume that account data is of the correct form. (#8454)Patrick Cloke2020-10-051-3/+3
| | | | This fixes a bug where `m.ignored_user_list` was assumed to be a dict, leading to odd behavior for users who set it to something else.
* Enable mypy checking for unreachable code and fix instances. (#8432)Patrick Cloke2020-10-011-1/+1
|
* Switch metaclass initialization to python 3-compatible syntax (#8326)Jonathan de Jong2020-09-161-3/+1
|
* Add experimental support for sharding event persister. Again. (#8294)Erik Johnston2020-09-141-7/+0
| | | | | | This is *not* ready for production yet. Caveats: 1. We should write some tests... 2. The stream token that we use for events can get stalled at the minimum position of all writers. This means that new events may not be processed and e.g. sent down sync streams if a writer isn't writing or is slow.
* Remove some unused distributor signals (#8216)Patrick Cloke2020-09-091-38/+4
| | | | | Removes the `user_joined_room` and stops calling it since there are no observers. Also cleans-up some other unused signals and related code.
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Revert "Add experimental support for sharding event persister. (#8170)" (#8242)Brendan Abolivier2020-09-041-0/+7
| | | | | | | * Revert "Add experimental support for sharding event persister. (#8170)" This reverts commit 82c1ee1c22a87b9e6e3179947014b0f11c0a1ac3. * Changelog
* Add experimental support for sharding event persister. (#8170)Erik Johnston2020-09-021-7/+0
| | | | | | This is *not* ready for production yet. Caveats: 1. We should write some tests... 2. The stream token that we use for events can get stalled at the minimum position of all writers. This means that new events may not be processed and e.g. sent down sync streams if a writer isn't writing or is slow.
* Convert additional databases to async/await part 2 (#8200)Patrick Cloke2020-09-011-10/+2
|
* Do not propagate profile changes of shadow-banned users into rooms. (#8157)Patrick Cloke2020-08-261-1/+1
|
* Merge tag 'v1.19.1rc1' into developBrendan Abolivier2020-08-251-21/+25
|\ | | | | | | | | | | | | | | | | | | | | 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](https://github.com/matrix-org/synapse/issues/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](https://github.com/matrix-org/synapse/issues/8153))
| * Fix join ratelimiter breaking profile updates and idempotency (#8153)Brendan Abolivier2020-08-241-21/+25
| |
| * Do not apply ratelimiting on joins to appservices (#8139)Will Hunt2020-08-241-6/+8
| | | | | | | | | | | | 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>
* | Add type hints for state. (#8140)Patrick Cloke2020-08-241-8/+12
| |
* | Do not apply ratelimiting on joins to appservices (#8139)Will Hunt2020-08-211-6/+8
| | | | | | | | | | | | 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>
* | Stop shadow-banned users from sending invites. (#8095)Patrick Cloke2020-08-201-2/+60
| |
* | Convert events worker database to async/await. (#8071)Patrick Cloke2020-08-181-1/+1
|/
* Add type hints to handlers.message and events.builder (#8067)Erik Johnston2020-08-121-4/+8
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2020-07-311-10/+27
|\ | | | | | | erikj/add_rate_limiting_to_joins
| * Fix invite rejection when we have no forward-extremeties (#7980)Richard van der Hoff2020-07-301-8/+21
| | | | | | | | | | | | | | | | | | | | Thanks to some slightly overzealous cleanup in the `delete_old_current_state_events`, it's possible to end up with no `event_forward_extremities` in a room where we have outstanding local invites. The user would then get a "no create event in auth events" when trying to reject the invite. We can hack around it by using the dangling invite as the prev event.
| * Option to allow server admins to join complex rooms (#7902)lugino-emeritus2020-07-281-2/+6
| | | | | | | | | | Fixes #7901. Signed-off-by: Niklas Tittjung <nik_t.01@web.de>
* | Add ratelimiting on joinsErik Johnston2020-07-311-2/+35
|/
* `update_membership` declaration: now always returns an event id. (#7809)Richard van der Hoff2020-07-091-4/+4
|
* Fix `can only concatenate list (not "tuple") to list` exception (#7810)Richard van der Hoff2020-07-091-1/+1
| | | It seems auth_events can be either a list or a tuple, depending on Things.
* Generate real events when we reject invites (#7804)Richard van der Hoff2020-07-091-61/+133
| | | | | | | | Fixes #2181. The basic premise is that, when we fail to reject an invite via the remote server, we can generate our own out-of-band leave event and persist it as an outlier, so that we have something to send to the client.
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-161-4/+3
|
* Add option to move event persistence off master (#7517)Erik Johnston2020-05-221-8/+31
|
* Add ability to wait for replication streams (#7542)Erik Johnston2020-05-221-24/+41
| | | | | | | The idea here is that if an instance persists an event via the replication HTTP API it can return before we receive that event over replication, which can lead to races where code assumes that persisting an event immediately updates various caches (e.g. current state of the room). Most of Synapse doesn't hit such races, so we don't do the waiting automagically, instead we do so where necessary to avoid unnecessary delays. We may decide to change our minds here if it turns out there are a lot of subtle races going on. People probably want to look at this commit by commit.
* Add type hints to room member handlers (#7513)Patrick Cloke2020-05-151-132/+152
|
* Update the room member handler to use async/await. (#7507)Patrick Cloke2020-05-151-62/+49
|
* Convert federation handler to async/await. (#7459)Patrick Cloke2020-05-111-3/+2
|
* async/await is_server_admin (#7363)Andrew Morgan2020-05-011-68/+59
|
* Transfer alias mappings when joining an upgraded room (#6946)Andrew Morgan2020-03-301-0/+3
|
* make FederationHandler.do_remotely_reject_invite asyncRichard van der Hoff2020-02-031-2/+4
|
* make FederationHandler.do_invite_join asyncRichard van der Hoff2020-02-031-2/+4
|
* Add `local_current_membership` table (#6655)Erik Johnston2020-01-151-1/+1
| | | | | | | Currently we rely on `current_state_events` to figure out what rooms a user was in and their last membership event in there. However, if the server leaves the room then the table may be cleaned up and that information is lost. So lets add a table that separately holds that information.
* Merge pull request #6629 from matrix-org/rav/kill_event_reference_hashesRichard van der Hoff2020-01-061-6/+5
|\ | | | | Remove a bunch of unused code from event creation
| * Remove unused hashes and depths from _update_membership paramsRichard van der Hoff2020-01-061-13/+4
| |
| * Remove unused hashes and depths from create_event paramsRichard van der Hoff2020-01-061-1/+7
| |
| * rename get_prev_events_for_room to get_prev_events_and_hashes_for_roomRichard van der Hoff2020-01-061-1/+3
| | | | | | | | ... to make way for a new method which just returns the event ids
* | Fix some test failures when frozen_dicts are enabled (#6642)Richard van der Hoff2020-01-061-0/+2
|/ | | | Fixes #4026
* Change EventContext to use the Storage class (#6564)Erik Johnston2019-12-201-2/+2
|
* Propagate reason in remotely rejected invitesErik Johnston2019-11-281-4/+9
|
* Re-add docstring, with caveats detailedAndrew Morgan2019-11-041-1/+1
|
* Transfer upgraded rooms on groupsAndrew Morgan2019-11-041-0/+9
|
* Depublish a room from the public rooms list when it is upgraded (#6232)Andrew Morgan2019-11-011-27/+54
|
* Update black to 19.10b0 (#6304)Amber Brown2019-11-011-16/+19
| | | * update version of black and also fix the mypy config being overridden
* Move tag/push rules room upgrade checking ealier (#6155)Andrew Morgan2019-10-101-18/+44
| | | | | It turns out that _local_membership_update doesn't run when you join a new, remote room. It only runs if you're joining a room that your server already knows about. This would explain #4703 and #5295 and why the transfer would work in testing and some rooms, but not others. This would especially hit single-user homeservers. The check has been moved to right after the room has been joined, and works much more reliably. (Though it may still be a bit awkward of a place).
* Fix yields and copy instead of move push rules on room upgrade (#6144)Andrew Morgan2019-10-021-2/+2
| | | | | | | Copy push rules during a room upgrade from the old room to the new room, instead of deleting them from the old room. For instance, we've defined upgrading of a room multiple times to be possible, and push rules won't be transferred on the second upgrade if they're deleted during the first. Also fix some missing yields that probably broke things quite a bit.
* Move lookup-related functions from RoomMemberHandler to IdentityHandler (#5978)Andrew Morgan2019-09-271-364/+6
| | | Just to have all the methods that make calls to identity services in one place.
* Use the federation blacklist for requests to untrusted Identity Servers (#6000)Andrew Morgan2019-09-231-1/+6
| | | | | Uses a SimpleHttpClient instance equipped with the federation_ip_range_blacklist list for requests to identity servers provided by user input. Does not use a blacklist when contacting identity servers specified by account_threepid_delegates. The homeserver trusts the latter and we don't want to prevent homeserver admins from specifying delegates that are on internal IP addresses. Fixes #5935
* Return timeout error to user for identity server calls (#6073)Andrew Morgan2019-09-231-9/+23
|
* v2 3PID Invites (part of MSC2140) (#5979)Andrew Morgan2019-09-171-23/+81
| | | | | | | 3PID invites require making a request to an identity server to check that the invited 3PID has an Matrix ID linked, and if so, what it is. These requests are being made on behalf of a user. The user will supply an identity server and an access token for that identity server. The homeserver will then forward this request with the access token (using an `Authorization` header) and, if the given identity server doesn't support v2 endpoints, will fall back to v1 (which doesn't require any access tokens). Requires: ~~#5976~~
* Use the v2 Identity Service API for lookups (MSC2134 + MSC2140) (#5976)Andrew Morgan2019-09-111-12/+166
| | | | | | | This is a redo of https://github.com/matrix-org/synapse/pull/5897 but with `id_access_token` accepted. Implements [MSC2134](https://github.com/matrix-org/matrix-doc/pull/2134) plus Identity Service v2 authentication ala [MSC2140](https://github.com/matrix-org/matrix-doc/pull/2140). Identity lookup-related functions were also moved from `RoomMemberHandler` to `IdentityHandler`.
* Add note about extra arg to send_membership_event, remove arg in ↵Andrew Morgan2019-09-111-10/+2
| | | | | | | | remote_reject_invite (#6009) Some small fixes to `room_member.py` found while doing other PRs. 1. Add requester to the base `_remote_reject_invite` method. 2. `send_membership_event`'s docstring was out of date and took in a `remote_room_hosts` arg that was not used and no calling function provided.
* code cleanupsAndrew Morgan2019-09-031-7/+2
|
* Remove unnecessary parentheses around return statements (#5931)Andrew Morgan2019-08-301-1/+1
| | | | | Python will return a tuple whether there are parentheses around the returned values or not. I'm just sick of my editor complaining about this all over the place :)
* Revert "Use the v2 lookup API for 3PID invites (#5897)" (#5937)Andrew Morgan2019-08-301-119/+9
| | | | | This reverts commit 71fc04069a5770a204c3514e0237d7374df257a8. This broke 3PID invites as #5892 was required for it to work correctly.
* Use the v2 lookup API for 3PID invites (#5897)Andrew Morgan2019-08-281-9/+119
| | | | | | | Fixes https://github.com/matrix-org/synapse/issues/5861 Adds support for the v2 lookup API as defined in [MSC2134](https://github.com/matrix-org/matrix-doc/pull/2134). Currently this is only used for 3PID invites. Sytest PR: https://github.com/matrix-org/sytest/pull/679
* Room Complexity Client Implementation (#5783)Amber Brown2019-07-301-4/+80
|
* Replace returnValue with return (#5736)Amber Brown2019-07-231-21/+21
|
* Merge branch 'develop' into babolivier/invite-jsonBrendan Abolivier2019-07-081-39/+1
|\
| * Remove support for invite_3pid_guest. (#5625)Richard van der Hoff2019-07-051-39/+0
| | | | | | | | | | | | | | | | | | This has never been documented, and I'm not sure it's ever been used outside sytest. It's quite a lot of poorly-maintained code, so I'd like to get rid of it. For now I haven't removed the database table; I suggest we leave that for a future clearout.
| * Only ratelimit when sending the emailBrendan Abolivier2019-06-281-1/+2
| | | | | | | | If we do the opposite, an event can arrive after or while sending the email and the 3PID invite event will get ratelimited.
| * Don't update the ratelimiter before sending a 3PID inviteBrendan Abolivier2019-06-281-1/+1
| | | | | | | | This would cause emails being sent, but Synapse responding with a 429 when creating the event. The client would then retry, and with bad timing the same scenario would happen again. Some testing I did ended up sending me 10 emails for one single invite because of this.
* | LintBrendan Abolivier2019-07-081-1/+2
| |
* | Use application/json when querying the IS's /store-invite endpointBrendan Abolivier2019-07-081-4/+17
|/
* Run Black. (#5482)Amber Brown2019-06-201-189/+115
|
* Add third party rules hook for 3PID invitesBrendan Abolivier2019-06-171-0/+10
|
* fix mapping of return values for get_or_register_3pid_guest (#5177)bytepoets-blo2019-05-171-1/+1
| | | * fix mapping of return values for get_or_register_3pid_guest
* Add option to disable per-room profilesBrendan Abolivier2019-05-161-0/+9
|
* Rate limit earlyErik Johnston2019-05-021-2/+3
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-04-261-0/+5
|\ | | | | | | erikj/ratelimit_3pid_invite
| * Add config option to block users from looking up 3PIDs (#5010)Brendan Abolivier2019-04-041-0/+5
| |
* | Ratelimit 3pid invitesErik Johnston2019-04-261-0/+10
|/ | | | | We do ratelimit sending the 3PID invite events, but that happens after spamming the identity server.
* Prevent kicking users who aren't in the room (#4999)Andrew Morgan2019-04-041-0/+9
| | | Prevent kick events from succeeding if the user is not currently in the room.
* Use flagsErik Johnston2019-03-201-0/+6
|
* Transfer local user's push rules on room upgrade (#4838)Andrew Morgan2019-03-121-0/+4
| | | Transfer push rules (notifications) on room upgrade
* Fix registration on workers (#4682)Erik Johnston2019-02-201-1/+1
| | | | | | | | | | * Move RegistrationHandler init to HomeServer * Move post registration actions to RegistrationHandler * Add post regisration replication endpoint * Newsfile
* Remove event ID usage when checking if new roomErik Johnston2019-01-291-1/+2
| | | | | The event ID is changing, so we can no longer get the domain from it. On the other hand, the check is unnecessary.
* Change return syntax in doc stringAndrew Morgan2019-01-281-1/+1
|
* Reuse predecessor methodAndrew Morgan2019-01-281-12/+8
|
* FixesAndrew Morgan2019-01-251-39/+39
|
* Clean up direct_rooms accessAndrew Morgan2019-01-251-3/+3
|
* Use python magicAndrew Morgan2019-01-251-2/+1
|
* Destructure account data tuple before useAndrew Morgan2019-01-251-3/+3
|
* Remove unnecessary null checkAndrew Morgan2019-01-251-7/+6
|
* Move room_tag declaration to be closer to its useAndrew Morgan2019-01-251-4/+5
|
* Move tag and direct state copying into separate functionAndrew Morgan2019-01-251-43/+63
|
* lintAndrew Morgan2019-01-221-1/+3
|
* Prevent duplicate room IDs in m.directAndrew Morgan2019-01-221-10/+9
|
* Fix commentsAndrew Morgan2019-01-221-2/+2
|
* tags, m.direct copying over correctlyAndrew Morgan2019-01-221-2/+49
|
* Fix typosAndrew Morgan2019-01-221-8/+8
|
* Use directory server for room joins (#3899)Richard van der Hoff2018-09-181-0/+5
| | | | | | When we do a join, always try the server we used for the alias lookup first. Fixes #2418
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-08-201-1/+1
|\ | | | | | | erikj/refactor_state_handler
| * Rename async to async_helpers because `async` is a keyword on Python 3.7 (#3678)Amber Brown2018-08-101-1/+1
| |
* | Revert spurious changeErik Johnston2018-08-201-2/+2
| |
* | Choose state algorithm based on room versionErik Johnston2018-08-091-2/+3
|/
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Michael Telatynski2018-07-241-117/+343
|\ | | | | | | t3chguy/default_inviter_display_name_3pid
| * Use new gettersErik Johnston2018-07-231-3/+6
| |
| * run isortAmber Brown2018-07-091-8/+6
| |
| * Let users leave the server notice room after joiningRichard van der Hoff2018-05-251-10/+14
| | | | | | | | They still can't reject invites, but we let them leave it.
| * custom error code for not leaving server notices roomRichard van der Hoff2018-05-221-0/+1
| |
| * Make sure we reject attempts to invite the notices userRichard van der Hoff2018-05-181-0/+7
| |
| * fix missing yield for server_notices_roomRichard van der Hoff2018-05-171-3/+4
| |
| * Infrastructure for a server notices roomRichard van der Hoff2018-05-171-4/+36
| | | | | | | | | | | | | | Server Notices use a special room which the user can't dismiss. They are created on demand when some other bit of the code calls send_notice. (This doesn't actually do much yet becuse we don't call send_notice anywhere)
| * Avoid creating events with huge numbers of prev_eventsRichard van der Hoff2018-04-161-4/+9
| | | | | | | | | | | | In most cases, we limit the number of prev_events for a given event to 10 events. This fixes a particular code path which created events with huge numbers of prev_events.
| * Return a 404 rather than a 500 on rejoining empty roomsRichard van der Hoff2018-04-091-0/+8
| | | | | | | | | | | | | | Filter ourselves out of the server list before checking for an empty remote host list, to fix 500 error Fixes #2141
| * _remote_join and co take a requesterErik Johnston2018-03-131-4/+4
| |
| * Merge pull request #2987 from matrix-org/erikj/split_room_member_handlerErik Johnston2018-03-131-98/+185
| |\ | | | | | | Split RoomMemberHandler into base and master class
| | * Add missing param to docstringsErik Johnston2018-03-131-0/+3
| | |
| | * Correct import orderErik Johnston2018-03-131-3/+3
| | |
| | * Move user_*_room distributor stuff to master classErik Johnston2018-03-131-5/+50
| | | | | | | | | | | | | | | I added yields when calling user_left_room, but they shouldn't matter on the master process as they always return None anyway.
| | * Split RoomMemberHandler into base and master classErik Johnston2018-03-131-96/+135
| | | | | | | | | | | | | | | | | | | | | | | | The intention here is to split the class into the bits that can be done on workers and the bits that have to be done on the master. In future there will also be a class that can be run on the worker, which will delegate work to the master when necessary.
| * | Merge pull request #2981 from matrix-org/erikj/factor_remote_leaveErik Johnston2018-03-131-22/+54
| |\| | | | | | | Factor out _remote_reject_invite in RoomMember
| | * Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-03-131-14/+10
| | |\ | | | | | | | | | | | | erikj/factor_remote_leave
| | * | Add docstringErik Johnston2018-03-131-0/+26
| | | |
| | * | Factor out _remote_reject_invite in RoomMemberErik Johnston2018-03-131-22/+28
| | | |
| * | | Merge pull request #2979 from matrix-org/erikj/no_handlersErik Johnston2018-03-131-2/+1
| |\ \ \ | | |_|/ | |/| | Don't build handlers on workers unnecessarily
| | * | Split replication layer into twoErik Johnston2018-03-131-2/+1
| | |/
| * | Merge pull request #2980 from matrix-org/erikj/rm_privErik Johnston2018-03-131-7/+7
| |\ \ | | | | | | | | Make RoomMemberHandler functions private that can be
| | * | Make functions private that can beErik Johnston2018-03-131-7/+7
| | |/
| * / Refactor get_or_register_3pid_guestErik Johnston2018-03-131-7/+3
| |/
| * Add missing yield during 3pid signature checksErik Johnston2018-03-021-1/+1
| |
| * Move back to hs.is_mineErik Johnston2018-03-011-7/+6
| |
| * Move RoomMemberHandler out of HandlersErik Johnston2018-03-011-23/+31
| |
| * Update copyrightErik Johnston2018-02-061-0/+1
| |
| * Update places where we create eventsErik Johnston2018-02-051-9/+11
| |
| * Copy dict in update_membership tooErik Johnston2017-12-071-0/+4
| |
| * Merge pull request #2466 from matrix-org/erikj/groups_mergedErik Johnston2017-10-111-1/+3
| |\ | | | | | | Initial Group Implementation
| | * Merge branch 'develop' into erikj/groups_mergedDavid Baker2017-10-021-0/+22
| | |\
| | * | Split out profile handler to fix testsErik Johnston2017-08-251-1/+3
| | | |
| * | | Spam checking: add the invitee to user_may_inviteDavid Baker2017-10-051-1/+1
| | | |
| * | | pass room id tooDavid Baker2017-10-031-1/+3
| | | |
| * | | Federation was passing strings anywayDavid Baker2017-10-031-1/+1
| | | | | | | | | | | | | | | | so pass string everywhere
| * | | this shouldn't be debugDavid Baker2017-10-031-2/+2
| | | |
| * | | better loggingDavid Baker2017-10-031-4/+9
| | | |
| * | | Skip spam check for admin usersDavid Baker2017-10-031-8/+8
| | | |
| * | | Allow spam checker to reject invites tooDavid Baker2017-10-031-6/+14
| | |/ | |/|
| * | Add a config option to block all room invites (#2457)Richard van der Hoff2017-09-191-0/+22
| |/ | | | | | | | | - allows sysadmins the ability to lock down their servers so that people can't send their users room invites.
* / if inviter_display_name == ""||None then default to inviter MXIDMichael Telatynski2018-06-131-0/+4
|/ | | | to prevent email invite from "None"
* Handle all cases of sending membership eventsErik Johnston2017-06-191-0/+5
|
* Add shutdown room APIErik Johnston2017-06-191-0/+5
|
* Speed up get_joined_hostsErik Johnston2017-05-161-1/+2
|
* Add more granular event send metricsErik Johnston2017-05-021-0/+1
|
* Broaden the conditions for locally_rejecting invitesRichard van der Hoff2017-04-211-1/+7
| | | | | | | | | | The logic for marking invites as locally rejected was all well and good, but didn't happen when the remote server returned a 500, or wasn't reachable, or had no DNS, or whatever. Just expand the except clause to catch everything. Fixes https://github.com/matrix-org/synapse/issues/761.
* Remove redundant functionRichard van der Hoff2017-04-211-10/+5
| | | | | inline `reject_remote_invite`, which only existed to make tracing the callflow more difficult.
* Allow forgetting rooms you're banned fromDavid Baker2017-02-151-1/+3
|
* Add missing None checkErik Johnston2017-01-111-5/+6
|
* Merge pull request #1787 from matrix-org/erikj/linearize_memberErik Johnston2017-01-101-4/+15
|\ | | | | Linearize updates to membership via PUT /state/
| * Linearize updates to membership via PUT /state/Erik Johnston2017-01-091-4/+15
| |
* | Name linearizer's for better logsErik Johnston2017-01-091-1/+1
|/
* handlers/room_member: fix guest access check when joining roomsPatrik Oldsberg2017-01-061-4/+6
| | | | Signed-off-by: Patrik Oldsberg <patrik.oldsberg@ericsson.com>
* Fix membership changes to be idempotentMark Haines2016-09-021-0/+6
|
* Correctly handle the difference between prev and current stateErik Johnston2016-08-311-3/+3
|
* Replace context.current_state with context.current_state_idsErik Johnston2016-08-251-40/+84
|
* Pass through user-supplied content in /join/$room_idKegan Dougal2016-08-231-2/+12
| | | | | | | It was always intended to allow custom keys on the join event, but this has at some point been lost. Restore it. If the user specifies keys like "avatar_url" then they will be clobbered.
* Only process one local membership event per room at a timeErik Johnston2016-08-121-1/+1
|
* Add `create_requester` functionRichard van der Hoff2016-07-261-11/+9
| | | | | Wrap the `Requester` constructor with a function which provides sensible defaults, and use it throughout
* Remove unused get_joined_rooms_for_userMark Haines2016-05-171-15/+0
|
* Remove get_joined_rooms_for_user from RoomMemberHandlerMark Haines2016-05-161-2/+1
|
* Replaces calls to fetch_room_distributions_into with get_joined_hosts_for_roomMark Haines2016-05-161-29/+0
|
* Fix typoMark Haines2016-05-111-1/+1
|
* Move _create_new_client_event and handle_new_client_event out of base handlerMark Haines2016-05-111-2/+2
|
* fix typoMatthew Hodgson2016-04-281-1/+1
|
* Remove some unused functions (#711)Mark Haines2016-04-081-13/+0
| | | | | | | | * Remove some unused functions * get_room_events_stream is only used in tests * is_exclusive_room might actually be something we want
* Move all the wrapper functions for distributor.fireMark Haines2016-04-081-15/+1
| | | | | | | Move the functions inside the distributor and import them where needed. This reduces duplication and makes it possible for flake8 to detect when the functions aren't used in a given file.
* Merge pull request #700 from matrix-org/erikj/deduplicate_joinsErik Johnston2016-04-071-0/+31
|\ | | | | Deduplicate membership changes
| * Deduplicate joinsErik Johnston2016-04-071-0/+31
| |
* | Set profile information when joining rooms remotelyErik Johnston2016-04-071-0/+5
|/
* Merge pull request #691 from matrix-org/erikj/memberErik Johnston2016-04-051-4/+14
|\ | | | | Fix stuck invites
| * Fix stuck invitesErik Johnston2016-04-051-4/+14
| | | | | | | | | | | | | | | | If rejecting a remote invite fails with an error response don't fail the entire request; instead mark the invite as locally rejected. This fixes the bug where users can get stuck invites which they can neither accept nor reject.
* | Merge pull request #690 from matrix-org/erikj/memberErik Johnston2016-04-051-1/+4
|\| | | | | Store invites in a separate table.
| * Docs and indentsErik Johnston2016-04-041-1/+4
| |
| * Store invites in a separate table.Erik Johnston2016-04-041-1/+1
| |
* | Merge pull request #689 from matrix-org/erikj/memberErik Johnston2016-04-041-93/+147
|\| | | | | Do checks for memberships before creating events
| * Use computed prev event idsErik Johnston2016-04-011-0/+3
| |
| * Do checks for memberships before creating eventsErik Johnston2016-04-011-93/+144
| |
* | Use google style doc strings.Mark Haines2016-04-011-24/+24
|/ | | | | | | pycharm supports them so there is no need to use the other format. Might as well convert the existing strings to reduce the risk of people accidentally cargo culting the wrong doc string format.
* Split out RoomMemberHandlerErik Johnston2016-03-311-0/+646