summary refs log tree commit diff
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix tests on develop (#8777)Erik Johnston2020-11-181-16/+0
| | | This was broken due to #8617 and #8761.
* Merge pull request #8761 from matrix-org/rav/test_request_renderingRichard van der Hoff2020-11-1758-813/+102
|\ | | | | Make `make_request` actually render the request
| * Remove redundant `HomeserverTestCase.render`Richard van der Hoff2020-11-1644-629/+0
| |
| * Remove redundant calls to `render()`Richard van der Hoff2020-11-1613-106/+32
| |
| * Make `make_request` actually render the requestRichard van der Hoff2020-11-169-68/+57
| | | | | | | | | | | | remove the stubbing out of `request.process`, so that `requestReceived` also renders the request via the appropriate resource. Replace render() with a stub for now.
| * Fix the URL in the URL preview testsRichard van der Hoff2020-11-161-19/+22
| | | | | | | | the preview resource is mointed at preview_url, not url_preview
* | Abstract shared SSO code. (#8765)Patrick Cloke2020-11-171-7/+7
| | | | | | De-duplicates code between the SAML and OIDC implementations.
* | Add admin API for logging in as a user (#8617)Erik Johnston2020-11-176-42/+265
|/
* Merge pull request #8757 from matrix-org/rav/pass_site_to_make_requestRichard van der Hoff2020-11-1616-88/+227
|\ | | | | Pass a Site into `make_request`
| * fixup testRichard van der Hoff2020-11-161-0/+1
| |
| * Merge branch 'develop' into rav/pass_site_to_make_requestRichard van der Hoff2020-11-169-33/+33
| |\
| * | use global make_request() directly where we have a custom ResourceRichard van der Hoff2020-11-1511-60/+154
| | | | | | | | | | | | | | | | | | Where we want to render a request against a specific Resource, call the global make_request() function rather than the one in HomeserverTestCase, allowing us to pass in an appropriate `Site`.
| * | fix dict handling for make_request()Richard van der Hoff2020-11-152-3/+2
| | |
| * | pass a Site into make_requestRichard van der Hoff2020-11-154-20/+68
| | |
| * | pass a Site into RestHelperRichard van der Hoff2020-11-152-6/+7
| | |
* | | Move `wait_until_result` into `FakeChannel` (#8758)Richard van der Hoff2020-11-162-25/+23
| |/ |/| | | | | FakeChannel has everything we need, and this more accurately models the real flow.
* | Rename `create_test_json_resource` to `create_test_resource` (#8759)Richard van der Hoff2020-11-166-23/+15
| | | | | | | | | | The root resource isn't necessarily a JsonResource, so rename this method accordingly, and update a couple of test classes to use the method rather than directly manipulating self.resource.
* | Add a `custom_headers` param to `make_request` (#8760)Richard van der Hoff2020-11-163-11/+23
|/ | | | Some tests want to set some custom HTTP request headers, so provide a way to do that before calling requestReceived().
* Add an admin API for users' media statistics (#8700)Dirk Klimpel2020-11-051-0/+485
| | | | | | | | Add `GET /_synapse/admin/v1/statistics/users/media` to get statisics about local media usage by users. Related to #6094 It is the first API for statistics. Goal is to avoid/reduce usage of sql queries like [Wiki analyzing Synapse](https://github.com/matrix-org/synapse/wiki/SQL-for-analyzing-Synapse-PostgreSQL-database-stats) Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Add `displayname` to Shared-Secret Registration for admins (#8722)Dirk Klimpel2020-11-052-8/+132
| | | Add `displayname` to Shared-Secret Registration for admins to `POST /_synapse/admin/v1/register`
* Consolidate purge table lists to prevent desyncronisation (#8713)Andrew Morgan2020-11-041-67/+38
| | | I idly noticed that these lists were out of sync with each other, causing us to miss a table in a test case (`local_invites`). Let's consolidate this list instead to prevent this from happening in the future.
* Block clients from sending server ACLs that lock the local server out. (#8708)Erik Johnston2020-11-031-0/+57
| | | Fixes #4042
* Implement and use an @lru_cache decorator (#8595)Richard van der Hoff2020-10-301-1/+59
| | | We don't always need the full power of a DeferredCache.
* Fail test cases if they fail to await all awaitables (#8690)Patrick Cloke2020-10-302-2/+38
|
* Fix race for concurrent downloads of remote media. (#8682)Erik Johnston2020-10-302-1/+278
| | | Fixes #6755
* Fix unit tests (#8689)Erik Johnston2020-10-291-1/+1
| | | | | * Fix unit tests * Newsfile
* Gracefully handle a pending logging connection during shutdown. (#8685)Patrick Cloke2020-10-291-0/+16
|
* Add ability for access tokens to belong to one user but grant access to ↵Erik Johnston2020-10-2910-33/+30
| | | | | | | | | | another user. (#8616) We do it this way round so that only the "owner" can delete the access token (i.e. `/logout/all` by the "owner" also deletes that token, but `/logout/all` by the "target user" doesn't). A future PR will add an API for creating such a token. When the target user and authenticated entity are different the `Processed request` log line will be logged with a: `{@admin:server as @bob:server} ...`. I'm not convinced by that format (especially since it adds spaces in there, making it harder to use `cut -d ' '` to chop off the start of log lines). Suggestions welcome.
* Support generating structured logs in addition to standard logs. (#8607)Patrick Cloke2020-10-295-400/+258
| | | | | | | This modifies the configuration of structured logging to be usable from the standard Python logging configuration. This also separates the formatting of logs from the transport allowing JSON logs to files or standard logs to sockets.
* Don't require hiredis to run unit tests (#8680)Erik Johnston2020-10-291-1/+10
|
* Add an admin APIs to allow server admins to list users' pushers (#8610)Dirk Klimpel2020-10-281-0/+124
| | | Add an admin API `GET /_synapse/admin/v1/users/<user_id>/pushers` like https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-pushers
* Tell Black to format code for Python 3.5 (#8664)Dan Callahan2020-10-275-6/+6
| | | | | | | | This allows trailing commas in multi-line arg lists. Minor, but we might as well keep our formatting current with regard to our minimum supported Python version. Signed-off-by: Dan Callahan <danc@element.io>
* Add admin API to list users' local media (#8647)Dirk Klimpel2020-10-271-0/+282
| | | Add admin API `GET /_synapse/admin/v1/users/<user_id>/media` to get information of users' uploaded files.
* Split admin API for reported events into a detail and a list view (#8539)Dirk Klimpel2020-10-261-13/+183
| | | | | | | | | | | | Split admin API for reported events in detail und list view. API was introduced with #8217 in synapse v.1.21.0. It makes the list (`GET /_synapse/admin/v1/event_reports`) less complex and provides a better overview. The details can be queried with: `GET /_synapse/admin/v1/event_reports/<report_id>`. It is similar to room and users API. It is a kind of regression in `GET /_synapse/admin/v1/event_reports`. `event_json` was removed. But the api was introduced one version before and it is an admin API (not under spec). Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Add an admin api to delete local media. (#8519)Dirk Klimpel2020-10-261-0/+568
| | | | | | Related to: #6459, #3479 Add `DELETE /_synapse/admin/v1/media/<server_name>/<media_id>` to delete a single file from server.
* Fix a bug in the joined_rooms admin API (#8643)Dirk Klimpel2020-10-261-1/+15
| | | | If the user was not in any rooms then the API returned the same error as if the user did not exist.
* Fix get|set_type_stream_id_for_appservice store functions (#8648)Will Hunt2020-10-261-0/+56
|
* Add field `total` to device list in admin API (#8644)Dirk Klimpel2020-10-261-0/+17
|
* Start fewer opentracing spans (#8640)Erik Johnston2020-10-261-12/+8
| | | | | | | #8567 started a span for every background process. This is good as it means all Synapse code that gets run should be in a span (unless in the sentinel logging context), but it means we generate about 15x the number of spans as we did previously. This PR attempts to reduce that number by a) not starting one for send commands to Redis, and b) deferring starting background processes until after we're sure they're necessary. I don't really know how much this will help.
* 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
| |\