summary refs log tree commit diff
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix handling of User-Agent headers with bad utf-8. (#8632)Erik Johnston2020-10-231-6/+18
|
* Fix email notifications for invites without local state. (#8627)Erik Johnston2020-10-231-0/+29
| | | | This can happen if e.g. the room invited into is no longer on the server (or if all users left the room).
* Don't instansiate Requester directly (#8614)Erik Johnston2020-10-225-11/+11
|
* Merge pull request #8572 from matrix-org/rav/cache_hacking/2Richard van der Hoff2020-10-213-237/+385
|\ | | | | Push some deferred wrangling down into DeferredCache
| * Add some more testsRichard van der Hoff2020-10-212-0/+147
| |
| * Push some deferred wrangling down into DeferredCacheRichard van der Hoff2020-10-212-12/+11
| |
| * Combine the two sets of tests for CacheDescriptorRichard van der Hoff2020-10-212-228/+230
| |
* | Limit AS transactions to 100 events (#8606)Will Hunt2020-10-211-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | * Limit AS transactions to 100 events * Update changelog.d/8606.feature Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Add tests * Update synapse/appservice/scheduler.py Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* | Separate the TCP and terse JSON formatting code. (#8587)Patrick Cloke2020-10-211-1/+1
|/ | | | This should (theoretically) allow for using the TCP code with a different output type and make it easier to use the JSON code with files / console.
* Remove some extraneous @unittest.INFOs on unit tests (#8592)Andrew Morgan2020-10-202-2/+0
|
* Fix 'LruCache' object has no attribute '_on_resize' (#8591)Richard van der Hoff2020-10-191-1/+7
| | | We need to make sure we are readu for the `set_cache_factor` callback.
* Add `DeferredCache.get_immediate` method (#8568)Richard van der Hoff2020-10-191-4/+23
| | | | | | | | | | | * Add `DeferredCache.get_immediate` method A bunch of things that are currently calling `DeferredCache.get` are only really interested in the result if it's completed. We can optimise and simplify this case. * Remove unused 'default' parameter to DeferredCache.get() * another get_immediate instance
* Include a simple message in email notifications that include encrypted ↵Patrick Cloke2020-10-191-1/+14
| | | | content (#8545)
* Make LruCache register its own metrics (#8561)Richard van der Hoff2020-10-161-2/+2
| | | | | rather than have everything that instantiates an LruCache manage metrics separately, have LruCache do it itself.
* Merge pull request #8535 from matrix-org/rav/third_party_events_updatesRichard van der Hoff2020-10-151-4/+24
|\ | | | | Support modifying event content from ThirdPartyRules modules
| * guard against accidental modificationRichard van der Hoff2020-10-131-0/+20
| |
| * Allow ThirdPartyRules modules to replace event contentRichard van der Hoff2020-10-131-4/+4
| | | | | | | | Support returning a new event dict from `check_event_allowed`.
* | Solidify the HomeServer constructor. (#8515)Jonathan de Jong2020-10-155-20/+23
| | | | | | | | | | | | This implements a more standard API for instantiating a homeserver and moves some of the dependency injection into the test suite. More concretely this stops using `setattr` on all `kwargs` passed to `HomeServer`.
* | Send some ephemeral events to appservices (#8437)Will Hunt2020-10-152-23/+62
| | | | | | Optionally sends typing, presence, and read receipt information to appservices.
* | Merge pull request #8548 from matrix-org/rav/deferred_cacheRichard van der Hoff2020-10-154-118/+140
|\ \ | | | | | | Rename Cache to DeferredCache, and related changes
| * | Combine the two sets of DeferredCache testsRichard van der Hoff2020-10-142-74/+75
| | |
| * | move DeferredCache into its own moduleRichard van der Hoff2020-10-144-46/+67
| | |
| * | Rename Cache->DeferredCacheRichard van der Hoff2020-10-143-9/+9
| |/
* | Merge pull request #8537 from matrix-org/rav/simplify_locally_reject_inviteRichard van der Hoff2020-10-154-5/+4
|\ \ | | | | | | Simplify `_locally_reject_invite`
| * | Simplify `_locally_reject_invite`Richard van der Hoff2020-10-133-4/+4
| | | | | | | | | | | | | | | 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.
* | Add basic tests for sync/pagination with vector clock tokens. (#8488)Erik Johnston2020-10-142-1/+248
| | | | | | | | | | These are tests for #8439
* | Fix not sending events over federation when using sharded event persisters ↵Erik Johnston2020-10-141-3/+10
|/ | | | | | | | | | | | | | | | | (#8536) * Fix outbound federaion with multiple event persisters. We incorrectly notified federation senders that the minimum persisted stream position had advanced when we got an `RDATA` from an event persister. Notifying of federation senders already correctly happens in the notifier, so we just delete the offending line. * Change some interfaces to use RoomStreamToken. By enforcing use of `RoomStreamTokens` we make it less likely that people pass in random ints that they got from somewhere random.
* Move additional tasks to the background worker, part 4 (#8513)Patrick Cloke2020-10-131-34/+14
|
* Fix message duplication if something goes wrong after persisting the event ↵Erik Johnston2020-10-133-3/+167
| | | | | (#8476) Should fix #3365.
* Make event persisters periodically announce position over replication. (#8499)Erik Johnston2020-10-121-9/+16
| | | | | Currently background proccesses stream the events stream use the "minimum persisted position" (i.e. `get_current_token()`) rather than the vector clock style tokens. This is broadly fine as it doesn't matter if the background processes lag a small amount. However, in extreme cases (i.e. SyTests) where we only write to one event persister the background processes will never make progress. This PR changes it so that the `MultiWriterIDGenerator` keeps the current position of a given instance as up to date as possible (i.e using the latest token it sees if its not in the process of persisting anything), and then periodically announces that over replication. This then allows the "minimum persisted position" to advance, albeit with a small lag.
* Clean-up some broken/unused code in the test framework (#8514)Patrick Cloke2020-10-092-70/+54
|
* Fix threadsafety in ThreadedMemoryReactorClock (#8497)Richard van der Hoff2020-10-091-4/+32
| | | | | | | | | | | | | | | | | | | | | This could, very occasionally, cause: ``` tests.test_visibility.FilterEventsForServerTestCase.test_large_room =============================================================================== [ERROR] Traceback (most recent call last): File "/src/tests/rest/media/v1/test_media_storage.py", line 86, in test_ensure_media_is_in_local_cache self.wait_on_thread(x) File "/src/tests/unittest.py", line 296, in wait_on_thread self.reactor.advance(0.01) File "/src/.tox/py35/lib/python3.5/site-packages/twisted/internet/task.py", line 826, in advance self._sortCalls() File "/src/.tox/py35/lib/python3.5/site-packages/twisted/internet/task.py", line 787, in _sortCalls self.calls.sort(key=lambda a: a.getTime()) builtins.ValueError: list modified during sort tests.rest.media.v1.test_media_storage.MediaStorageTests.test_ensure_media_is_in_local_cache ```
* Allow modules to create and send events into rooms (#8479)Andrew Morgan2020-10-092-1/+122
| | | | | This PR allows Synapse modules making use of the `ModuleApi` to create and send non-membership events into a room. This can useful to have modules send messages, or change power levels in a room etc. Note that they must send event through a user that's already in the room. The non-membership event limitation is currently arbitrary, as it's another chunk of work and not necessary at the moment.
* Remove the deprecated Handlers object (#8494)Patrick Cloke2020-10-0918-63/+36
| | | All handlers now available via get_*_handler() methods on the HomeServer.
* Invalidate the cache when an olm fallback key is uploaded (#8501)Hubert Chathi2020-10-081-0/+20
|
* Reduce serialization errors in MultiWriterIdGen (#8456)Erik Johnston2020-10-071-0/+1
| | | | | | We call `_update_stream_positions_table_txn` a lot, which is an UPSERT that can conflict in `REPEATABLE READ` isolation level. Instead of doing a transaction consisting of a single query we may as well run it outside of a transaction.
* Add support for MSC2697: Dehydrated devices (#8380)Hubert Chathi2020-10-071-0/+82
| | | | This allows a user to store an offline device on the server and then restore it at a subsequent login.
* Merge pull request #8463 from matrix-org/rav/clean_up_event_handlingRichard van der Hoff2020-10-072-2/+4
|\ | | | | Reduce inconsistencies between codepaths for membership and non-membership events.
| * kill off `send_nonmember_event`Richard van der Hoff2020-10-052-2/+4
| | | | | | | | This is now redundant, and we can just call `handle_new_client_event` directly.
* | Combine `SpamCheckerApi` with the more generic `ModuleApi`. (#8464)Richard van der Hoff2020-10-071-2/+2
| | | | | | | | | | Lots of different module apis is not easy to maintain. Rather than adding yet another ModuleApi(hs, hs.get_auth_handler()) incantation, first add an hs.get_module_api() method and use it where possible.
* | Add support for MSC2732: olm fallback keys (#8312)Hubert Chathi2020-10-061-0/+65
| |
* | Additional tests for third-party event rules (#8468)Richard van der Hoff2020-10-061-13/+71
| | | | | | | | | | | | | | | | | | * Optimise and test state fetching for 3p event rules Getting all the events at once is much more efficient than getting them individually * Test that 3p event rules can modify events
* | Merge pull request #8467 from matrix-org/rav/fix_3pevent_rulesRichard van der Hoff2020-10-061-1/+1
|\ \ | | | | | | Fix third-party event modules for `check_visibility_can_be_modified` check
| * | Fix third-party event modules for `check_visibility_can_be_modified` checkRichard van der Hoff2020-10-051-1/+1
| |/ | | | | | | | | | | PR #8292 tried to maintain backwards compat with modules which don't provide a `check_visibility_can_be_modified` method, but the tests weren't being run, and the check didn't work.
* / Update default room version to 6 (#8461)Richard van der Hoff2020-10-051-1/+10
|/ | | | Per https://github.com/matrix-org/matrix-doc/pull/2788
* Allow ThirdPartyEventRules modules to manipulate public room state (#8292)Andrew Morgan2020-10-052-13/+74
| | | | | This PR allows `ThirdPartyEventRules` modules to view, manipulate and block changes to the state of whether a room is published in the public rooms directory. While the idea of whether a room is in the public rooms list is not kept within an event in the room, `ThirdPartyEventRules` generally deal with controlling which modifications can happen to a room. Public rooms fits within that idea, even if its toggle state isn't controlled through a state event.
* Add logging on startup/shutdown (#8448)Erik Johnston2020-10-022-5/+11
| | | | | This is so we can tell what is going on when things are taking a while to start up. The main change here is to ensure that transactions that are created during startup get correctly logged like normal transactions.
* Speed up unit tests when using PostgreSQL (#8450)Erik Johnston2020-10-021-0/+4
|
* Allow background tasks to be run on a separate worker. (#8369)Patrick Cloke2020-10-022-2/+2
|
* Add unit test for event persister sharding (#8433)Erik Johnston2020-10-023-22/+306
|
* Add config option for always using "userinfo endpoint" for OIDC (#7658)BBBSnowball2020-10-011-2/+8
| | | This allows for connecting to certain IdPs, e.g. GitLab.
* Make token serializing/deserializing async (#8427)Erik Johnston2020-09-302-11/+28
| | | The idea is that in future tokens will encode a mapping of instance to position. However, we don't want to include the full instance name in the string representation, so instead we'll have a mapping between instance name and an immutable integer ID in the DB that we can use instead. We'll then do the lookup when we serialize/deserialize the token (we could alternatively pass around an `Instance` type that includes both the name and ID, but that turns out to be a lot more invasive).
* Merge pull request #8425 from matrix-org/rav/extremity_metricsRichard van der Hoff2020-09-301-8/+11
|\ | | | | Add an improved "forward extremities" metric
| * Rewrite BucketCollectorRichard van der Hoff2020-09-301-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | This was a bit unweildy for what I wanted: in particular, I wanted to assign each measurement straight into a bucket, rather than storing an intermediate Counter which didn't do any bucketing at all. I've replaced it with something that is hopefully a bit easier to use. (I'm not entirely sure what the difference between a HistogramMetricFamily and a GaugeHistogramMetricFamily is, but given our counters can go down as well as up the latter *sounds* more accurate?)
* | Allow additional SSO properties to be passed to the client (#8413)Patrick Cloke2020-09-301-55/+105
|/
* Various clean ups to room stream tokens. (#8423)Erik Johnston2020-09-292-10/+8
|
* Don't table scan events on worker startup (#8419)Erik Johnston2020-09-291-0/+18
| | | | | | | | | | | | | | | | | | | | * Fix table scan of events on worker startup. This happened because we assumed "new" writers had an initial stream position of 0, so the replication code tried to fetch all events written by the instance between 0 and the current position. Instead, set the initial position of new writers to the current persisted up to position, on the assumption that new writers won't have written anything before that point. * Consider old writers coming back as "new". Otherwise we'd try and fetch entries between the old stale token and the current position, even though it won't have written any rows. Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Filter out appservices from mau count (#8404)Will Hunt2020-09-291-1/+16
| | | This is an attempt to fix #8403.
* Only assert valid next_link params when provided (#8417)Andrew Morgan2020-09-291-0/+6
| | | | | | | Broken in https://github.com/matrix-org/synapse/pull/8275 and has yet to be put in a release. Fixes https://github.com/matrix-org/synapse/issues/8418. `next_link` is an optional parameter. However, we were checking whether the `next_link` param was valid, even if it wasn't provided. In that case, `next_link` was `None`, which would clearly not be a valid URL. This would prevent password reset and other operations if `next_link` was not provided, and the `next_link_domain_whitelist` config option was set.
* Fix handling of connection timeouts in outgoing http requests (#8400)Richard van der Hoff2020-09-292-6/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove `on_timeout_cancel` from `timeout_deferred` The `on_timeout_cancel` param to `timeout_deferred` wasn't always called on a timeout (in particular if the canceller raised an exception), so it was unreliable. It was also only used in one place, and to be honest it's easier to do what it does a different way. * Fix handling of connection timeouts in outgoing http requests Turns out that if we get a timeout during connection, then a different exception is raised, which wasn't always handled correctly. To fix it, catch the exception in SimpleHttpClient and turn it into a RequestTimedOutError (which is already a documented exception). Also add a description to RequestTimedOutError so that we can see which stage it failed at. * Fix incorrect handling of timeouts reading federation responses This was trapping the wrong sort of TimeoutError, so was never being hit. The effect was relatively minor, but we should fix this so that it does the expected thing. * Fix inconsistent handling of `timeout` param between methods `get_json`, `put_json` and `delete_json` were applying a different timeout to the response body to `post_json`; bring them in line and test. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Erik Johnston <erik@matrix.org>
* Add checks for postgres sequence consistency (#8402)Erik Johnston2020-09-282-4/+49
|
* Create a mechanism for marking tests "logcontext clean" (#8399)Richard van der Hoff2020-09-282-1/+17
|
* Fix occasional "Re-starting finished log context" from keyring (#8398)Richard van der Hoff2020-09-251-64/+56
| | | | | | | | | | | | | | | * Fix test_verify_json_objects_for_server_awaits_previous_requests It turns out that this wasn't really testing what it thought it was testing (in particular, `check_context` was turning failures into success, which was making the tests pass even though it wasn't clear they should have been. It was also somewhat overcomplex - we can test what it was trying to test without mocking out perspectives servers. * Fix warnings about finished logcontexts in the keyring We need to make sure that we finish the key fetching magic before we run the verifying code, to ensure that we don't mess up our logcontexts.
* Allow existing users to login via OpenID Connect. (#8345)Tdxdxoz2020-09-251-0/+35
| | | | | | | Co-authored-by: Benjamin Koch <bbbsnowball@gmail.com> This adds configuration flags that will match a user to pre-existing users when logging in via OpenID Connect. This is useful when switching to an existing SSO system.
* Fix MultiWriteIdGenerator's handling of restarts. (#8374)Erik Johnston2020-09-241-8/+111
| | | | | | | | | | | | | | | | | | | On startup `MultiWriteIdGenerator` fetches the maximum stream ID for each instance from the table and uses that as its initial "current position" for each writer. This is problematic as a) it involves either a scan of events table or an index (neither of which is ideal), and b) if rows are being persisted out of order elsewhere while the process restarts then using the maximum stream ID is not correct. This could theoretically lead to race conditions where e.g. events that are persisted out of order are not sent down sync streams. We fix this by creating a new table that tracks the current positions of each writer to the stream, and update it each time we finish persisting a new entry. This is a relatively small overhead when persisting events. However for the cache invalidation stream this is a much bigger relative overhead, so instead we note that for invalidation we don't actually care about reliability over restarts (as there's no caches to invalidate) and simply don't bother reading and writing to the new table in that particular case.
* Add EventStreamPosition type (#8388)Erik Johnston2020-09-241-3/+9
| | | | | | | | | | | | | | The idea is to remove some of the places we pass around `int`, where it can represent one of two things: 1. the position of an event in the stream; or 2. a token that partitions the stream, used as part of the stream tokens. The valid operations are then: 1. did a position happen before or after a token; 2. get all events that happened before or after a token; and 3. get all events between two tokens. (Note that we don't want to allow other operations as we want to change the tokens to be vector clocks rather than simple ints)
* Use `async with` for ID gens (#8383)Erik Johnston2020-09-231-25/+41
| | | This will allow us to hit the DB after we've finished using the generated stream ID.
* Fixed a bug with reactivating users with the admin API (#8362)Dirk Klimpel2020-09-221-0/+14
| | | | | | | Fixes: #8359 Trying to reactivate a user with the admin API (`PUT /_synapse/admin/v2/users/<user_name>`) causes an internal server error. Seems to be a regression in #8033.
* Admin API for reported events (#8217)Dirk Klimpel2020-09-221-0/+382
| | | Add an admin API to read entries of table `event_reports`. API: `GET /_synapse/admin/v1/event_reports`
* Create function to check for long names in devices (#8364)Dionysis Grigoropoulos2020-09-222-1/+12
| | | | | | | | | * Create a new function to verify that the length of a device name is under a certain threshold. * Refactor old code and tests to use said function. * Verify device name length during registration of device * Add a test for the above Signed-off-by: Dionysis Grigoropoulos <dgrig@erethon.com>
* Admin API for querying rooms where a user is a member (#8306)Dirk Klimpel2020-09-181-2/+94
| | | | Add a new admin API `GET /_synapse/admin/v1/users/<user_id>/joined_rooms` to list all rooms where a user is a member.
* Catch-up after Federation Outage (bonus): Catch-up on Synapse Startup (#8322)reivilibre2020-09-181-0/+99
| | | | | | | | | | Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> * Fix _set_destination_retry_timings This came about because the code assumed that retry_interval could not be NULL — which has been challenged by catch-up.
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-189-9/+9
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Allow appservice users to /login (#8320)Will Hunt2020-09-181-1/+133
| | | | | Add ability for ASes to /login using the `uk.half-shot.msc2778.login.application_service` login `type`. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Update test logging to be able to accept braces (#8335)Jonathan de Jong2020-09-181-2/+1
|
* Catch-up after Federation Outage (split, 4): catch-up loop (#8272)reivilibre2020-09-152-0/+170
|
* Add the topic and avatar to the room details admin API (#8305)Tulir Asokan2020-09-141-0/+2
|
* Merge tag 'v1.20.0rc3' into developPatrick Cloke2020-09-113-0/+161
|\ | | | | | | | | | | | | | | | | | | Synapse 1.20.0rc3 (2020-09-11) ============================== Bugfixes -------- - Fix a bug introduced in v1.20.0rc1 where the wrong exception was raised when invalid JSON data is encountered. ([\#8291](https://github.com/matrix-org/synapse/issues/8291))
| * Fix the exception that is raised when invalid JSON is encountered. (#8291)Patrick Cloke2020-09-103-0/+161
| |
* | Make `StreamToken.room_key` be a `RoomStreamToken` instance. (#8281)Erik Johnston2020-09-111-1/+4
| |
* | Use TLSv1.2 for fake servers in tests (#8208)Dan Callaghan2020-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some Linux distros have begun disabling TLSv1.0 and TLSv1.1 by default for security reasons, for example in Fedora 33 onwards: https://fedoraproject.org/wiki/Changes/StrongCryptoSettings2 Use TLSv1.2 for the fake TLS servers created in the test suite, to avoid failures due to OpenSSL disallowing TLSv1.0: <twisted.python.failure.Failure OpenSSL.SSL.Error: [('SSL routines', 'ssl_choose_client_version', 'unsupported protocol')]> Signed-off-by: Dan Callaghan <djc@djc.id.au>
* | Show a confirmation page during user password reset (#8004)Andrew Morgan2020-09-103-3/+45
| | | | | | | | | | This PR adds a confirmation step to resetting your user password between clicking the link in your email and your password actually being reset. This is to better align our password reset flow with the industry standard of requiring a confirmation from the user after email validation.
* | Do not error when thumbnailing invalid files (#8236)Patrick Cloke2020-09-091-10/+29
| | | | | | | | If a file cannot be thumbnailed for some reason (e.g. the file is empty), then catch the exception and convert it to a reasonable error message for the client.
* | Fixup pusher pool notifications (#8287)Erik Johnston2020-09-091-0/+1
| | | | | | | | | | `pusher_pool.on_new_notifications` expected a min and max stream ID, however that was not what we were passing in. Instead, let's just pass it the current max stream ID and have it track the last stream ID it got passed. I believe that it mostly worked as we called the function for every event. However, it would break for events that got persisted out of order, i.e, that were persisted but the max stream ID wasn't incremented as not all preceding events had finished persisting, and push for that event would be delayed until another event got pushed to the effected users.
* | Revert "Fixup pusher pool notifications"Erik Johnston2020-09-091-1/+0
| | | | | | | | This reverts commit e7fd336a53a4ca489cdafc389b494d5477019dc0.
* | Fixup pusher pool notificationsErik Johnston2020-09-091-0/+1
| |
* | Don't remember `enabled` of deleted push rules and properly return 404 for ↵reivilibre2020-09-091-0/+448
| | | | | | | | | | | | | | missing push rules in `.../actions` and `.../enabled` (#7796) Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* | Add a config option for validating 'next_link' parameters against a domain ↵Andrew Morgan2020-09-081-7/+96
| | | | | | | | | | | | | | | | | | | | | | whitelist (#8275) This is a config option ported over from DINUM's Sydent: https://github.com/matrix-org/sydent/pull/285 They've switched to validating 3PIDs via Synapse rather than Sydent, and would like to retain this functionality. This original purpose for this change is phishing prevention. This solution could also potentially be replaced by a similar one to https://github.com/matrix-org/synapse/pull/8004, but across all `*/submit_token` endpoint. This option may still be useful to enterprise even with that safeguard in place though, if they want to be absolutely sure that their employees don't follow links to other domains.
* | Fix `MultiWriterIdGenerator.current_position`. (#8257)Erik Johnston2020-09-081-0/+50
| | | | | | | | | | It did not correctly handle IDs finishing being persisted out of order, resulting in the `current_position` lagging until new IDs are persisted.
* | Allow for make_awaitable's return value to be re-used. (#8261)Patrick Cloke2020-09-0811-70/+55
| |
* | Rename 'populate_stats_process_rooms_2' background job back to ↵Andrew Morgan2020-09-081-9/+6
| | | | | | | | | | | | | | 'populate_stats_process_rooms' again (#8243) Fixes https://github.com/matrix-org/synapse/issues/8238 Alongside the delta file, some changes were also necessary to the codebase to remove references to the now defunct `populate_stats_process_rooms_2` background job. Thankfully the latter doesn't seem to have made it into any documentation yet :)
* | Add tests for `last_successful_stream_ordering` (#8258)reivilibre2020-09-071-0/+76
| |
* | Catch-up after Federation Outage (split, 1) (#8230)reivilibre2020-09-041-0/+82
|/ | | Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
* Stop sub-classing object (#8249)Patrick Cloke2020-09-0421-48/+48
|
* Re-implement unread counts (again) (#8059)Brendan Abolivier2020-09-023-8/+167
|
* Add /user/{user_id}/shared_rooms/ api (#7785)Will Hunt2020-09-021-0/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add shared_rooms api * Add changelog * Add . * Wrap response in {"rooms": } * linting * Add unstable_features key * Remove options from isort that aren't part of 5.x `-y` and `-rc` are now default behaviour and no longer exist. `dont-skip` is no longer required https://timothycrosley.github.io/isort/CHANGELOG/#500-penny-july-4-2020 * Update imports to make isort happy * Add changelog * Update tox.ini file with correct invocation * fix linting again for isort * Vendor prefix unstable API * Fix to match spec * import Codes * import Codes * Use FORBIDDEN * Update changelog.d/7785.feature Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Implement get_shared_rooms_for_users * a comma * trailing whitespace * Handle the easy feedback * Switch to using runInteraction * Add tests * Feedback * Seperate unstable endpoint from v2 * Add upgrade node * a line * Fix style by adding a blank line at EOF. * Update synapse/storage/databases/main/user_directory.py Co-authored-by: Tulir Asokan <tulir@maunium.net> * Update synapse/storage/databases/main/user_directory.py Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Update UPGRADE.rst Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Fix UPGRADE/CHANGELOG unstable paths unstable unstable unstable Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Co-authored-by: Tulir Asokan <tulir@maunium.net> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Tulir Asokan <tulir@maunium.net>
* Convert the well known resolver to async (#8214)Patrick Cloke2020-09-011-6/+18
|
* Convert additional databases to async/await part 2 (#8200)Patrick Cloke2020-09-011-4/+3
|
* Make MultiWriterIDGenerator work for streams that use negative stream IDs ↵Erik Johnston2020-09-011-0/+105
| | | | | (#8203) This is so that we can use it for the backfill events stream.
* Rename `get_e2e_device_keys` to better reflect its purpose (#8205)Richard van der Hoff2020-08-291-3/+5
| | | | | | | | | | | ... and to show that it does something slightly different to `_get_e2e_device_keys_txn`. `include_all_devices` and `include_deleted_devices` were never used (and `include_deleted_devices` was broken, since that would cause `None`s in the result which were not handled in the loop below. Add some typing too.
* Convert ReadWriteLock to async/await. (#8202)Patrick Cloke2020-08-281-2/+4
|
* Ensure that the OpenID Connect remote ID is a string. (#8190)Patrick Cloke2020-08-281-2/+39
|
* Do not yield on awaitables in tests. (#8193)Patrick Cloke2020-08-2714-131/+229
|
* Convert stats and related calls to async/await (#8192)Patrick Cloke2020-08-275-29/+28
|
* Convert simple_delete to async/await. (#8191)Patrick Cloke2020-08-271-2/+4
|
* Fix missing _add_persisted_position (#8179)Erik Johnston2020-08-271-3/+49
| | | This was forgotten in #8164.
* Convert additional database methods to async (select list, search, ↵Patrick Cloke2020-08-272-5/+6
| | | | insert_many, delete_*) (#8168)
* Convert simple_update* and simple_select* to async (#8173)Patrick Cloke2020-08-275-43/+47
|
* Reduce run-times of tests by advancing the reactor less (#7757)Andrew Morgan2020-08-276-8/+8
|
* Remove remaining is_guest argument uses from get_room_data calls (#8181)Andrew Morgan2020-08-261-10/+2
| | | | | | | #8174 removed the `is_guest` parameter from `get_room_data`, at the same time that #8157 was merged using it, colliding together to break unit tests on develop. This PR removes the `is_guest` parameter from the call in the broken test. Uses the same changelog as #8174.
* Do not propagate typing notifications from shadow-banned users. (#8176)Patrick Cloke2020-08-263-8/+70
|
* Remove unused parameter from, and add safeguard in, get_room_data (#8174)Andrew Morgan2020-08-261-1/+1
| | | | | | Small cleanup PR. * Removed the unused `is_guest` argument * Added a safeguard to a (currently) impossible code path, fixing static checking at the same time.
* Do not propagate profile changes of shadow-banned users into rooms. (#8157)Patrick Cloke2020-08-262-157/+274
|
* Convert simple_select_one and simple_select_one_onecol to async (#8162)Patrick Cloke2020-08-268-40/+103
|
* Fix rate limiting unit tests. (#8167)Patrick Cloke2020-08-261-13/+14
| | | | These were passing on the release-v1.19.1 branch but started failing once merged to develop.
* Add functions to `MultiWriterIdGen` used by events stream (#8164)Erik Johnston2020-08-251-0/+36
|
* Merge tag 'v1.19.1rc1' into developBrendan Abolivier2020-08-252-4/+93
|\ | | | | | | | | | | | | | | | | | | | | 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-242-4/+93
| |
| * Do not apply ratelimiting on joins to appservices (#8139)Will Hunt2020-08-241-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>
* | Stop shadow-banned users from sending non-member events. (#8142)Patrick Cloke2020-08-241-1/+54
| |
* | Allow capping a room's retention policy (#8104)Brendan Abolivier2020-08-241-28/+66
| |
* | Fix flaky shadow-ban tests. (#8152)Patrick Cloke2020-08-241-1/+3
| |
* | Don't fail /submit_token requests on incorrect session ID if ↵Brendan Abolivier2020-08-241-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | request_token_inhibit_3pid_errors is turned on (#7991) * Don't raise session_id errors on submit_token if request_token_inhibit_3pid_errors is set * Changelog * Also wait some time before responding to /requestToken * Incorporate review * Update synapse/storage/databases/main/registration.py Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Incorporate review Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* | 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>
* | Allow denying or shadow banning registrations via the spam checker (#8034)Patrick Cloke2020-08-203-7/+69
| |
* | Stop shadow-banned users from sending invites. (#8095)Patrick Cloke2020-08-201-0/+100
| |
* | Switch the JSON byte producer from a pull to a push producer. (#8116)Patrick Cloke2020-08-193-14/+9
| |
* | Remove the unused inlineCallbacks code-paths in the caching code (#8119)Patrick Cloke2020-08-191-6/+6
| |
* | Separate `get_current_token` into two. (#8113)Erik Johnston2020-08-191-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | The function is used for two purposes: 1) for subscribers of streams to get a token they can use to get further updates with, and 2) for replication to track position of the writers of the stream. For streams with a single writer the two scenarios produce the same result, however the situation becomes complicated for streams with multiple writers. The current `MultiWriterIdGenerator` does not correctly handle the first case (which is not an issue as its only used for the `caches` stream which nothing subscribes to outside of replication).
* | Convert events worker database to async/await. (#8071)Patrick Cloke2020-08-182-4/+5
| |
* | Remove : from allowed client_secret chars (#8101)Andrew Morgan2020-08-181-3/+0
| | | | | | | | | | | | | | Closes: https://github.com/matrix-org/synapse/issues/6766 Equivalent Sydent PR: https://github.com/matrix-org/sydent/pull/309 I believe it's now time to remove the extra allowed `:` from `client_secret` parameters.
* | Iteratively encode JSON responses to avoid blocking the reactor. (#8013)Patrick Cloke2020-08-181-1/+0
| |
* | Convert some of the general database methods to async (#8100)Patrick Cloke2020-08-177-30/+44
| |
* | Use the default templates when a custom template file cannot be found (#8037)Andrew Morgan2020-08-171-0/+82
| | | | | | Fixes https://github.com/matrix-org/synapse/issues/6583
* | Convert stream database to async/await. (#8074)Patrick Cloke2020-08-172-34/+17
| |
* | Add a shadow-banned flag to users. (#8092)Patrick Cloke2020-08-145-7/+11
| |
* | Fix unawaited coroutine error in tests. (#8072)Patrick Cloke2020-08-131-10/+20
|/
* Convert the roommember database to async/await. (#8070)Patrick Cloke2020-08-121-1/+17
|
* Convert devices database to async/await. (#8069)Patrick Cloke2020-08-123-23/+39
|
* Add type hints to handlers.message and events.builder (#8067)Erik Johnston2020-08-121-1/+3
|
* Convert account data, device inbox, and censor events databases to ↵Patrick Cloke2020-08-121-1/+2
| | | | async/await (#8063)
* Convert appservice, group server, profile and more databases to async (#8066)Patrick Cloke2020-08-121-12/+12
|
* Convert tags and metrics databases to async/await (#8062)Patrick Cloke2020-08-111-1/+4
|
* Converts event_federation and registration databases to async/await (#8061)Patrick Cloke2020-08-113-13/+24
|
* Add an assertion on prev_events in create_new_client_event (#8041)Richard van der Hoff2020-08-101-0/+4
| | | | | | I think this would have caught all the cases in https://github.com/matrix-org/synapse/issues/7642 - and I think a 500 makes more sense here than a 403
* Convert directory, e2e_room_keys, end_to_end_keys, monthly_active_users ↵Patrick Cloke2020-08-074-18/+45
| | | | database to async (#8042)
* Convert additional database stores to async/await (#8045)Patrick Cloke2020-08-071-2/+2
|
* Add health check endpoint (#8048)Erik Johnston2020-08-071-0/+34
|
* Revert #7736 (#8039)Brendan Abolivier2020-08-062-175/+2
|
* Convert some util functions to async (#8035)Patrick Cloke2020-08-061-33/+11
|
* Convert synapse.api to async/await (#8031)Patrick Cloke2020-08-069-68/+93
|
* Improve performance of the register endpoint (#8009)Patrick Cloke2020-08-061-1/+1
|
* Rename database classes to make some sense (#8033)Erik Johnston2020-08-0517-125/+129
|
* Convert streams to async. (#8014)Patrick Cloke2020-08-041-1/+1
|
* Prevent join->join membership transitions changing member count (#7977)Andrew Morgan2020-08-032-7/+63
| | | | | | | | | | | `StatsHandler` handles updates to the `current_state_delta_stream`, and updates room stats such as the amount of state events, joined users, etc. However, it counts every new join membership as a new user entering a room (and that user being in another room), whereas it's possible for a user's membership status to go from join -> join, for instance when they change their per-room profile information. This PR adds a check for join->join membership transitions, and bails out early, as none of the further checks are necessary at that point. Due to this bug, membership stats in many rooms have ended up being wildly larger than their true values. I am not sure if we also want to include a migration step which recalculates these statistics (possibly using the `_populate_stats_process_rooms` bg update). Bug introduced in the initial implementation https://github.com/matrix-org/synapse/pull/4338.
* Implement handling of HTTP HEAD requests. (#7999)Patrick Cloke2020-08-031-3/+42
|
* Convert the crypto module to async/await. (#8003)Patrick Cloke2020-08-031-23/+16
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2020-07-3125-170/+595
|\ | | | | | | erikj/add_rate_limiting_to_joins
| * Convert federation client to async/await. (#7975)Patrick Cloke2020-07-3010-52/+71
| |
| * Convert appservice to async. (#7973)Patrick Cloke2020-07-303-38/+75
| |
| * Convert some of the data store to async. (#7976)Patrick Cloke2020-07-303-19/+29
| |
| * Re-implement unread counts (#7736)Brendan Abolivier2020-07-292-2/+175
| |
| * Convert storage layer to async/await. (#7963)Patrick Cloke2020-07-285-45/+63
| |
| * Add an option to disable purge in delete room admin API (#7964)Dirk Klimpel2020-07-281-2/+55
| | | | | | | | | | | | Add option ```purge``` to ```POST /_synapse/admin/v1/rooms/<room_id>/delete``` Fixes: #3761 Signed-off-by: Dirk Klimpel dirk@klimpel.org
| * Option to allow server admins to join complex rooms (#7902)lugino-emeritus2020-07-281-0/+109
| | | | | | | | | | Fixes #7901. Signed-off-by: Niklas Tittjung <nik_t.01@web.de>
| * Convert a synapse.events to async/await. (#7949)Patrick Cloke2020-07-272-8/+10
| |
| * Convert groups and visibility code to async / await. (#7951)Patrick Cloke2020-07-271-6/+6
| |
| * Convert push to async/await. (#7948)Patrick Cloke2020-07-272-4/+8
| |
* | Add ratelimiting on joinsErik Johnston2020-07-311-0/+4
|/
* Convert tests/rest/admin/test_room.py to unix file endings (#7953)Andrew Morgan2020-07-271-1447/+1447
| | | | | Converts tests/rest/admin/test_room.py to have unix file endings after they were accidentally changed in #7613. Keeping the same changelog as #7613 as it hasn't gone out in a release yet.
* Support oEmbed for media previews. (#7920)Patrick Cloke2020-07-271-8/+134
| | | Fixes previews of Twitter URLs by using their oEmbed endpoint to grab content.
* Convert state resolution to async/await (#7942)Patrick Cloke2020-07-245-50/+73
|
* Convert more of the media code to async/await (#7873)Patrick Cloke2020-07-241-1/+4
|
* Return an empty body for OPTIONS requests. (#7886)Patrick Cloke2020-07-241-6/+6
|
* Downgrade warning on client disconnect to INFO (#7928)Richard van der Hoff2020-07-241-58/+1
| | | | Clients disconnecting before we finish processing the request happens from time to time. We don't need to yell about it
* Convert the federation agent and related code to async/await. (#7874)Patrick Cloke2020-07-232-37/+40
|
* Convert the message handler to async/await. (#7884)Patrick Cloke2020-07-228-102/+120
|
* Convert device handler to async/await (#7871)Patrick Cloke2020-07-173-28/+30
|
* Convert _base, profile, and _receipts handlers to async/await (#7860)Patrick Cloke2020-07-171-6/+11
|
* Add admin endpoint to get members in a room. (#7842)Michael Albert2020-07-161-0/+46
|
* Add ability to run multiple pusher instances (#7855)Erik Johnston2020-07-161-0/+193
| | | This reuses the same scheme as federation sender sharding
* Merge branch 'erikj/faster_typing' of github.com:matrix-org/synapse into developErik Johnston2020-07-151-2/+2
|\
| * Fix testsErik Johnston2020-07-151-2/+2
| |
* | Allow accounts to be re-activated from the admin APIs. (#7847)Patrick Cloke2020-07-151-0/+47
| |
* | Fix client reader sharding tests (#7853)Erik Johnston2020-07-154-173/+271
|/ | | | | | | | | | | | | | | * Fix client reader sharding tests * Newsfile * Fix typing * Update changelog.d/7853.misc Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> * Move mocking of http_client to tests Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Convert E2E key and room key handlers to async/await. (#7851)Patrick Cloke2020-07-152-237/+422
|
* Return the proper 403 Forbidden error during errors with JWT logins. (#7844)Patrick Cloke2020-07-151-21/+22
|
* Add delete room admin endpoint (#7613)Dirk Klimpel2020-07-142-0/+403
| | | | | | | | | | | | | | | | | | The Delete Room admin API allows server admins to remove rooms from server and block these rooms. `DELETE /_synapse/admin/v1/rooms/<room_id>` It is a combination and improvement of "[Shutdown room](https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/shutdown_room.md)" and "[Purge room](https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/purge_room.md)" API. Fixes: #6425 It also fixes a bug in [synapse/storage/data_stores/main/room.py](synapse/storage/data_stores/main/room.py) in ` get_room_with_stats`. It should return `None` if the room is unknown. But it returns an `IndexError`. https://github.com/matrix-org/synapse/blob/901b1fa561e3cc661d78aa96d59802cf2078cb0d/synapse/storage/data_stores/main/room.py#L99-L105 Related to: - #5575 - https://github.com/Awesome-Technologies/synapse-admin/issues/17 Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Add the option to validate the `iss` and `aud` claims for JWT logins. (#7827)Patrick Cloke2020-07-141-6/+100
|
* Support handling registration requests across multiple client readers. (#7830)Patrick Cloke2020-07-131-0/+133
|
* Do not use canonicaljson to magically handle decoding bytes from JSON. (#7802)Patrick Cloke2020-07-101-1/+1
|
* Add ability to shard the federation sender (#7798)Erik Johnston2020-07-102-0/+287
|
* Fix some spelling mistakes / typos. (#7811)Patrick Cloke2020-07-096-7/+7
|
* Add `HomeServer.signing_key` property (#7805)Richard van der Hoff2020-07-081-5/+2
| | | ... instead of duplicating `config.signing_key[0]` everywhere
* Stop populating unused table `local_invites`. (#7793)Richard van der Hoff2020-07-071-1/+0
| | | | | This table is no longer used, so we may as well stop populating it. Removing it would prevent people rolling back to older releases of Synapse, so that can happen in a future release.
* Convert the appservice handler to async/await. (#7775)Patrick Cloke2020-07-061-33/+35
|
* Don't ignore `set_tweak` actions with no explicit `value`. (#7766)reivilibre2020-07-061-0/+17
| | | | | | | | | | | | | | * Fix spec compliance; tweaks without values are valid (default to True, which is only concretely specified for `highlight`, but it seems only reasonable to generalise) * Changelog for 7766. * Add documentation to `tweaks_for_actions` May as well tidy up when I'm here. * Add a test for `tweaks_for_actions`
* isort 5 compatibility (#7786)Will Hunt2020-07-053-8/+2
| | | The CI appears to use the latest version of isort, which is a problem when isort gets a major version bump. Rather than try to pin the version, I've done the necessary to make isort5 happy with synapse.
* Merge different Resource implementation classes (#7732)Erik Johnston2020-07-032-9/+65
|
* Fix inconsistent handling of upper and lower cases of email addresses. (#7021)Dirk Klimpel2020-07-032-30/+194
| | | fixes #7016
* Hack to add push priority to push notifications (#7765)reivilibre2020-07-011-5/+347
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove obsolete comment about ancient temporary code Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> * Implement hack to set push priority based on whether the tweaks indicate the event might cause effects. * Changelog for 7765 Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> * Antilint * Add tests for push priority Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> * Update synapse/push/httppusher.py Co-authored-by: Brendan Abolivier <babolivier@matrix.org> * Antilint * Remove needless invites from tests. Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Back out MSC2625 implementation (#7761)Brendan Abolivier2020-07-012-45/+19
|
* Additional configuration options for auto-join rooms (#7763)Patrick Cloke2020-06-301-2/+210
|
* Yield during large v2 state res. (#7735)Erik Johnston2020-06-241-0/+9
| | | | | | | | | | | State res v2 across large data sets can be very CPU intensive, and if all the relevant events are in the cache the algorithm will run from start to finish within a single reactor tick. This can result in blocking the reactor tick for several seconds, which can have major repercussions on other requests. To fix this we simply add the occaisonal `sleep(0)` during iterations to yield execution until the next reactor tick. The aim is to only do this for large data sets so that we don't impact otherwise quick resolutions.=
* add org.matrix.login.jwt so that m.login.jwt can be deprecated (#7675)Sorunome2020-06-241-3/+7
|
* Allow local media to be marked as safe from being quarantined. (#7718)Patrick Cloke2020-06-221-72/+65
|
* Convert the typing handler to async/await. (#7679)Patrick Cloke2020-06-171-6/+7
|
* Fetch from the r0 media path instead of the unspecced v1. (#7714)Patrick Cloke2020-06-171-1/+1
|
* Implement unread counter (MSC2625) (#7673)Brendan Abolivier2020-06-172-19/+45
|\ | | | | Implementation of https://github.com/matrix-org/matrix-doc/pull/2625
| * Merge branch 'develop' into babolivier/mark_unreadBrendan Abolivier2020-06-152-21/+141
| |\
| * \ Merge branch 'develop' into babolivier/mark_unreadBrendan Abolivier2020-06-154-7/+110
| |\ \
| * | | LintBrendan Abolivier2020-06-121-3/+1
| | | |
| * | | Test that a mark_unread action updates the right counter when using a slave ↵Brendan Abolivier2020-06-121-0/+15
| | | | | | | | | | | | | | | | store
| * | | Remove debug loggingBrendan Abolivier2020-06-121-2/+0
| | | |
| * | | Test that a mark_unread action updates the right counterBrendan Abolivier2020-06-121-5/+16
| | | |
| * | | Fix testsBrendan Abolivier2020-06-102-17/+21
| | | |
* | | | Include a user agent in federation requests. (#7677)Patrick Cloke2020-06-161-0/+10
| | | |
* | | | Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-1610-23/+14
| | | |
* | | | Create a ListenerConfig object (#7681)Richard van der Hoff2020-06-165-19/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ended up being a bit more invasive than I'd hoped for (not helped by generic_worker duplicating some of the code from homeserver), but hopefully it's an improvement. The idea is that, rather than storing unstructured `dict`s in the config for the listener configurations, we instead parse it into a structured `ListenerConfig` object.
* | | | Merge branch 'master' into developBrendan Abolivier2020-06-162-0/+54
|\ \ \ \
| * | | | Wrap register_device coroutine in an ensureDeferred (#7684)Andrew Morgan2020-06-162-0/+54
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | Fixes https://github.com/matrix-org/synapse/issues/7683 Broke in: #7649 We had a `yield` acting on a coroutine. To be fair this one is a bit difficult to notice as there's a function in the middle that just passes the coroutine along.
* | | | Ensure the body is a string before comparing push rules. (#7701)Patrick Cloke2020-06-151-9/+30
| | | |
* | | | Ensure etag is a string for GET room_keys/version response (#7691)Hubert Chathi2020-06-151-0/+1
| |_|/ |/| |
* | | Discard RDATA from already seen positions. (#7648)Patrick Cloke2020-06-152-21/+141
| |/ |/|
* | Add option to enable encryption by default for new rooms (#7639)Andrew Morgan2020-06-104-7/+110
|/ | | | | | | | | 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
* Convert user directory handler and related classes to async/await. (#7640)Patrick Cloke2020-06-051-4/+4
|
* Add an option to disable autojoin for guest accounts (#6637)Travis Ralston2020-06-051-0/+10
| | | | Fixes https://github.com/matrix-org/synapse/issues/3177
* Allow new users to be registered via the admin API even if the monthly ↵Dirk Klimpel2020-06-051-15/+163
| | | | active user limit has been reached (#7263)
* Add device management to admin API (#7481)Dirk Klimpel2020-06-051-0/+541
| | | | | | | | | | - Admin is able to - change displaynames - delete devices - list devices - get device informations Fixes #7330
* Add support for webp thumbnailing (#7586)WGH2020-06-051-36/+99
| | | | | Closes #4382 Signed-off-by: Maxim Plotnikov <wgh@torlan.ru>
* Performance improvements and refactor of Ratelimiter (#7595)Andrew Morgan2020-06-058-68/+128
| | | | | | | | | | 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.
* Fix encryption algorithm typos in tests/comments (#7637)Andrew Morgan2020-06-042-6/+6
| | | | | | | | @uhoreg has confirmed these were both typos. They are only in comments and tests though, rather than anything critical. Introduced in: * https://github.com/matrix-org/synapse/pull/7157 * https://github.com/matrix-org/synapse/pull/5726
* Replace instances of reactor pumping with get_success. (#7619)Andrew Morgan2020-06-032-121/+151
| | | | | Calls `self.get_success` on all deferred methods instead of abusing `self.pump()`. This has the benefit of working with coroutines, as well as checking that method execution completed successfully. There are also a few small cleanups that I made in the process.
* Fix a bug in automatic user creation with m.login.jwt. (#7585)Olof Johansson2020-06-011-0/+153
|
* 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).
* Email notifications for new users when creating via the Admin API. (#7267)Dirk Klimpel2020-06-011-0/+75
|
* Add test for Linearizer.is_queued(..)Erik Johnston2020-05-271-0/+32
|
* Fix specifying cache factors via env vars with * in name. (#7580)Erik Johnston2020-05-271-0/+28
| | | | | This mostly applise to `*stateGroupCache*` and co. Broke in #6391.
* Don't apply cache factor to event cache. (#7578)Erik Johnston2020-05-271-0/+16
| | | | This is already correctly done when we instansiate the cache, but wasn't when it got reloaded (which always happens at least once on startup).
* Fix recording of federation stream token (#7564)Richard van der Hoff2020-05-261-0/+71
| | | | | | | | A couple of changes of significance: * remove the `_last_ack < federation_position` condition, so that updates will still be correctly processed after restart * Correctly wire up send_federation_ack to the right class.
* Optimise some references to hs.config (#7546)Richard van der Hoff2020-05-224-117/+129
| | | These are surprisingly expensive, and we only really need to do them at startup.
* Fix missing CORS headers on OPTION responses (#7560)Erik Johnston2020-05-221-0/+28
| | | Broke in #7534.
* Return 200 OK for all OPTIONS requests (#7534)Patrick Cloke2020-05-221-0/+53
|
* Add ability to wait for replication streams (#7542)Erik Johnston2020-05-225-8/+15
| | | | | | | 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.
* Convert sending mail to async/await. (#7557)Erik Johnston2020-05-221-2/+2
| | | | Mainly because sometimes the email push code raises exceptions where the stack traces have gotten lost, which is hopefully fixed by this.
* 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
* fix mypy for tests/replication (#7518)Richard van der Hoff2020-05-182-13/+7
|
* Fix limit logic for AccountDataStream (#7384)Richard van der Hoff2020-05-151-0/+117
| | | | | | Make sure that the AccountDataStream presents complete updates, in the right order. This is much the same fix as #7337 and #7358, but applied to a different stream.
* Support UI Authentication for OpenID Connect accounts (#7457)Patrick Cloke2020-05-151-5/+10
|