summary refs log tree commit diff
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* 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
|
* Implement room version 6 (MSC2240). (#7506)Patrick Cloke2020-05-153-15/+9
|
* Strictly enforce canonicaljson requirements in a new room version (#7381)Patrick Cloke2020-05-141-1/+66
|
* Enforce MSC2209: auth rules for notifications in power level event (#7502)Patrick Cloke2020-05-141-0/+33
| | | | In a new room version, the "notifications" key of power level events are subject to restricted auth rules.
* Allow expired accounts to logout (#7443)Andrew Morgan2020-05-142-2/+103
|
* Merge tag 'v1.13.0rc2' into developRichard van der Hoff2020-05-142-46/+59
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synapse 1.13.0rc2 (2020-05-14) ============================== Bugfixes -------- - Fix a long-standing bug which could cause messages not to be sent over federation, when state events with state keys matching user IDs (such as custom user statuses) were received. ([\#7376](https://github.com/matrix-org/synapse/issues/7376)) - Restore compatibility with non-compliant clients during the user interactive authentication process, fixing a problem introduced in v1.13.0rc1. ([\#7483](https://github.com/matrix-org/synapse/issues/7483)) Internal Changes ---------------- - Fix linting errors in new version of Flake8. ([\#7470](https://github.com/matrix-org/synapse/issues/7470))
| * Stop `get_joined_users` corruption from custom statuses (#7376)Richard van der Hoff2020-05-141-1/+49
| | | | | | | | | | | | | | | | Fix a bug where the `get_joined_users` cache could be corrupted by custom status events (or other state events with a state_key matching the user ID). The bug was introduced by #2229, but has largely gone unnoticed since then. Fixes #7099, #7373.
| * Do not validate that the client dict is stable during UI Auth. (#7483)Patrick Cloke2020-05-131-45/+10
| | | | | | | | This backs out some of the validation for the client dictionary and logs if this changes during a user interactive authentication session instead.
| * Fix new flake8 errors (#7489)Patrick Cloke2020-05-131-1/+1
| | | | | | | | This is a cherry-pick of 1a1da60ad2c9172fe487cd38a164b39df60f4cb5 (#7470) to the release-v1.13.0 branch.
* | Clean up replication unit tests. (#7490)Erik Johnston2020-05-137-51/+15
| |
* | Shuffle persist event data store functions. (#7440)Erik Johnston2020-05-131-1/+2
| | | | | | | | | | | | | | | | | | | | The aim here is to get to a stage where we have a `PersistEventStore` that holds all the write methods used during event persistence, so that we can take that class out of the `DataStore` mixin and instansiate it separately. This will allow us to instansiate it on processes other than master, while also ensuring it is only available on processes that are configured to write to events stream. This is a bit of an architectural change, where we end up with multiple classes per data store (rather than one per data store we have now). We end up having: 1. Storage classes that provide high level APIs that can talk to multiple data stores. 2. Data store modules that consist of classes that must point at the same database instance. 3. Classes in a data store that can be instantiated on processes depending on config.
* | Fix new flake8 errors (#7470)Erik Johnston2020-05-121-1/+1
| |
* | Allow configuration of Synapse's cache without using synctl or environment ↵Amber Brown2020-05-119-18/+178
| | | | | | | | variables (#6391)
* | Merge branch 'release-v1.13.0' into developAndrew Morgan2020-05-111-88/+216
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * release-v1.13.0: Don't UPGRADE database rows RST indenting Put rollback instructions in upgrade notes Fix changelog typo Oh yeah, RST Absolute URL it is then Fix upgrade notes link Provide summary of upgrade issues in changelog. Fix ) Move next version notes from changelog to upgrade notes Changelog fixes 1.13.0rc1 Documentation on setting up redis (#7446) Rework UI Auth session validation for registration (#7455) Fix errors from malformed log line (#7454) Drop support for redis.dbid (#7450)
| * Rework UI Auth session validation for registration (#7455)Patrick Cloke2020-05-081-88/+216
| | | | | | | | Be less strict about validation of UI authentication sessions during registration to match client expecations.
* | Extend spam checker to allow for multiple modules (#7435)Andrew Morgan2020-05-081-2/+2
| |
* | Implement OpenID Connect-based login (#7256)Quentin Gliech2020-05-081-0/+565
| |
* | Add room details admin endpoint (#7317)Manuel Stahl2020-05-072-0/+52
| |
* | Merge branch 'release-v1.13.0' into developRichard van der Hoff2020-05-064-33/+53
|\|
| * Stop Auth methods from polling the config on every req. (#7420)Andrew Morgan2020-05-064-33/+53
| |
* | Merge branch 'release-v1.13.0' into developRichard van der Hoff2020-05-062-6/+120
|\|
| * Fix bug in EventContext.deserialize. (#7393)Erik Johnston2020-05-052-6/+120
| | | | | | | | This caused `prev_state_ids` to be incorrect if the state event was not replacing an existing state entry.
* | Fix catchup-on-reconnect for the Federation Stream (#7374)Richard van der Hoff2020-05-053-12/+94
| | | | | | | | looks like we managed to break this during the refactorathon.
* | Add MultiWriterIdGenerator. (#7281)Erik Johnston2020-05-041-0/+184
|/ | | | | | This will be used to coordinate stream IDs across multiple writers. Functions as the equivalent of both `StreamIdGenerator` and `SlavedIdTracker`.
* Convert synapse.server_notices to async/await. (#7394)Patrick Cloke2020-05-011-1/+1
|
* Thread through instance name to replication client. (#7369)Erik Johnston2020-05-013-6/+6
| | | For in memory streams when fetching updates on workers we need to query the source of the stream, which currently is hard coded to be master. This PR threads through the source instance we received via `POSITION` through to the update function in each stream, which can then be passed to the replication client for in memory streams.
* Use `stream.current_token()` and remove `stream_positions()` (#7172)Erik Johnston2020-05-014-34/+26
| | | | We move the processing of typing and federation replication traffic into their handlers so that `Stream.current_token()` points to a valid token. This allows us to remove `get_streams_to_replicate()` and `stream_positions()`.
* async/await is_server_admin (#7363)Andrew Morgan2020-05-014-62/+81
|
* Persist user interactive authentication sessions (#7302)Patrick Cloke2020-04-302-4/+44
| | | | | By persisting the user interactive authentication sessions to the database, this fixes situations where a user hits different works throughout their auth session and also allows sessions to persist through restarts of Synapse.
* Add instance name to RDATA/POSITION commands (#7364)Erik Johnston2020-04-292-2/+5
| | | | | This is primarily for allowing us to send those commands from workers, but for now simply allows us to ignore echoed RDATA/POSITION commands that we sent (we get echoes of sent commands when using redis). Currently we log a WARNING on the master process every time we receive an echoed RDATA.
* Don't relay REMOTE_SERVER_UP cmds to same conn. (#7352)Erik Johnston2020-04-291-0/+62
| | | | | | | | | | | | | | For direct TCP connections we need the master to relay REMOTE_SERVER_UP commands to the other connections so that all instances get notified about it. The old implementation just relayed to all connections, assuming that sending back to the original sender of the command was safe. This is not true for redis, where commands sent get echoed back to the sender, which was causing master to effectively infinite loop sending and then re-receiving REMOTE_SERVER_UP commands that it sent. The fix is to ensure that we only relay to *other* connections and not to the connection we received the notification from. Fixes #7334.
* Fix limit logic for EventsStream (#7358)Richard van der Hoff2020-04-298-48/+579
| | | | | | | | | | | | | | | | | | | * Factor out functions for injecting events into database I want to add some more flexibility to the tools for injecting events into the database, and I don't want to clutter up HomeserverTestCase with them, so let's factor them out to a new file. * Rework TestReplicationDataHandler This wasn't very easy to work with: the mock wrapping was largely superfluous, and it's useful to be able to inspect the received rows, and clear out the received list. * Fix AssertionErrors being thrown by EventsStream Part of the problem was that there was an off-by-one error in the assertion, but also the limit logic was too simple. Fix it all up and add some tests.
* Return total number of users and profile attributes in admin users endpoint ↵Manuel Stahl2020-04-282-0/+48
| | | | | (#6881) Signed-off-by: Manuel Stahl <manuel.stahl@awesome-technologies.de>
* Add some replication tests (#7278)Erik Johnston2020-04-282-11/+298
| | | | | | | Specifically some tests for the typing stream, which means we test streams that fetch missing updates via HTTP (rather than via the DB). We also shuffle things around a bit so that we create two separate `HomeServer` objects, rather than trying to insert a slaved store into places. Note: `test_typing.py` is heavily inspired by `test_receipts.py`
* Fix collation for postgres for unit tests (#7359)Richard van der Hoff2020-04-281-1/+4
| | | | When running the UTs against a postgres deatbase, we need to set the collation correctly.
* Revert "Revert "Merge pull request #7315 from ↵Brendan Abolivier2020-04-232-1/+62
| | | | | | matrix-org/babolivier/request_token"" This reverts commit 1adf6a55870aa08de272591ff49db9dc49738076.
* Another go at fixing one-word commands (#7326)Richard van der Hoff2020-04-221-0/+42
| | | I messed this up last time I tried (#7239 / e13c6c7).
* Extend StreamChangeCache to support multiple entities per stream ID (#7303)Richard van der Hoff2020-04-221-9/+60
| | | | | | | | | | | | | | | | | | | First some background: StreamChangeCache is used to keep track of what "entities" have changed since a given stream ID. So for example, we might use it to keep track of when the last to-device message for a given user was received [1], and hence whether we need to pull any to-device messages from the database on a sync [2]. Now, it turns out that StreamChangeCache didn't support more than one thing being changed at a given stream_id (this was part of the problem with #7206). However, it's entirely valid to send to-device messages to more than one user at a time. As it turns out, this did in fact work, because *some* methods of StreamChangeCache coped ok with having multiple things changing on the same stream ID, and it seems we never actually use the methods which don't work on the stream change caches where we allow multiple changes at the same stream ID. But that feels horribly fragile, hence: let's update StreamChangeCache to properly support this, and add some typing and some more tests while we're at it. [1]: https://github.com/matrix-org/synapse/blob/release-v1.12.3/synapse/storage/data_stores/main/deviceinbox.py#L301 [2]: https://github.com/matrix-org/synapse/blob/release-v1.12.3/synapse/storage/data_stores/main/deviceinbox.py#L47-L51
* Extend room admin api with additional attributes (#7225)Dirk Klimpel2020-04-222-592/+680
|
* Add ability to run replication protocol over redis. (#7040)Erik Johnston2020-04-221-2/+2
| | | This is configured via the `redis` config options.
* Do not treat display names as globs for push rules. (#7271)Patrick Cloke2020-04-161-0/+65
|
* Convert auth handler to async/await (#7261)Patrick Cloke2020-04-154-57/+104
|
* Allow specifying the value of Accept-Language header for URL previews (#7265)Andrew Morgan2020-04-151-0/+55
|
* Fix the parameters of a test fixture (#7243)Zay11Zay2020-04-141-1/+1
|
* Default PL100 to enable encryption in a room (#7230)Andrew Morgan2020-04-092-4/+297
|
* Do not allow a deactivated user to login via SSO. (#7240)Patrick Cloke2020-04-091-3/+39
|
* bg update to clear out duplicate outbound_device_list_pokes (#7193)Richard van der Hoff2020-04-071-0/+52
| | | | We seem to have some duplicates, which could do with being cleared out.
* Move client command handling out of TCP protocol (#7185)Erik Johnston2020-04-063-29/+25
| | | The aim here is to move the command handling out of the TCP protocol classes and to also merge the client and server command handling (so that we can reuse them for redis protocol). This PR simply moves the client paths to the new `ReplicationCommandHandler`, a future PR will move the server paths too.
* Server notices: Dissociate room creation/lookup from invite (#7199)Brendan Abolivier2020-04-041-12/+108
| | | | | | | | | Fixes #6815 Before figuring out whether we should alert a user on MAU, we call get_notice_room_for_user to get some info on the existing server notices room for this user. This function, if the room doesn't exist, creates it and invites the user in it. This means that, if we decide later that no server notice is needed, the user gets invited in a room with no message in it. This happens at every restart of the server, since the room ID returned by get_notice_room_for_user is cached. This PR fixes that by moving the inviting bit to a dedicated function, that's only called when the server actually needs to send a notice to the user. A potential issue with this approach is that the room that's created by get_notice_room_for_user doesn't match how that same function looks for an existing room (i.e. it creates a room that doesn't have an invite or a join for the current user in it, so it could lead to a new room being created each time a user syncs), but I'm not sure this is a problem given it's cached until the server restarts, so that function won't run very often. It also renames get_notice_room_for_user into get_or_create_notice_room_for_user to make what it does clearer.
* Merge pull request #7190 from matrix-org/rav/one_bg_update_at_a_timeRichard van der Hoff2020-04-032-13/+22
|\ | | | | Only run one background update at a time
| * Make do_next_background_update return a boolRichard van der Hoff2020-03-311-3/+3
| | | | | | | | returning a None or an int that we don't use is confusing.
| * Set a logging context while running the bg updatesRichard van der Hoff2020-03-311-4/+7
| | | | | | | | | | This mostly just reduces the amount of "running from sentinel context" spam during unittest setup.
| * Make `has_completed_background_updates` asyncRichard van der Hoff2020-03-311-1/+3
| | | | | | | | (Almost) everywhere that uses it is happy with an awaitable.
| * Remove unused `start_background_update`Richard van der Hoff2020-03-311-5/+9
| | | | | | | | This was only used in a unit test, so let's just inline it in the test.
* | Fix device list update stream ids going backward (#7158)Richard van der Hoff2020-04-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Occasionally we could get a federation device list update transaction which looked like: ``` [ {'edu_type': 'm.device_list_update', 'content': {'user_id': '@user:test', 'device_id': 'D2', 'prev_id': [], 'stream_id': 12, 'deleted': True}}, {'edu_type': 'm.device_list_update', 'content': {'user_id': '@user:test', 'device_id': 'D1', 'prev_id': [12], 'stream_id': 11, 'deleted': True}}, {'edu_type': 'm.device_list_update', 'content': {'user_id': '@user:test', 'device_id': 'D3', 'prev_id': [11], 'stream_id': 13, 'deleted': True}} ] ``` Having `stream_ids` which are lower than `prev_ids` looks odd. It might work (I'm not actually sure), but in any case it doesn't seem like a reasonable thing to expect other implementations to support.
* | Allow admins to create aliases when they are not in the room (#7191)Patrick Cloke2020-04-011-0/+62
|/
* Rewrite prune_old_outbound_device_pokes for efficiency (#7159)Richard van der Hoff2020-03-301-0/+92
| | | | make sure we clear out all but one update for the user
* Merge pull request #7157 from matrix-org/rev.outbound_device_pokes_testsRichard van der Hoff2020-03-3010-22/+317
|\ | | | | Add tests for outbound device pokes
| * Add tests for outbound device pokesRichard van der Hoff2020-03-272-3/+301
| |
| * Remove spurious "name" parameter to `default_config`Richard van der Hoff2020-03-249-19/+16
| | | | | | | | | | this is never set to anything other than "test", and is a source of unnecessary boilerplate.
* | Always whitelist the login fallback for SSO (#7153)Richard van der Hoff2020-03-271-1/+8
| | | | | | | | | | | | | | That fallback sets the redirect URL to itself (so it can process the login token then return gracefully to the client). This would make it pointless to ask the user for confirmation, since the URL the confirmation page would be showing wouldn't be the client's.
* | Admin API to join users to a room. (#7051)Dirk Klimpel2020-03-271-0/+288
| |
* | Add options to prevent users from changing their profile. (#7096)Dirk Klimpel2020-03-272-1/+366
| |
* | Allow server admins to define and enforce a password policy (MSC2000). (#7118)Dirk Klimpel2020-03-261-0/+179
| |
* | Validate that the session is not modified during UI-Auth (#7068)Patrick Cloke2020-03-262-2/+69
| |
* | Move catchup of replication streams to worker. (#7024)Erik Johnston2020-03-252-23/+84
| | | | | | This changes the replication protocol so that the server does not send down `RDATA` for rows that happened before the client connected. Instead, the server will send a `POSITION` and clients then query the database (or master out of band) to get up to date.
* | Clean up some LoggingContext stuff (#7120)Richard van der Hoff2020-03-2411-56/+68
|/ | | | | | | | | | | | | | | | | | | | | | | * Pull Sentinel out of LoggingContext ... and drop a few unnecessary references to it * Factor out LoggingContext.current_context move `current_context` and `set_context` out to top-level functions. Mostly this means that I can more easily trace what's actually referring to LoggingContext, but I think it's generally neater. * move copy-to-parent into `stop` this really just makes `start` and `stop` more symetric. It also means that it behaves correctly if you manually `set_log_context` rather than using the context manager. * Replace `LoggingContext.alive` with `finished` Turn `alive` into `finished` and make it a bit better defined.
* Convert `*StreamRow` classes to inner classes (#7116)Richard van der Hoff2020-03-231-2/+2
| | | | | This just helps keep the rows closer to their streams, so that it's easier to see what the format of each stream is.
* Improve database configuration docs (#6988)Richard van der Hoff2020-03-201-20/+2
| | | | | Attempts to clarify the sample config for databases, and add some stuff about tcp keepalives to `postgres.md`.
* Change device list streams to have one row per ID (#7010)Erik Johnston2020-03-191-45/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add 'device_lists_outbound_pokes' as extra table. This makes sure we check all the relevant tables to get the current max stream ID. Currently not doing so isn't problematic as the max stream ID in `device_lists_outbound_pokes` is the same as in `device_lists_stream`, however that will change. * Change device lists stream to have one row per id. This will make it possible to process the streams more incrementally, avoiding having to process large chunks at once. * Change device list replication to match new semantics. Instead of sending down batches of user ID/host tuples, send down a row per entity (user ID or host). * Newsfile * Remove handling of multiple rows per ID * Fix worker handling * Comments from review
| * Remove handling of multiple rows per IDErik Johnston2020-02-281-45/+0
| |
* | Improve get auth chain difference algorithm. (#7095)Erik Johnston2020-03-182-22/+148
| | | | | | | | | | | | | | | | | | | | | | It was originally implemented by pulling the full auth chain of all state sets out of the database and doing set comparison. However, that can take a lot work if the state and auth chains are large. Instead, lets try and fetch the auth chains at the same time and calculate the difference on the fly, allowing us to bail early if all the auth chains converge. Assuming that the auth chains do converge more often than not, this should improve performance. Hopefully.
* | Share SSL contexts for non-federation requests (#7094)Richard van der Hoff2020-03-172-13/+22
| | | | | | | | | | | | | | Extends #5794 etc to the SimpleHttpClient so that it also applies to non-federation requests. Fixes #7092.
* | Remove special casing of `m.room.aliases` events (#7034)Patrick Cloke2020-03-172-15/+33
| |
* | Revert "Add options to disable setting profile info for prevent changes. ↵Richard van der Hoff2020-03-172-335/+1
| | | | | | | | | | | | | | (#7053)" This reverts commit 54dd28621b070ca67de9f773fe9a89e1f4dc19da, reversing changes made to 6640460d054e8f4444046a34bdf638921b31c01e.
* | Add options to disable setting profile info for prevent changes. (#7053)Brendan Abolivier2020-03-102-1/+335
|\ \
| * | lint, fix testsdklimpel2020-03-091-2/+2
| | |
| * | updates after reviewdklimpel2020-03-092-13/+10
| | |
| * | fix testsdklimpel2020-03-091-2/+2
| | |
| * | lintdklimpel2020-03-091-10/+8
| | |
| * | add testsdklimpel2020-03-092-3/+311
| | |
| * | Add options to disable setting profile info for prevent changes.dklimpel2020-03-081-1/+32
| |/
* | Remove special auth and redaction rules for aliases events in experimental ↵Patrick Cloke2020-03-092-3/+125
| | | | | | | | room ver. (#7037)
* | Break down monthly active users by appservice_id (#7030)Neil Johnson2020-03-061-0/+42
| | | | | | | | | | * Break down monthly active users by appservice_id and emit via prometheus. Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* | Allow deleting an alias if the user has sufficient power level (#6986)Patrick Cloke2020-03-041-24/+104
| |
* | Read the room version from database when fetching events (#6874)Richard van der Hoff2020-03-041-0/+10
| | | | | | | | | | This is a precursor to giving EventBase objects the knowledge of which room version they belong to.
* | Merge branch 'master' into developBrendan Abolivier2020-03-031-0/+111
|\ \
| * | Add a whitelist for the SSO confirmation step.Richard van der Hoff2020-03-021-3/+29
| | |
| * | Merge remote-tracking branch 'origin/release-v1.11.1' into release-v1.11.1Richard van der Hoff2020-03-021-28/+181
| |\ \
| | * | Fixed set a user as an admin with the new API (#6928)Dirk Klimpel2020-03-021-28/+181
| | | | | | | | | | | | | | | | Fix #6910
| * | | Add a confirmation step to the SSO login flowBrendan Abolivier2020-03-021-0/+85
| |/ /
* | / Validate the alt_aliases property of canonical alias events (#6971)Patrick Cloke2020-03-033-37/+191
| |/ |/|
* | Fixed set a user as an admin with the new API (#6928)Dirk Klimpel2020-02-281-32/+186
| | | | | | Fix #6910
* | set worker_app for frontend proxy test (#7003)Richard van der Hoff2020-02-271-0/+5
| | | | | | to stop the federationhandler trying to do master stuff
* | Store room version on invite (#6983)Richard van der Hoff2020-02-262-0/+9
| | | | | | | | | | When we get an invite over federation, store the room version in the rooms table. The general idea here is that, when we pull the invite out again, we'll want to know what room_version it belongs to (so that we can later redact it if need be). So we need to store it somewhere...
* | Port PresenceHandler to async/await (#6991)Erik Johnston2020-02-261-6/+12
| |
* | Ensure 'deactivated' parameter is a boolean on user admin API, Fix error ↵Andrew Morgan2020-02-261-0/+59
| | | | | | | | handling of call to deactivate user (#6990)
* | Merge worker apps into one. (#6964)Erik Johnston2020-02-252-10/+6
| |
* | Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)Patrick Cloke2020-02-2115-105/+87
| | | | | | | | Ensure good comprehension hygiene using flake8-comprehensions.
* | Reduce auth chains fetched during v2 state res. (#6952)Erik Johnston2020-02-191-2/+4
|/ | | | | | The state res v2 algorithm only cares about the difference between auth chains, so we can pass in the known common state to the `get_auth_chain` storage function so that it can ignore those events.
* Merge pull request #6949 from matrix-org/rav/list_room_aliases_peekableRichard van der Hoff2020-02-192-2/+19
|\ | | | | Make room alias lists peekable
| * Make room alias lists peekableRichard van der Hoff2020-02-191-0/+17
| | | | | | | | | | | | As per https://github.com/matrix-org/matrix-doc/pull/2432#pullrequestreview-360566830, make room alias lists accessible to users outside world_readable rooms.
| * Refactor the membership check methods in AuthRichard van der Hoff2020-02-181-2/+2
| | | | | | | | | | these were getting a bit unwieldy, so let's combine `check_joined_room` and `check_user_was_in_room` into a single `check_user_in_room`.
* | Move MSC2432 stuff onto unstable prefix (#6948)Richard van der Hoff2020-02-191-3/+13
|/ | | it's not in the spec yet, so needs to be unstable. Also add a feature flag for it. Also add a test for admin users.
* Implement GET /_matrix/client/r0/rooms/{roomId}/aliases (#6939)Richard van der Hoff2020-02-182-10/+88
| | | | | per matrix-org/matrix-doc#2432
* Merge pull request #6872 from matrix-org/rav/dictpropertyRichard van der Hoff2020-02-181-1/+1
|\ | | | | Rewrite _EventInternalMetadata to back it with a dict
| * Replace _event_dict_property with DictPropertyRichard van der Hoff2020-02-141-1/+1
| | | | | | | | | | this amounts to the same thing, but replaces `_event_dict` with `_dict`, and removes some of the function layers generated by `property`.
* | Stop sending events when creating or deleting aliases (#6904)Patrick Cloke2020-02-181-2/+152
| | | | | | Stop sending events when creating or deleting associations (room aliases). Send an updated canonical alias event if one of the alt_aliases is deleted.
* | Raise the default power levels for invites, tombstones and server acls (#6834)Andrew Morgan2020-02-171-1/+3
| |
* | Convert the directory handler tests to use HomeserverTestCase (#6919)Patrick Cloke2020-02-141-24/+17
|/ | | Convert directory handler tests to use HomeserverTestCase.
* Filter the results of user directory searching via the spam checker (#6888)Patrick Cloke2020-02-141-0/+92
| | | Add a method to the spam checker to filter the user directory results.
* Return a 404 for admin api user lookup if user not found (#6901)Andrew Morgan2020-02-121-0/+16
|
* Reject device display names that are too long (#6882)Patrick Cloke2020-02-101-0/+18
| | | | | | | | * Reject device display names that are too long. Too long is currently defined as 100 characters in length. * Add a regression test for rejecting a too long device display name.
* Add a `make_event_from_dict` method (#6858)Richard van der Hoff2020-02-079-27/+32
| | | | | | | ... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
* Add typing to synapse.federation.sender (#6871)Erik Johnston2020-02-071-2/+6
|
* Admin api to add an email address (#6789)Dirk Klimpel2020-02-071-2/+17
|
* Pass room_version into `event_from_pdu_json`Richard van der Hoff2020-02-061-2/+4
| | | | It's called from all over the shop, so this one's a bit messy.
* Add typing to SyncHandler (#6821)Erik Johnston2020-02-031-1/+4
| | | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Merge pull request #6806 from matrix-org/rav/redact_changes/3Richard van der Hoff2020-01-312-4/+9
|\ | | | | Pass room_version into add_hashes_and_signatures
| * Pass room_version into add_hashes_and_signaturesRichard van der Hoff2020-01-301-2/+7
| |
| * Store the room version in EventBuilderRichard van der Hoff2020-01-301-2/+2
| |
* | s/get_room_version/get_room_version_id/Richard van der Hoff2020-01-313-3/+5
|/ | | | | ... to make way for a forthcoming get_room_version which returns a RoomVersion object.
* MSC2260: Block direct sends of m.room.aliases events (#6794)Richard van der Hoff2020-01-302-33/+15
| | | | | as per MSC2260
* Resync remote device list when detected as stale. (#6786)Erik Johnston2020-01-301-3/+3
|
* Type defintions for use in refactoring for redaction changes (#6803)Richard van der Hoff2020-01-301-4/+11
| | | | | | | | | | * Bump signedjson to 1.1 ... so that we can use the type definitions * Fix breakage caused by upgrade to signedjson 1.1 Thanks, @illicitonion...
* Factor out a `copy_power_levels_contents` methodRichard van der Hoff2020-01-291-2/+43
| | | | I'm going to need another copy (hah!) of this.
* Pass room version object into event_auth.check and check_redaction (#6788)Richard van der Hoff2020-01-281-7/+4
| | | | | | | These are easier to work with than the strings and we normally have one around. This fixes `FederationHander._persist_auth_tree` which was passing a RoomVersion object into event_auth.check instead of a string.
* Add `rooms.room_version` column (#6729)Erik Johnston2020-01-273-2/+18
| | | This is so that we don't have to rely on pulling it out from `current_state_events` table.
* Validate client_secret parameter (#6767)Andrew Morgan2020-01-241-0/+51
|
* Make 'event.redacts' never raise. (#6771)Erik Johnston2020-01-231-0/+35
| | | | | | There are quite a few places that we assume that a redaction event has a corresponding `redacts` key, which is not always the case. So lets cheekily make it so that event.redacts just returns None instead.
* Admin API to list, filter and sort rooms (#6720)Andrew Morgan2020-01-221-4/+389
|
* Lint + changelogBrendan Abolivier2020-01-221-3/+1
|
* Remove unused importBrendan Abolivier2020-01-221-1/+1
|
* Add tests for thumbnailingBrendan Abolivier2020-01-221-3/+45
|
* Fix and add test to deprecated quarantine media admin api (#6756)Andrew Morgan2020-01-221-4/+11
|
* Fix `/events/:event_id` deprecated API. (#6731)Erik Johnston2020-01-202-1/+28
|
* Fix changing password via user admin API. (#6730)Erik Johnston2020-01-201-0/+13
|
* Log saml assertions rather than the whole responseRichard van der Hoff2020-01-161-0/+47
| | | | | | ... since the whole response is huge. We even need to break up the assertions, since kibana otherwise truncates them.
* Port synapse.replication.tcp to async/await (#6666)Erik Johnston2020-01-161-1/+1
| | | | | | | | | | * Port synapse.replication.tcp to async/await * Newsfile * Correctly document type of on_<FOO> functions as async * Don't be overenthusiastic with the asyncing....
* Fix purge_room admin API (#6711)Erik Johnston2020-01-151-3/+1
|
* Implement RedirectException (#6687)Richard van der Hoff2020-01-151-2/+77
| | | | | Allow REST endpoint implemnentations to raise a RedirectException, which will redirect the user's browser to a given location.
* Add `local_current_membership` table (#6655)Erik Johnston2020-01-155-17/+14
| | | | | | | Currently we rely on `current_state_events` to figure out what rooms a user was in and their last membership event in there. However, if the server leaves the room then the table may be cleaned up and that information is lost. So lets add a table that separately holds that information.
* Quarantine media by ID or user ID (#6681)Andrew Morgan2020-01-132-0/+378
|
* Kill off RegistrationError (#6691)Richard van der Hoff2020-01-131-2/+0
| | | This is pretty pointless. Let's just use SynapseError.
* Allow admin users to create or modify users without a shared secret (#6495)Manuel Stahl2020-01-093-338/+467
| | | Signed-off-by: Manuel Stahl <manuel.stahl@awesome-technologies.de>
* Fix GET request on /_synapse/admin/v2/users endpoint (#6563)Manuel Stahl2020-01-081-0/+41
| | | | Fixes #6552
* Back out ill-advised notary server hackery (#6657)Richard van der Hoff2020-01-083-4/+131
| | | | | | | | | | | This was ill-advised. We can't modify verify_keys here, because the response object has already been signed by the requested key. Furthermore, it's somewhat unnecessary because existing versions of Synapse (which get upset that the notary key isn't present in verify_keys) will fall back to a direct fetch via `/key/v2/server`. Also: more tests for fetching keys via perspectives: it would be nice if we actually tested when our fetcher can't talk to our notary impl.
* port BackgroundUpdateTestCase to HomeserverTestCase (#6653)Richard van der Hoff2020-01-071-35/+37
|
* Merge pull request #6629 from matrix-org/rav/kill_event_reference_hashesRichard van der Hoff2020-01-062-16/+5
|\ | | | | Remove a bunch of unused code from event creation
| * Remove unused get_prev_events_and_hashes_for_roomRichard van der Hoff2020-01-061-13/+6
| |
| * Remove unused hashes and depths from create_event paramsRichard van der Hoff2020-01-061-5/+1
| |
| * rename get_prev_events_for_room to get_prev_events_and_hashes_for_roomRichard van der Hoff2020-01-061-2/+2
| | | | | | | | ... to make way for a new method which just returns the event ids
* | Fix exception when fetching notary server's old keys (#6625)Richard van der Hoff2020-01-061-44/+95
| | | | | | | | | | | | Lift the restriction that *all* the keys used for signing v2 key responses be present in verify_keys. Fixes #6596.
* | Workaround for error when fetching notary's own key (#6620)Richard van der Hoff2020-01-062-1/+140
|/ | | | | | | | | | | | | | * Kill off redundant SynapseRequestFactory We already get the Site via the Channel, so there's no need for a dedicated RequestFactory: we can just use the right constructor. * Workaround for error when fetching notary's own key As a notary server, when we return our own keys, include all of our signing keys in verify_keys. This is a workaround for #6596.
* Kill off redundant SynapseRequestFactory (#6619)Richard van der Hoff2020-01-031-2/+4
| | | | We already get the Site via the Channel, so there's no need for a dedicated RequestFactory: we can just use the right constructor.
* Split state groups into a separate data store (#6296)Erik Johnston2019-12-202-2/+2
|
* Change EventContext to use the Storage class (#6564)Erik Johnston2019-12-201-14/+14
|
* Clean up startup for the pusher (#6558)Richard van der Hoff2019-12-182-0/+7
| | | | | | | | | | | | | | | | | | | | | | | * Remove redundant python2 support code `str.decode()` doesn't exist on python3, so presumably this code was doing nothing * Filter out pushers with corrupt data When we get a row with unparsable json, drop the row, rather than returning a row with null `data`, which will then cause an explosion later on. * Improve logging when we can't start a pusher Log the ID to help us understand the problem * Make email pusher setup more robust We know we'll have a `data` member, since that comes from the database. What we *don't* know is if that is a dict, and if that has a `brand` member, and if that member is a string.
* Add database config class (#6513)Erik Johnston2019-12-187-95/+100
| | | | | This encapsulates config for a given database and is the way to get new connections.
* Merge release-v1.7.1 into developRichard van der Hoff2019-12-181-0/+127
|\
| * Merge pull request #6553 from matrix-org/babolivier/fix-context-filterBrendan Abolivier2019-12-161-0/+127
| |\ | | | | | | Use the filtered version of an event when responding to /context requests for that event
| | * Incorporate reviewBrendan Abolivier2019-12-161-5/+0
| | |
| | * LintBrendan Abolivier2019-12-161-2/+1
| | |
| | * Add test caseBrendan Abolivier2019-12-161-0/+133
| | |
| * | sanity-checking for events used in state res (#6531)Richard van der Hoff2019-12-161-0/+3
| |/ | | | | | | | | When we perform state resolution, check that all of the events involved are in the right room.
* | Add option to allow profile queries without sharing a room (#6523)Will Hunt2019-12-161-0/+2
| |
* | sanity-checking for events used in state res (#6531)Richard van der Hoff2019-12-131-0/+3
| | | | | | | | | | | | | | When we perform state resolution, check that all of the events involved are in the right room.
* | look up cross-signing keys from the DB in bulk (#6486)Hubert Chathi2019-12-121-8/+0
| |
* | Merge pull request #6511 from matrix-org/erikj/remove_db_config_from_appsErik Johnston2019-12-122-13/+8
|\ \ | | | | | | Move database config from apps into HomeServer object
| * | Remove database config parsing from apps.Erik Johnston2019-12-102-13/+8
| |/
* | Merge pull request #6517 from matrix-org/rav/event_auth/13Richard van der Hoff2019-12-111-5/+9
|\ \ | | | | | | Port some of FederationHandler to async/await
| * | convert to async: FederationHandler.on_receive_pduRichard van der Hoff2019-12-111-5/+9
| | | | | | | | | | | | | | | | | | | | | and associated functions: * on_receive_pdu * handle_queued_pdus * get_missing_events_for_pdu
* | | Merge pull request #6504 from matrix-org/erikj/account_validity_async_awaitErik Johnston2019-12-111-2/+1
|\ \ \ | |/ / |/| | Port handlers.account_validity to async/await.
| * | Port handlers.account_validity to async/await.Erik Johnston2019-12-101-2/+1
| |/
* | Fix race which caused deleted devices to reappear (#6514)Richard van der Hoff2019-12-101-20/+29
| | | | | | | | Stop the `update_client_ips` background job from recreating deleted devices.
* | Merge pull request #6505 from matrix-org/erikj/make_deferred_yiedableErik Johnston2019-12-101-0/+24
|\ \ | | | | | | Fix `make_deferred_yieldable` to work with coroutines
| * | Fix make_deferred_yieldable to work with coroutinesErik Johnston2019-12-101-0/+24
| |/
* | Merge pull request #6506 from matrix-org/erikj/remove_snapshot_cacheErik Johnston2019-12-101-63/+0
|\ \ | |/ |/| Remove SnapshotCache in favour of ResponseCache
| * Remove SnapshotCache in favour of ResponseCacheErik Johnston2019-12-091-63/+0
| |
* | Back out perf regression from get_cross_signing_keys_from_cache. (#6494)Neil Johnson2019-12-091-0/+8
| | | | | | Back out cross-signing code added in Synapse 1.5.0, which caused a performance regression.
* | Merge pull request #6487 from matrix-org/erikj/pass_in_dbErik Johnston2019-12-096-25/+23
|\ \ | |/ |/| Pass in Database object to data stores.
| * Fixup testsErik Johnston2019-12-066-23/+20
| |
| * Change DataStores to accept 'database' param.Erik Johnston2019-12-061-2/+3
| |
* | Merge pull request #6484 from matrix-org/erikj/port_sync_handlerErik Johnston2019-12-094-25/+43
|\ \ | |/ |/| Port SyncHandler to async/await
| * Fixup functions to consistently return deferredsErik Johnston2019-12-062-7/+21
| |
| * Port SyncHandler to async/awaitErik Johnston2019-12-052-18/+22
| |
* | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-12-063-2/+15
|\| | | | | | | erikj/make_database_class
| * Fixup testsErik Johnston2019-12-053-2/+15
| |
* | Move background update handling out of storeErik Johnston2019-12-057-49/+113
| |
* | Move DB pool and helper functions into dedicated Database classErik Johnston2019-12-0514-64/+66
|/
* Remove underscore from SQLBaseStore functionsErik Johnston2019-12-0410-47/+47
|
* Merge pull request #6329 from matrix-org/babolivier/context_filtersBrendan Abolivier2019-12-044-100/+384
|\ | | | | Filter state, events_before and events_after in /context requests
| * Un-remove room purge testBrendan Abolivier2019-12-041-0/+72
| |
| * Merge branch 'babolivier/context_filters' of github.com:matrix-org/synapse ↵Brendan Abolivier2019-12-041-1/+1
| |\ | | | | | | | | | into babolivier/context_filters
| | * Merge branch 'develop' into babolivier/context_filtersBrendan Abolivier2019-11-267-19/+399
| | |\
| * | \ Merge branch 'develop' into babolivier/context_filtersBrendan Abolivier2019-12-0420-77/+846
| |\ \ \ | | |/ / | |/| |
| * | | LintBrendan Abolivier2019-11-051-30/+41
| | | |
| * | | Update copyrightsBrendan Abolivier2019-11-054-1/+10
| | | |
| * | | Add tests for /searchBrendan Abolivier2019-11-051-44/+143
| | | |
| * | | Merge labels tests for /context and /messagesBrendan Abolivier2019-11-051-146/+130
| | | |
| * | | Add test caseBrendan Abolivier2019-11-051-0/+182
| | | |
* | | | privacy by default for room dir (#6355)Neil Johnson2019-12-041-0/+52
| | | | | | | | | | | | | | | | Ensure that the the default settings for the room directory are that the it is hidden from public view by default.
* | | | Add ephemeral messages support (MSC2228) (#6409)Brendan Abolivier2019-12-031-0/+101
| |/ / |/| | | | | | | | | | | | | | | | | | | | Implement part [MSC2228](https://github.com/matrix-org/matrix-doc/pull/2228). The parts that differ are: * the feature is hidden behind a configuration flag (`enable_ephemeral_messages`) * self-destruction doesn't happen for state events * only implement support for the `m.self_destruct_after` field (not the `m.self_destruct` one) * doesn't send synthetic redactions to clients because for this specific case we consider the clients to be able to destroy an event themselves, instead we just censor it (by pruning its JSON) in the database
* | | Add testsErik Johnston2019-11-281-0/+140
| | |
* | | Implementation of MSC2314 (#6176)Amber Brown2019-11-289-52/+148
| | |
* | | add etag and count to key backup endpoints (#5858)Hubert Chathi2019-11-272-4/+35
| | |
* | | Merge pull request #6358 from matrix-org/babolivier/message_retentionBrendan Abolivier2019-11-271-0/+293
|\ \ \ | | | | | | | | Implement message retention policies (MSC1763)
| * \ \ Merge branch 'develop' into babolivier/message_retentionBrendan Abolivier2019-11-268-19/+351
| |\ \ \ | | | |/ | | |/|
| * | | Don't restrict the tests to v1 roomsBrendan Abolivier2019-11-261-2/+0
| | | |
| * | | Lint againBrendan Abolivier2019-11-191-10/+2
| | | |
| * | | LintBrendan Abolivier2019-11-191-50/+23
| | | |
| * | | Don't apply retention policy based filtering on state eventsBrendan Abolivier2019-11-061-0/+10
| | | | | | | | | | | | | | | | As per MSC1763, 'Retention is only considered for non-state events.', so don't filter out state events based on the room's retention policy.
| * | | Implement per-room message retention policiesBrendan Abolivier2019-11-041-0/+320
| | | |
* | | | Remove assertion and provide a clear warning on startup for missing ↵Andrew Morgan2019-11-261-0/+1
| |/ / |/| | | | | | | | public_baseurl (#6379)
* | | Improve the performance of structured logging (#6322)Amber Brown2019-11-261-0/+2
| | |
* | | LintBrendan Abolivier2019-11-201-6/+8
| | |
* | | Test if a purge can make /messages return 500 responsesBrendan Abolivier2019-11-201-0/+72
| | |
* | | Blacklist PurgeRoomTestCase (#6361)Andrew Morgan2019-11-131-0/+2
| | |
* | | Merge pull request #6295 from matrix-org/erikj/split_purge_historyErik Johnston2019-11-082-8/+11
|\ \ \ | | | | | | | | Split purge API into events vs state and add PurgeEventsStorage
| * | | Fix deleting state groups during room purge.Erik Johnston2019-11-061-1/+3
| | | | | | | | | | | | | | | | And fix the tests to actually test that things got deleted.
| * | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-11-051-0/+51
| |\ \ \ | | | |/ | | |/| | | | | erikj/split_purge_history
| * | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-11-0412-21/+693
| |\ \ \ | | | |/ | | |/| | | | | erikj/split_purge_history
| * | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-10-315-51/+197
| |\ \ \ | | | | | | | | | | | | | | | erikj/split_purge_history
| * | | | Split purge API into events vs stateErik Johnston2019-10-301-7/+8
| | | | |
* | | | | Fix bug which caused rejected events to be stored with the wrong room state ↵Richard van der Hoff2019-11-062-11/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#6320) Fixes a bug where rejected events were persisted with the wrong state group. Also fixes an occasional internal-server-error when receiving events over federation which are rejected and (possibly because they are backwards-extremities) have no prev_group. Fixes #6289.
* | | | | Merge branch 'develop' into rav/url_preview_limit_titleRichard van der Hoff2019-11-0527-99/+1065
|\ \ \ \ \ | | |_|_|/ | |/| | |