summary refs log tree commit diff
path: root/tests/test_federation.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Get rid of `_auth_and_persist_event` (#10781)Richard van der Hoff2021-09-081-3/+12
| | | This is only called in two places, and the code seems much clearer without it.
* Split `FederationHandler` in half (#10692)Richard van der Hoff2021-08-261-3/+7
| | | The idea here is to take anything to do with incoming events and move it out to a separate handler, as a way of making FederationHandler smaller.
* Split `on_receive_pdu` in half (#10640)Richard van der Hoff2021-08-191-8/+2
| | | Here we split on_receive_pdu into two functions (on_receive_pdu and process_pulled_event), rather than having both cases in the same method. There's a tiny bit of overlap, but not that much.
* Clean up federation event auth code (#10539)Richard van der Hoff2021-08-061-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * drop old-room hack pretty sure we don't need this any more. * Remove incorrect comment about modifying `context` It doesn't look like the supplied context is ever modified. * Stop `_auth_and_persist_event` modifying its parameters This is only called in three places. Two of them don't pass `auth_events`, and the third doesn't use the dict after passing it in, so this should be non-functional. * Stop `_check_event_auth` modifying its parameters `_check_event_auth` is only called in three places. `on_send_membership_event` doesn't pass an `auth_events`, and `prep` and `_auth_and_persist_event` do not use the map after passing it in. * Stop `_update_auth_events_and_context_for_auth` modifying its parameters Return the updated auth event dict, rather than modifying the parameter. This is only called from `_check_event_auth`. * Improve documentation on `_auth_and_persist_event` Rename `auth_events` parameter to better reflect what it contains. * Improve documentation on `_NewEventInfo` * Improve documentation on `_check_event_auth` rename `auth_events` parameter to better describe what it contains * changelog
* Merge branch 'master' into developAndrew Morgan2021-04-201-1/+1
|\
| * Always use the name as the log ID. (#9829)Patrick Cloke2021-04-201-1/+1
| | | | | | | | | | As far as I can tell our logging contexts are meant to log the request ID, or sometimes the request ID followed by a suffix (this is generally stored in the name field of LoggingContext). There's also code to log the name@memory location, but I'm not sure this is ever used. This simplifies the code paths to require every logging context to have a name and use that in logging. For sub-contexts (created via nested_logging_contexts, defer_to_threadpool, Measure) we use the current context's str (which becomes their name or the string "sentinel") and then potentially modify that (e.g. add a suffix).
* | Separate creating an event context from persisting it in the federation ↵Patrick Cloke2021-04-141-2/+4
| | | | | | | | | | | | handler (#9800) This refactoring allows adding logic that uses the event context before persisting it.
* | Revert "Check for space membership during a remote join of a restricted ↵Patrick Cloke2021-04-141-4/+2
| | | | | | | | | | | | | | | | 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-2/+4
| | | | | | | | | | | | | | 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>`
* Use mock from the stdlib. (#9772)Patrick Cloke2021-04-091-1/+1
|
* Various clean-ups to the logging context code (#8935)Patrick Cloke2020-12-141-1/+1
|
* Apply an IP range blacklist to push and key revocation requests. (#8821)Patrick Cloke2020-12-021-1/+1
| | | | | | | | | | | | Replaces the `federation_ip_range_blacklist` configuration setting with an `ip_range_blacklist` setting with wider scope. It now applies to: * Federation * Identity servers * Push notifications * Checking key validitity for third-party invite events The old `federation_ip_range_blacklist` setting is still honored if present, but with reduced scope (it only applies to federation and identity servers).
* Don't instansiate Requester directly (#8614)Erik Johnston2020-10-221-2/+2
|
* Remove the deprecated Handlers object (#8494)Patrick Cloke2020-10-091-1/+1
| | | All handlers now available via get_*_handler() methods on the HomeServer.
* Convert simple_update* and simple_select* to async (#8173)Patrick Cloke2020-08-271-29/+21
|
* Add a shadow-banned flag to users. (#8092)Patrick Cloke2020-08-141-1/+1
|
* Convert the roommember database to async/await. (#8070)Patrick Cloke2020-08-121-1/+17
|
* Convert federation client to async/await. (#7975)Patrick Cloke2020-07-301-1/+1
|
* Convert device handler to async/await (#7871)Patrick Cloke2020-07-171-16/+19
|
* Add option to enable encryption by default for new rooms (#7639)Andrew Morgan2020-06-101-1/+1
| | | | | | | | | Fixes https://github.com/matrix-org/synapse/issues/2431 Adds config option `encryption_enabled_by_default_for_room_type`, which determines whether encryption should be enabled with the default encryption algorithm in private or public rooms upon creation. Whether the room is private or public is decided based upon the room creation preset that is used. Part of this PR is also pulling out all of the individual instances of `m.megolm.v1.aes-sha2` into a constant variable to eliminate typos ala https://github.com/matrix-org/synapse/pull/7637 Based on #7637
* Process cross-signing keys when resyncing device lists (#7594)Brendan Abolivier2020-06-011-0/+56
| | | It looks like `user_device_resync` was ignoring cross-signing keys from the results received from the remote server. This patch fixes this, by processing these keys using the same process `_handle_signing_key_updates` does (and effectively factor that part out of that function).
* Add ability to wait for replication streams (#7542)Erik Johnston2020-05-221-2/+2
| | | | | | | 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.
* Retry to sync out of sync device lists (#7453)Brendan Abolivier2020-05-211-1/+62
| | | | | | | | | | | When a call to `user_device_resync` fails, we don't currently mark the remote user's device list as out of sync, nor do we retry to sync it. https://github.com/matrix-org/synapse/pull/6776 introduced some code infrastructure to mark device lists as stale/out of sync. This commit uses that code infrastructure to mark device lists as out of sync if processing an incoming device list update makes the device handler realise that the device list is out of sync, but we can't resync right now. It also adds a looping call to retry all failed resync every 30s. This shouldn't cause too much spam in the logs as this commit also removes the "Failed to handle device list update for..." warning logs when catching `NotRetryingDestination`. Fixes #7418
* async/await is_server_admin (#7363)Andrew Morgan2020-05-011-2/+4
|
* Add a `make_event_from_dict` method (#6858)Richard van der Hoff2020-02-071-3/+3
| | | | | | | ... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
* convert to async: FederationHandler.on_receive_pduRichard van der Hoff2019-12-111-5/+9
| | | | | | | and associated functions: * on_receive_pdu * handle_queued_pdus * get_missing_events_for_pdu
* Fixup testsErik Johnston2019-12-061-11/+5
|
* Factor out an _AsyncEventContextImpl (#6298)Richard van der Hoff2019-11-011-1/+3
| | | | | | The intention here is to make it clearer which fields we can expect to be populated when: notably, that the _event_type etc aren't used for the synchronous impl of EventContext.
* Review commentsErik Johnston2019-10-301-4/+7
|
* Move logging utilities out of the side drawer of util/ and into logging/ (#5606)Amber Brown2019-07-041-1/+1
|
* Run Black on the tests again (#5170)Amber Brown2019-05-101-1/+0
|
* Fix some tests which leaked logcontextsRichard van der Hoff2018-11-191-2/+2
|
* Clean up event accesses and testsErik Johnston2018-11-021-1/+1
| | | | | This is in preparation to refactor FrozenEvent to support different event formats for different room versions
* Remove redundant, failing, testRichard van der Hoff2018-09-271-106/+0
| | | | | | | This test didn't do what it claimed to do, and what it claimed to do was the same as test_cant_hide_direct_ancestors anyway. This stuff is tested by sytest anyway.
* Include eventid in log lines when processing incoming federation ↵Richard van der Hoff2018-09-271-12/+16
| | | | | | | | | | | transactions (#3959) when processing incoming transactions, it can be hard to see what's going on, because we process a bunch of stuff in parallel, and because we may end up recursively working our way through a chain of three or four events. This commit creates a way to use logcontexts to add the relevant event ids to the log lines.
* Run tests under PostgreSQL (#3423)Amber Brown2018-08-131-1/+4
|
* Make the rest of the .iterwhatever go away (#3562)Amber Brown2018-07-211-2/+1
|
* run isortAmber Brown2018-07-091-5/+5
|
* pep8Amber Brown2018-06-271-5/+2
|
* stylistic cleanupAmber Brown2018-06-271-6/+18
|
* cleanupsAmber Brown2018-06-271-7/+6
|
* handle federation not telling us about prev_eventsAmber Brown2018-06-271-0/+235