summary refs log tree commit diff
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/release-v1.110' into developErik Johnston2024-07-021-6/+31
|\
| * Limit size of presence EDUs (#17371)Erik Johnston2024-07-021-0/+119
| | | | | | | | | | | | | | Otherwise they are unbounded. --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
| * Fix regression when bounding future tokens (#17391)Erik Johnston2024-07-021-6/+31
| | | | | | | | | | | | Fix bug added in #17386, where we accidentally used `room_key` for the receipts stream. See first commit. Reviewable commit-by-commit
| * Fix sync waiting for an invalid token from the "future" (#17386)Erik Johnston2024-07-022-2/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixes https://github.com/element-hq/synapse/issues/17274, hopefully. Basically, old versions of Synapse could advance streams without persisting anything in the DB (fixed in #17229). On restart those updates would get lost, and so the position of the stream would revert to an older position. If this happened across an upgrade to a later Synapse version which included #17215, then sync could get blocked indefinitely (until the stream advanced to the position in the token). We fix this by bounding the stream positions we'll wait for to the maximum position of the underlying stream ID generator.
* | Support MSC3916 by adding `_matrix/client/v1/media/download` endpoint (#17365)Shay2024-07-025-44/+991
| |
* | Fix sync waiting for an invalid token from the "future" (#17386)Erik Johnston2024-07-022-2/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixes https://github.com/element-hq/synapse/issues/17274, hopefully. Basically, old versions of Synapse could advance streams without persisting anything in the DB (fixed in #17229). On restart those updates would get lost, and so the position of the stream would revert to an older position. If this happened across an upgrade to a later Synapse version which included #17215, then sync could get blocked indefinitely (until the stream advanced to the position in the token). We fix this by bounding the stream positions we'll wait for to the maximum position of the underlying stream ID generator.
* | Limit size of presence EDUs (#17371)Erik Johnston2024-07-011-0/+119
|/ | | | | | | Otherwise they are unbounded. --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Re-introduce federation /download endpoint (#17350)Shay2024-06-251-0/+173
|
* Reintroduce "Reduce device lists replication traffic."" (#17361)Erik Johnston2024-06-251-0/+8
| | | | | | Reintroduces https://github.com/element-hq/synapse/pull/17333 Turns out the reason for revert was down two master instances running
* Revert "Reduce device lists replication traffic." (#17360)Erik Johnston2024-06-251-8/+0
| | | | | | Reverts element-hq/synapse#17333 It looks like master was still sending out replication RDATA with the old format... somehow
* Add `is_invite` filtering to Sliding Sync `/sync` (#17335)Eric Eastwood2024-06-242-40/+182
| | | Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
* Reintroduce #17291. (#17338)Erik Johnston2024-06-243-12/+43
| | | | | | | This is #17291 (which got reverted), with some added fixups, and change so that tests actually pick up the error. The problem was that we were not calculating any new chain IDs due to a missing `not` in a condition.
* Add support for MSC3823 - Account Suspension Part 2 (#17255)Shay2024-06-242-0/+189
|
* Reduce device lists replication traffic. (#17333)Erik Johnston2024-06-241-0/+8
| | | | | | | | | | Reduce the replication traffic of device lists, by not sending every destination that needs to be sent the device list update over replication. Instead a "hosts to send to have been calculated" notification over replication, and then federation senders read the destinations from the DB. For non federation senders this should heavily reduce the impact of a user in many large rooms changing a device.
* Revert "Handle large chain calc better (#17291)" (#17334)Erik Johnston2024-06-192-38/+12
| | | | | | This reverts commit bdf82efea505c488953b46eb681b5a63c4e9655d (#17291) This seems to have stopped persisting auth chains for new events, and so is causing state res to fall back to the slow methods
* Register sliding sync under a different path (#17331)Erik Johnston2024-06-191-1/+3
| | | As the API is slightly incompatible.
* Filter added to Admin-API GET /rooms (#17276)Alexander Fechler2024-06-191-0/+77
|
* Handle large chain calc better (#17291)Erik Johnston2024-06-192-12/+38
| | | | | We calculate the auth chain links outside of the main persist event transaction to ensure that we do not block other event sending during the calculation.
* Require the 'from' parameter for `/notifications` be an integer (#17283)Andrew Morgan2024-06-192-19/+154
| | | | Co-authored-by: Erik Johnston <erikj@element.io>
* Revert "Support MSC3916 by adding a federation `/download` endpoint" (#17325)Andrew Morgan2024-06-182-246/+2
|
* Add `is_encrypted` filtering to Sliding Sync `/sync` (#17281)Eric Eastwood2024-06-171-0/+66
| | | | Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
* Add `stream_ordering` sort to Sliding Sync `/sync` (#17293)Eric Eastwood2024-06-173-58/+285
| | | Sort is no longer configurable and we always sort rooms by the `stream_ordering` of the last event in the room or the point where the user can see up to in cases of leave/ban/invite/knock.
* Merge branch 'release-v1.109' into developQuentin Gliech2024-06-171-180/+135
|\
| * Set our own stream position from the current sequence value on startup (#17309)Quentin Gliech2024-06-171-175/+126
| |
| * Automatically apply SQL for inconsistent sequence (#17305)Erik Johnston2024-06-141-5/+9
| | | | | | | | | | | | Rather than forcing the server operator to apply the SQL manually. This should be safe, as there should be only one writer for these sequences.
* | Enable cross-signing key upload without UIA (#17284)Richard van der Hoff2024-06-143-69/+2
| | | | | | | | | | | | Per MSC3967, which is now stable, we should not require UIA when uploading cross-signing keys for the first time. Fixes: #17227
* | Include user membership on events (#17282)Richard van der Hoff2024-06-132-8/+3
| | | | | | | | | | MSC4115 has now completed FCP, so we can enable it by default and switch to the stable identifier.
* | Add `is_dm` filtering to Sliding Sync `/sync` (#17277)Eric Eastwood2024-06-132-1/+256
| | | | | | Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
* | Fix `newly_left` rooms not appearing if we returned early (Sliding Sync) ↵Eric Eastwood2024-06-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | (#17301) Fix `newly_left` rooms not appearing if we returned early when `membership_snapshot_token.is_before_or_eq(to_token.room_key)`. Introduced in https://github.com/element-hq/synapse/pull/17187 (part of Sliding Sync) The tests didn't catch it because they had a small typo in it `room_id1` vs `room_id2`. Found while working on https://github.com/element-hq/synapse/pull/17293
* | Add `event.internal_metadata.instance_name` (#17300)Eric Eastwood2024-06-133-3/+11
| | | | | | | | | | | | | | | | | | | | Add `event.internal_metadata.instance_name` (the worker instance that persisted the event) to go alongside the existing `event.internal_metadata.stream_ordering`. `instance_name` is useful to properly compare and query for events with a token since you need to compare both the `stream_ordering` and `instance_name` against the vector clock/`instance_map` in the `RoomStreamToken`. This is pre-requisite work and may be used in https://github.com/element-hq/synapse/pull/17293 Adding `event.internal_metadata.instance_name` was first mentioned in the initial Sliding Sync PR while pairing with @erikjohnston, see https://github.com/element-hq/synapse/pull/17187/commits/09609cb0dbca3a4cfd9fbf90cc962e765ec469c0#diff-5cd773fb307aa754bd3948871ba118b1ef0303f4d72d42a2d21e38242bf4e096R405-R410
* | Fix `get_last_event_in_room_before_stream_ordering(...)` finding the wrong ↵Eric Eastwood2024-06-131-2/+267
| | | | | | | | | | | | | | | | | | | | | | last event (#17295) PR where this was introduced: https://github.com/matrix-org/synapse/pull/14817 ### What does this affect? `get_last_event_in_room_before_stream_ordering(...)` is used in Sync v2 in a lot of different state calculations. `get_last_event_in_room_before_stream_ordering(...)` is also used in `/rooms/{roomId}/members`
* | Bump `mypy` from 1.8.0 to 1.9.0 (#17297)Andrew Morgan2024-06-132-12/+53
| | | | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | Add report room API (MSC4151) (#17270)Travis Ralston2024-06-122-5/+94
| | | | | | | | | | | | | | | | https://github.com/matrix-org/matrix-spec-proposals/pull/4151 This is intended to be enabled by default for immediate use. When FCP is complete, the unstable endpoint will be dropped and stable endpoint supported instead - no backwards compatibility is expected for the unstable endpoint.
* | Reorganize Pydantic models and types used in handlers (#17279)Eric Eastwood2024-06-101-1/+1
| | | | | | | | | | | | Spawning from https://github.com/element-hq/synapse/pull/17187#discussion_r1619492779 around wanting to put `SlidingSyncBody` (parse the request in the rest layer), `SlidingSyncConfig` (from the rest layer, pass to the handler), `SlidingSyncResponse` (pass the response from the handler back to the rest layer to respond) somewhere that doesn't contaminate the imports and cause circular import issues. - Moved Pydantic parsing models to `synapse/types/rest` - Moved handler types to `synapse/types/handlers`
* | Support MSC3916 by adding a federation `/download` endpoint (#17172)Shay2024-06-072-2/+246
| |
* | Add Sliding Sync `/sync` endpoint (initial implementation) (#17187)Eric Eastwood2024-06-063-2/+1255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync This iteration only focuses on returning the list of room IDs in the sliding window API (without sorting/filtering). Rooms appear in the Sliding sync response based on: - `invite`, `join`, `knock`, `ban` membership events - Kicks (`leave` membership events where `sender` is different from the `user_id`/`state_key`) - `newly_left` (rooms that were left during the given token range, > `from_token` and <= `to_token`) - In order for bans/kicks to not show up, you need to `/forget` those rooms. This doesn't modify the event itself though and only adds the `forgotten` flag to `room_memberships` in Synapse. There isn't a way to tell when a room was forgotten at the moment so we can't factor it into the from/to range. ### Example request `POST http://localhost:8008/_matrix/client/unstable/org.matrix.msc3575/sync` ```json { "lists": { "foo-list": { "ranges": [ [0, 99] ], "sort": [ "by_notification_level", "by_recency", "by_name" ], "required_state": [ ["m.room.join_rules", ""], ["m.room.history_visibility", ""], ["m.space.child", "*"] ], "timeline_limit": 100 } } } ``` Response: ```json { "next_pos": "s58_224_0_13_10_1_1_16_0_1", "lists": { "foo-list": { "count": 1, "ops": [ { "op": "SYNC", "range": [0, 99], "room_ids": [ "!MmgikIyFzsuvtnbvVG:my.synapse.linux.server" ] } ] } }, "rooms": {}, "extensions": {} } ```
* | Ratelimiting of remote media downloads (#17256)Shay2024-06-051-2/+223
| |
* | Handle hyphens in user dir search porperly (#17254)Erik Johnston2024-06-052-0/+43
| | | | | | c.f. #16675
* | Use fully-qualified `PersistedEventPosition` when returning `RoomsForUser` ↵Eric Eastwood2024-06-041-1/+4
|/ | | | | | | (#17265) Use fully-qualified `PersistedEventPosition` (`instance_name` and `stream_ordering`) when returning `RoomsForUser` to facilitate proper comparisons and `RoomStreamToken` generation. Spawning from https://github.com/element-hq/synapse/pull/17187 where we want to utilize this change
* Fix bug where typing replication breaks (#17252)Erik Johnston2024-05-311-1/+52
| | | | This can happen on restarts of the service, due to old rooms being pruned.
* Fix deduplicating of membership events to not create unused state groups. ↵Erik Johnston2024-05-301-0/+21
| | | | | | | | | | | | | (#17164) We try and deduplicate in two places: 1) really early on, and 2) just before we persist the event. The first case was broken due to it occuring before the profile information was added, and so it thought the event contents were different. The second case did catch it and handle it correctly, however doing so creates a redundant state group leading to bloat. Fixes #3791
* Replaces all usages of `StreamIdGenerator` with `MultiWriterIdGenerator` ↵Erik Johnston2024-05-301-139/+1
| | | | | (#17229) Replaces all usages of `StreamIdGenerator` with `MultiWriterIdGenerator`, which is safer.
* Move towards using `MultiWriterIdGenerator` everywhere (#17226)Erik Johnston2024-05-291-164/+187
| | | | | | | | | | | | | | | There is a problem with `StreamIdGenerator` where it can go backwards over restarts when a stream ID is requested but then not inserted into the DB. This is problematic if we want to land #17215, and is generally a potential cause for all sorts of nastiness. Instead of trying to fix `StreamIdGenerator`, we may as well move to `MultiWriterIdGenerator` that does not suffer from this problem (the latest positions are stored in `stream_positions` table). This involves adding SQLite support to the class. This only changes id generators that were already using `MultiWriterIdGenerator` under postgres, a separate PR will move the rest of the uses of `StreamIdGenerator` over.
* Fix slipped logging context when media rejected (#17239)Erik Johnston2024-05-292-14/+14
| | | | | | | When a module rejects a piece of media we end up trying to close the same logging context twice. Instead of fixing the existing code we refactor to use an async context manager, which is easier to write correctly.
* Support MSC3916 by adding unstable media endpoints to `_matrix/client` (#17213)Shay2024-05-242-81/+1689
| | | | | | | | | | [MSC3916](https://github.com/matrix-org/matrix-spec-proposals/blob/rav/authentication-for-media/proposals/3916-authentication-for-media.md) adds new media endpoints under `_matrix/client`. This PR adds the `/preview_url`, `/config`, and `/thumbnail` endpoints. `/download` will be added in a follow-up PR once the work for the federation `/download` endpoint is complete (see https://github.com/element-hq/synapse/pull/17172). Should be reviewable commit-by-commit.
* Add Sliding Sync `/sync/e2ee` endpoint for To-Device messages (#17167)Eric Eastwood2024-05-233-165/+449
| | | | | | | | | | | This is being introduced as part of Sliding Sync but doesn't have any sliding window component. It's just a way to get E2EE events without having to sit through a big initial sync (`/sync` v2). And we can avoid encryption events being backed up by the main sync response or vice-versa. Part of some Sliding Sync simplification/experimentation. See [this discussion](https://github.com/element-hq/synapse/pull/17167#discussion_r1610495866) for why it may not be as useful as we thought. Based on: - https://github.com/matrix-org/matrix-spec-proposals/pull/3575 - https://github.com/matrix-org/matrix-spec-proposals/pull/3885 - https://github.com/matrix-org/matrix-spec-proposals/pull/3884
* Bring auto-accept invite logic into Synapse (#17147)devonh2024-05-213-0/+665
| | | | | | | | | | | | | | This PR ports the logic from the [synapse_auto_accept_invite](https://github.com/matrix-org/synapse-auto-accept-invite) module into synapse. I went with the naive approach of injecting the "module" next to where third party modules are currently loaded. If there is a better/preferred way to handle this, I'm all ears. It wasn't obvious to me if there was a better location to add this logic that would cleanly apply to all incoming invite events. Relies on https://github.com/element-hq/synapse/pull/17166 to fix linter errors.
* Add a short sleep if the request is rate-limited (#17210)Erik Johnston2024-05-184-4/+10
| | | This helps prevent clients from "tight-looping" retrying their request.
* Removed `request_key` from the `SyncConfig` (moved outside as its own ↵Eric Eastwood2024-05-162-10/+54
| | | | | | | | | function parameter) (#17201) Removed `request_key` from the `SyncConfig` (moved outside as its own function parameter) so it doesn't have to flow into `_generate_sync_entry_for_xxx` methods. This way we can separate the concerns of caching from generating the response and reuse the `_generate_sync_entry_for_xxx` functions as we see fit. Plus caching doesn't really have anything to do with the config of sync. Split from https://github.com/element-hq/synapse/pull/17167 Spawning from https://github.com/element-hq/synapse/pull/17167#discussion_r1601497279
* Fix bug where push rules would be empty in `/sync` (#17142)Erik Johnston2024-05-161-1/+28
| | | | | | Fixes #16987 Some old accounts seem to have an entry in global account data table for push rules, which we should ignore
* Refactor Sync handler to be able to return different sync responses ↵Eric Eastwood2024-05-162-18/+67
| | | | | | | | | | | | | | (`SyncVersion`) (#17200) Refactor Sync handler to be able to be able to return different sync responses (`SyncVersion`). Preparation to be able support sync v2 and a new Sliding Sync `/sync/e2ee` endpoint which returns a subset of sync v2. Split upon request: https://github.com/element-hq/synapse/pull/17167#discussion_r1601497279 Split from https://github.com/element-hq/synapse/pull/17167 where we will add `SyncVersion.E2EE_SYNC` and a new type of sync response.
* An federation whitelist query endpoint extension (#16848)Erik Johnston2024-05-133-0/+143
| | | | | | | | | | This is to allow clients to query the configured federation whitelist. Disabled by default. --------- Co-authored-by: Devon Hudson <devonhudson@librem.one> Co-authored-by: devonh <devon.dmytro@gmail.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Optional whitespace support in Authorization (#1350) (#17145)Timshel2024-05-081-0/+7
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Add optimisation to `StreamChangeCache` (#17130)Erik Johnston2024-05-061-3/+14
| | | | | | | When there have been lots of changes compared with the number of entities, we can do a fast(er) path. Locally I ran some benchmarking, and the comparison seems to give the best determination of which method we use.
* Add support for MSC3823 - Account Suspension (#17051)Shay2024-05-012-4/+67
|
* Apply user `email` & `picture` during OIDC registration if present & ↵devonh2024-04-291-14/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | selected (#17120) This change will apply the `email` & `picture` provided by OIDC to the new user account when registering a new user via OIDC. If the user is directed to the account details form, this change makes sure they have been selected before applying them, otherwise they are omitted. In particular, this change ensures the values are carried through when Synapse has consent configured, and the redirect to the consent form/s are followed. I have tested everything manually. Including: - with/without consent configured - allowing/not allowing the use of email/avatar (via `sso_auth_account_details.html`) - with/without automatic account detail population (by un/commenting the `localpart_template` option in synapse config). ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [X] Pull request is based on the develop branch * [X] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [X] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
* Add support for MSC4115 (#17104)Richard van der Hoff2024-04-293-93/+258
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Ensure that incoming to-device messages are not dropped (#17127)Richard van der Hoff2024-04-292-1/+25
| | | | | | | | | | | | | | | | | | | | ... when workers are unreachable, etc. Fixes https://github.com/element-hq/synapse/issues/17117. The general principle is just to make sure that we propagate any exceptions to the JsonResource, so that we return an error code to the sending server. That means that the sending server no longer considers the message safely sent, so it will retry later. In the issue, Erik mentions that an alternative solution would be to persist the to-device messages into a table so that they can be retried. This might be an improvement for performance, but even if we did that, we still need this mechanism, since we might be unable to reach the database. So, if we want to do that, it can be a later follow-up. --------- Co-authored-by: Erik Johnston <erik@matrix.org>
* Fix filtering of rooms when supplying the `destination` query parameter to ↵Andrew Morgan2024-04-261-3/+64
| | | | `/_synapse/admin/v1/federation/destinations/<destination>/rooms` (#17077)
* Return the search terms as search highlights for SQLite instead of nothing ↵Melvyn Laïly2024-04-261-7/+6
| | | | | | | (#17000) Fixes https://github.com/element-hq/synapse/issues/16999 and https://github.com/element-hq/element-android/pull/8729 by returning the search terms as search highlights.
* Redact membership events if the user requested erasure upon deactivating ↵Till2024-04-251-0/+37
| | | | | (#17076) Fixes #15355 by redacting all membership events before leaving rooms.
* MSC4108 implementation (#17056)Quentin Gliech2024-04-253-2/+411
| | | | | | Co-authored-by: Hugh Nimmo-Smith <hughns@element.io> Co-authored-by: Hugh Nimmo-Smith <hughns@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Merge branch 'master' into developErik Johnston2024-04-231-31/+73
|\
| * Fix GHSA-3h7q-rfh9-xm4vErik Johnston2024-04-231-31/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Weakness in auth chain indexing allows DoS from remote room members through disk fill and high CPU usage. A remote Matrix user with malicious intent, sharing a room with Synapse instances before 1.104.1, can dispatch specially crafted events to exploit a weakness in how the auth chain cover index is calculated. This can induce high CPU consumption and accumulate excessive data in the database of such instances, resulting in a denial of service. Servers in private federations, or those that do not federate, are not affected.
* | Send an email if the address is already bound to an user account (#16819)mcalinghee2024-04-231-0/+9
| | | | | | | | Co-authored-by: Mathieu Velten <mathieu.velten@beta.gouv.fr> Co-authored-by: Olivier D <odelcroi@gmail.com>
* | Parse json validation (#16923)Gordan Trevis2024-04-182-0/+113
| | | | | | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* | Support for MSC4108 via delegation (#17086)Quentin Gliech2024-04-171-4/+30
| | | | | | | | | | | | | | This adds support for MSC4108 via delegation, similar to what has been done for MSC3886 --------- Co-authored-by: Hugh Nimmo-Smith <hughns@element.io>
* | Parse Integer negative value validation (#16920)Gordan Trevis2024-04-161-2/+3
| |
* | bugfix: make msc3967 idempotent (#16943)Kegan Dougal2024-04-151-0/+50
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MSC3967 was updated recently to make it more robust to network failures: > there is an existing cross-signing master key and it exactly matches the cross-signing master key provided in the request body. If there are any additional keys provided in the request (self signing key, user signing key) they MUST also match the existing keys stored on the server. In other words, the request contains no new keys. If there are new keys, UIA MUST be performed. https://github.com/matrix-org/matrix-spec-proposals/blob/hughns/device-signing-upload-uia/proposals/3967-device-signing-upload-uia.md#proposal This covers the case where the 200 OK is lost in transit so the client retries the upload, only to then get UIA'd. Complement tests: https://github.com/matrix-org/complement/pull/713 - passing example https://github.com/element-hq/synapse/actions/runs/7976948122/job/21778795094?pr=16943#step:7:8820 ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: reivilibre <oliverw@matrix.org>
* Stabliize support for MSC3981: recurse /relations (#17023)Patrick Cloke2024-04-091-6/+3
| | | | | | | See [MSC3981](https://github.com/matrix-org/matrix-spec-proposals/pull/3981), this pretty much just removes flags though. Part of #17021
* Also check if first event matches the last in prev batch (#17066)Erik Johnston2024-04-091-0/+95
| | | | | Refinement of #17064 cc @richvdh
* Fix bug in calculating state for non-gappy syncs (#16942)Richard van der Hoff2024-04-041-0/+105
| | | | | | | | | Unfortunately, the optimisation we applied here for non-gappy syncs is not actually valid. Fixes https://github.com/element-hq/synapse/issues/16941. ~~Based on https://github.com/element-hq/synapse/pull/16930.~~ Requires https://github.com/matrix-org/sytest/pull/1374.
* `/sync`: fix bug in calculating `state` response (#16930)Richard van der Hoff2024-04-041-0/+80
| | | | | | | Fix a long-standing issue which could cause state to be omitted from the sync response if the last event was filtered out. Fixes: https://github.com/element-hq/synapse/issues/16928
* Fix bug in `/sync` response for archived rooms (#16932)Richard van der Hoff2024-04-042-20/+206
| | | | | | | | | | | | This PR fixes a very, very niche edge-case, but I've got some more work coming which will otherwise make the problem worse. The bug happens when the syncing user leaves a room, and has a sync filter which includes "left" rooms, but sets the timeline limit to 0. In that case, the state returned in the `state` section is calculated incorrectly. The fix is to pass a token corresponding to the point that the user leaves the room through to `compute_state_delta`.
* Do not refuse to set read_marker if previous event_id is in wrong room (#16990)SpiritCroc2024-03-211-4/+4
|
* Fix reject knocks on deactivating account (#17010)Hanadi2024-03-211-2/+85
|
* Patch the db conn pool sooner in tests (#17017)Richard van der Hoff2024-03-211-53/+59
| | | | | | | | | When running unit tests, we patch the database connection pool so that it runs queries "synchronously". This is ok, except that if any queries are launched before we do the patching, those queries get left in limbo and never complete. To fix this, let's change the way we do the switcheroo, by patching out the method which creates the connection pool in the first place.
* Update power level default for public rooms (#16907)Shay2024-03-191-0/+18
|
* Improve event validation (#16908)Shay2024-03-192-2/+153
| | | As the title states.
* Specify IP subnet literals in canonical form (#16953)V024602024-03-191-2/+2
| | | | | This is needed, because the netaddr package removed support for the implicit prefix form in version 1.0.0: https://github.com/netaddr/netaddr/pull/360
* Improve lock performance when a lot of locks are waiting (#16840)Mathieu Velten2024-03-142-1/+64
| | | | | | | | | | | | When a lot of locks are waiting for a single lock, notifying all locks independently with `call_later` on each release is really costly and incurs some kind of async contention, where the CPU is spinning a lot for not much. The included test is taking around 30s before the change, and 0.5s after. It was found following failing tests with https://github.com/element-hq/synapse/pull/16827.
* Bump mypy from 1.5.1 to 1.8.0 (#16901)dependabot[bot]2024-03-131-1/+1
|
* Bump black from 23.10.1 to 24.2.0 (#16936)dependabot[bot]2024-03-138-36/+34
|
* deactivated flag refactored to filter deactivated users. (#16874)Alexander Fechler2024-03-111-3/+53
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Stabilize support for Retry-After header (MSC4014) (#16947)Patrick Cloke2024-03-082-9/+2
|
* Don't invalidate the entire event cache when we purge history (#16905)Erik Johnston2024-02-131-0/+31
| | | | | We do this by adding support to the LRU cache for "extra indices" based on the cached value. This allows us to efficiently map from room ID to the cached events and only invalidate those.
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-23242-0/+258
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* Allow room creation but not publishing to continue if room publication rules ↵Shay2024-01-222-30/+58
| | | | | | | | | | | | | are violated when creating a new room. (#16811) Prior to this PR, if a request to create a public (public as in published to the rooms directory) room violated the room list publication rules set in the [config](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#room_list_publication_rules), the request to create the room was denied and the room was not created. This PR changes the behavior such that when a request to create a room published to the directory violates room list publication rules, the room is still created but the room is not published to the directory.
* Handle wildcard type filters properly (#14984)Mo Balaa2024-01-222-1/+29
|
* Filter out rooms from the room directory being served to other homeservers ↵reivilibre2024-01-081-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when those rooms block that homeserver by their Access Control Lists. (#16759) The idea here being that the directory server shouldn't advertise rooms to a requesting server is the requesting server would not be allowed to join or participate in the room. <!-- Fixes: # <!-- --> <!-- Supersedes: # <!-- --> <!-- Follows: # <!-- --> <!-- Part of: # <!-- --> Base: `develop` <!-- git-stack-base-branch:develop --> <!-- This pull request is commit-by-commit review friendly. <!-- --> <!-- This pull request is intended for commit-by-commit review. <!-- --> Original commit schedule, with full messages: <ol> <li> Pass `from_federation_origin` down into room list retrieval code </li> <li> Don't cache /publicRooms response for inbound federated requests </li> <li> fixup! Don't cache /publicRooms response for inbound federated requests </li> <li> Cap the number of /publicRooms entries to 100 </li> <li> Simplify code now that you can't request unlimited rooms </li> <li> Filter out rooms from federated requests that don't have the correct ACL </li> <li> Request a handful more when filtering ACLs so that we can try to avoid shortchanging the requester </li> </ol> --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* Port `EventInternalMetadata` class to Rust (#16782)Erik Johnston2024-01-083-5/+7
| | | | | | | | | | | | | There are a couple of things we need to be careful of here: 1. The current python code does no validation when loading from the DB, so we need to be careful to ignore such errors (at least on jki.re there are some old events with internal metadata fields of the wrong type). 2. We want to be memory efficient, as we often have many hundreds of thousands of events in the cache at a time. --------- Co-authored-by: Quentin Gliech <quenting@element.io>
* Search non ASCII display names using Admin API (#16767)Adam Jędrzejewski2024-01-041-0/+23
| | | | | Closes #16370 Signed-off-by: Adam Jedrzejewski <adamjedrzejewski@icloud.com>
* Fix email verification redirection (#16761)FadhlanR2024-01-021-3/+40
| | | | | | Previously, the response status of `HTMLResource` was hardcoded as `200`. However, for proper redirection after the user verifies their email, we require the status to be `302`. This PR addresses that issue by using `code` as response status.
* Enable user without password (#16770)Dirk Klimpel2024-01-021-8/+23
| | | | | | | | | | | Closes: - https://github.com/matrix-org/synapse/issues/10397 - #10397 An administrator should know whether he wants to set a password or not. There are many uses cases where a blank password is required. - Use of only some users with SSO. - Use of bots with password, users with SSO
* Merge remote-tracking branch 'gitlab/clokep/license-license' into new_developErik Johnston2023-12-13293-2971/+4689
|\
| * Update license headersPatrick Cloke2023-11-21293-2971/+4689
| |
* | Add avatar and topic settings for server notice room (#16679)Mathieu Velten2023-12-121-0/+109
| |
* | Expose OIDC discovery information under the CSAPI (#16726)David Robertson2023-12-061-0/+59
| | | | | | | | Co-authored-by: Quentin Gliech <quenting@element.io>
* | Revert postgres logical replication deltaas v1.98.0rc1David Robertson2023-12-051-84/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts two commits: 0bb8e418a41c6f583ca9d705b400e37e2308a534 "Fix postgres schema after dropping old tables (#16730)" and 51e4e35653f98c3f61222fbdbdb1dcb8864f7fca "Add a Postgres `REPLICA IDENTITY` to tables that do not have an implicit one. This should allow use of Postgres logical replication. (take 2, now with no added deadlocks!) (#16658)" and also amends the changelog.
* | Fix upgrading a room without `events` field in power levels (#16725)David Robertson2023-12-051-0/+28
| |
* | Add a Postgres `REPLICA IDENTITY` to tables that do not have an implicit ↵reivilibre2023-12-041-1/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | one. This should allow use of Postgres logical replication. (take 2, now with no added deadlocks!) (#16658) * Add `ALTER TABLE ... REPLICA IDENTITY ...` for individual tables We can't combine them into one file as it makes it likely to hit a deadlock if Synapse is running, as it only takes one other transaction to access two tables in a different order to the schema delta. * Add notes * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> * Re-introduce REPLICA IDENTITY test --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* | Server notices: add an autojoin setting for the notices room (#16699)Mathieu Velten2023-12-041-0/+27
| | | | | | | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* | Implement MSC4069: Inhibit profile propagation (#16636)Travis Ralston2023-12-041-0/+160
| | | | | | MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/4069
* | Request & follow redirects for /media/v3/download (#16701)Patrick Cloke2023-11-292-5/+59
| | | | | | | | | | | | Implement MSC3860 to follow redirects for federated media downloads. Note that the Client-Server API doesn't support this (yet) since the media repository in Synapse doesn't have a way of supporting redirects.
* | Move media retention tests out of rest tests (#16684)David Robertson2023-11-271-0/+0
| | | | | | | | | | | | | | | | * Move media retention tests out of rest tests AFAICS this doesn't make any HTTP requests and so it ought not to belong in `tests.rest`. * Changelog
* | Keep track of `user_ips` and `monthly_active_users` when delegating auth ↵David Robertson2023-11-236-44/+126
|/ | | | | | | | | | | | | (#16672) * Describe `insert_client_ip` * Pull out client_ips and MAU tracking to BaseAuth * Define HAS_AUTHLIB once in tests sick of copypasting * Track ips and token usage when delegating auth * Test that we track MAU and user_ips * Don't track `__oidc_admin`
* Revert "Add a Postgres `REPLICA IDENTITY` to tables that do not have an ↵Erik Johnston2023-11-161-84/+1
| | | | | implicit one. This should allow use of Postgres logical replication. (#16456)" (#16651) This reverts commit 69afe3f7a0d89f3422ddbd3aa16bc9bbc01056eb.
* Speed up persisting large number of outliers (#16649)Erik Johnston2023-11-161-1/+75
| | | Recalculating the roots tuple every iteration could be very expensive, so instead let's do a topological sort.
* Fix sending out of order `POSITION` over replication (#16639)Erik Johnston2023-11-161-0/+8
| | | | | If a worker reconnects to Redis we send out the current positions of all our streams. However, if we're also trying to send out a backlog of RDATA at the same time then we can end up sending a `POSITION` with the current token *before* we've sent all the RDATA before the current token. This doesn't cause actual bugs as the receiving servers see the POSITION, fetch the relevant rows from the DB, and then ignore the old RDATA as they come in. However, this is inefficient so it'd be better if we didn't send out-of-order positions
* Fix test not detecting tables with missing primary keys and missing replica ↵reivilibre2023-11-161-3/+4
| | | | | | | | | | | | | | | identities, then add more replica identities. (#16647) * Fix the CI query that did not detect all cases of missing primary keys * Add more missing REPLICA IDENTITY entries * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* Add an Admin API to temporarily grant the ability to update an existing ↵David Robertson2023-11-154-2/+410
| | | | cross-signing key without UIA (#16634)
* Asynchronous Uploads (#15503)Sumner Evans2023-11-151-1/+3
| | | Support asynchronous uploads as defined in MSC2246.
* Use full GitHub links instead of bare issue numbers. (#16637)Patrick Cloke2023-11-1515-29/+38
|
* Add a Postgres `REPLICA IDENTITY` to tables that do not have an implicit ↵reivilibre2023-11-131-1/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | one. This should allow use of Postgres logical replication. (#16456) * Add Postgres replica identities to tables that don't have an implicit one Fixes #16224 * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> * Move the delta to version 83 as we missed the boat for 82 * Add a test that all tables have a REPLICA IDENTITY * Extend the test to include when indices are deleted * isort * black * Fully qualify `oid` as it is a 'hidden attribute' in Postgres 11 * Update tests/storage/test_database.py Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> * Add missed tables --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Use attempt_to_set_autocommit everywhere. (#16615)Patrick Cloke2023-11-091-10/+5
| | | To avoid asserting the type of the database connection.
* Use dbname instead of database for Postgres config. (#16618)Patrick Cloke2023-11-092-4/+4
|
* Convert simple_select_one_txn and simple_select_one to return tuples. (#16612)Patrick Cloke2023-11-097-26/+21
|
* Return attrs for more media repo APIs. (#16611)Patrick Cloke2023-11-093-19/+19
|
* Bulk-invalidate e2e cached queries after claiming keys (#16613)David Robertson2023-11-091-0/+117
| | | | Co-authored-by: Patrick Cloke <patrickc@matrix.org>
* Avoid updating the same rows multiple times with simple_update_many_txn. ↵Patrick Cloke2023-11-071-2/+2
| | | | | | (#16609) simple_update_many_txn had a bug in it which would cause each update to be applied twice.
* Avoid executing no-op queries. (#16583)Patrick Cloke2023-11-071-20/+5
| | | | | | If simple_{insert,upsert,update}_many_txn is called without any data to modify then return instead of executing the query. This matches the behavior of simple_{select,delete}_many_txn.
* More tests for the simple_* methods. (#16596)Patrick Cloke2023-11-071-18/+628
| | | | Expand tests for the simple_* database methods, additionally test against both PostgreSQL and SQLite variants.
* Bump twisted from 23.8.0 to 23.10.0 (#16588)dependabot[bot]2023-11-012-2/+2
|
* Remove remaining usage of cursor_to_dict. (#16564)Patrick Cloke2023-10-313-21/+16
|
* Claim local one-time-keys in bulk (#16565)David Robertson2023-10-301-0/+158
| | | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Claim fallback keys in bulk (#16570)David Robertson2023-10-301-0/+77
|
* Ensure local invited & knocking users leave before purge. (#16559)Patrick Cloke2023-10-271-1/+52
| | | | | This is mostly useful for federated rooms where some users would get stuck in the invite or knock state when the room was purged from their homeserver.
* Add new module API for adding custom fields to events `unsigned` section ↵Erik Johnston2023-10-272-1/+60
| | | | (#16549)
* Remove more usages of cursor_to_dict. (#16551)Patrick Cloke2023-10-264-11/+10
| | | Mostly to improve type safety.
* Add a new module API to update user presence state. (#16544)Patrick Cloke2023-10-262-11/+119
| | | | | | | | | | This adds a module API which allows a module to update a user's presence state/status message. This is useful for controlling presence from an external system. To fully control presence from the module the presence.enabled config parameter gains a new state of "untracked" which disables internal tracking of presence changes via user actions, etc. Only updates from the module will be persisted and sent down sync properly).
* Convert simple_select_list and simple_select_list_txn to return lists of ↵Patrick Cloke2023-10-269-240/+262
| | | | | tuples (#16505) This should use fewer allocations and improves type hints.
* Allow multiple workers to write to receipts stream. (#16432)Erik Johnston2023-10-252-4/+256
| | | Fixes #16417
* Fix tests on Twisted trunk. (#16528)Patrick Cloke2023-10-255-111/+94
| | | | | | | | | | | | | Twisted trunk makes a change to the `TLSMemoryBIOFactory` where the underlying protocol is changed from `TLSMemoryBIOProtocol` to `BufferingTLSTransport` to improve performance of TLS code (see https://github.com/twisted/twisted/issues/11989). In order to properly hook this code up in tests we need to pass the test reactor's clock into `TLSMemoryBIOFactory` to avoid the global (trial) reactor being used by default. Twisted does something similar internally for tests: https://github.com/twisted/twisted/blob/157cd8e659705940e895d321339d467e76ae9d0a/src/twisted/web/test/test_agent.py#L871-L874
* Fix http/s proxy authentication with long username/passwords (#16504)Richard Brežák2023-10-241-0/+21
|
* Revert "Add test case to detect dodgy b64 encoding"David Robertson2023-10-241-14/+0
| | | | | | | | | This reverts commit 5fe76b9434e22bb752c252dd9c66c3c2bfb90dfc. I think I had this accidentally commited on my local develop branch, and so it accidentally got merged into upstream develop. This should re-land with corrections in #16504.
* Merge branch 'develop' of github.com:matrix-org/synapse into developDavid Robertson2023-10-245-15/+129
|\
| * Fix type hint errors from Twisted trunk (#16526)Patrick Cloke2023-10-234-3/+5
| |
| * Fix bug where a new writer advances their token too quickly (#16473)Erik Johnston2023-10-231-12/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix bug where a new writer advances their token too quickly When starting a new writer (for e.g. persisting events), the `MultiWriterIdGenerator` doesn't have a minimum token for it as there are no rows matching that new writer in the DB. This results in the the first stream ID it acquired being announced as persisted *before* it actually finishes persisting, if another writer gets and persists a subsequent stream ID. This is due to the logic of setting the minimum persisted position to the minimum known position of across all writers, and the new writer starts off not being considered. * Fix sending out POSITIONs when our token advances without update Broke in #14820 * For replication HTTP requests, only wait for minimal position
* | Add test case to detect dodgy b64 encodingDavid Robertson2023-10-231-0/+14
|/
* Avoid sending massive replication updates when purging a room. (#16510)Patrick Cloke2023-10-181-29/+62
|
* Convert DeviceLastConnectionInfo to attrs. (#16507)Patrick Cloke2023-10-171-67/+70
| | | To improve type safety & memory usage.
* Fix a bug where servers could be marked as up when they were failing (#16506)Patrick Cloke2023-10-171-0/+75
| | | | After this change a server will only be reported as back online if they were previously having requests fail.
* Convert state delta processing from a dict to attrs. (#16469)Patrick Cloke2023-10-161-1/+1
| | | For improved type checking & memory usage.
* Convert user_get_threepids response to attrs. (#16468)Patrick Cloke2023-10-111-4/+4
| | | This improves type annotations by not having a dictionary of Any values.
* Convert simple_select_many_batch, simple_select_many_txn to tuples. (#16444)Patrick Cloke2023-10-111-26/+38
|
* Handle content types with parameters. (#16440)Patrick Cloke2023-10-111-1/+18
|
* Apply join rate limiter outside the lineariser (#16441)David Robertson2023-10-061-0/+24
|
* Return ThumbnailInfo in more places (#16438)Patrick Cloke2023-10-061-18/+18
| | | | Improves type hints by using concrete types instead of dictionaries.
* Stop sending incorrect knock_state_events. (#16403)Patrick Cloke2023-10-061-1/+1
| | | | | | | | | Synapse was incorrectly implemented with a knock_state_events property on some APIs (instead of knock_room_state). This was correct in Synapse 1.70.0, but *both* fields were sent to also be compatible with Synapse versions expecting the wrong field. Enough time has passed that only the correct field needs to be included/handled.
* Register media servlets via regex. (#16419)Patrick Cloke2023-10-0610-219/+193
| | | | | This converts the media servlet URLs in the same way as (most) of the rest of Synapse. This will give more flexibility in the versions each endpoint exists under.
* Factor out `MultiWriter` token from `RoomStreamToken` (#16427)Erik Johnston2023-10-051-4/+4
|
* Some refactors around receipts stream (#16426)Erik Johnston2023-10-042-11/+23
|
* Remove Python version from `/_synapse/admin/v1/server_version` (#16380)MomentQYC2023-10-021-3/+1
| | | | There's no reason to expose the full Python version over what is frequently a public API.
* Support rendering some media downloads as inline (#15988)Will Hunt2023-09-292-4/+65
| | | | | Use an `inline` Content-Disposition header when the media is "safe" to display inline (some known text, image, video, audio formats).
* Improve state types. (#16395)Patrick Cloke2023-09-281-5/+8
|
* Add a cache around server ACL checking (#16360)Patrick Cloke2023-09-261-13/+22
| | | | | * Pre-compiles the server ACLs onto an object per room and invalidates them when new events come in. * Converts the server ACL checking into Rust.
* Add support for pydantic v2 via pydantic.v1 compat module (#16332)Maxwell G2023-09-251-1/+7
| | | While maintaining support with pydantic v1.
* Convert more cached return values to immutable types (#16356)Patrick Cloke2023-09-201-16/+19
|
* Stop patching EventBase.__eq__ in tests. (#16349)Patrick Cloke2023-09-182-36/+30
| | | | It is clearer to directly test equality instead of doing indirect assertions via patching __eq__.
* Filter locked users in the admin API (#16328)Hanadi2023-09-181-0/+26
| | | | Co-authored-by: Hanadi Tamimi <hanadi.tamimi@sdui.de>
* Return an immutable value from get_latest_event_ids_in_room. (#16326)Patrick Cloke2023-09-186-25/+33
|
* Additional validation of receipts (#16327)Patrick Cloke2023-09-182-161/+214
| | | | Reject invalid receipts with a reasonable error message & expands tests for receipts.
* Add automatic purge after all users forget a room (#15488)Mathieu Velten2023-09-153-23/+162
| | | | | | Also add restore of purge/shutdown rooms after a synapse restart. Co-authored-by: Eric Eastwood <erice@matrix.org> Co-authored-by: Erik Johnston <erikj@matrix.org>
* Refactor `get_user_by_id` (#16316)Erik Johnston2023-09-142-27/+33
|
* Fix using dehydrated devices (MSC2697) & refresh tokens (#16288)Hanadi2023-09-131-1/+9
| | | | | Refresh tokens were not correctly moved to the rehydrated device (similar to how the access token is currently handled). This resulted in invalid refresh tokens after rehydration.
* Refactor storing of server keys (#16261)Erik Johnston2023-09-123-190/+26
|
* Add the List-Unsubscribe header for notification emails. (#16274)Patrick Cloke2023-09-111-0/+55
| | | | | | | | Adds both the List-Unsubscribe (RFC2369) and List-Unsubscribe-Post (RFC8058) headers to push notification emails, which together should: * Show an "Unsubscribe" link in the MUA UI when viewing Synapse notification emails. * Enable "one-click" unsubscribe (the user never leaves their MUA, which automatically makes a POST request to the specified endpoint).
* Update ruff config (#16283)Patrick Cloke2023-09-0816-38/+38
| | | Enable additional checks & clean-up unneeded configuration.
* Avoid temporary storage of sensitive information. (#16272)Patrick Cloke2023-09-081-0/+13
| | | | During the UI auth process, avoid storing sensitive information into the database.
* Send the opentracing span information to appservices (#16227)Marcel2023-09-061-6/+12
|
* Handle "registration_enabled" parameter for CAS (#16262)Aurélien Grimpard2023-09-061-0/+17
| | | | Similar to OIDC, CAS providers can now disable registration such that only existing users are able to login via SSO.
* Merge remote-tracking branch 'origin/release-v1.92' into developPatrick Cloke2023-09-062-191/+23
|\
| * Merge remote-tracking branch 'origin/release-v1.91' into release-v1.92Patrick Cloke2023-09-062-191/+23
| |\
| | * Revert MSC3861 introspection cache, admin impersonation and account lock ↵Quentin Gliech2023-09-062-192/+24
| | | | | | | | | | | | (#16258)
* | | Delete device messages asynchronously and in staged batches (#16240)Mathieu Velten2023-09-061-0/+47
| | |
* | | Fix appservices being unable to handle to_device messages for multiple users ↵Will Hunt2023-09-051-0/+125
| | | | | | | | | | | | (#16251)
* | | Add MSC4040 `matrix-fed` service lookups (#16137)Travis Ralston2023-09-051-29/+294
| | |
* | | Time out busy presence status & test multi-device busy (#16174)Patrick Cloke2023-09-051-3/+101
| | | | | | | | | | | | | | | | | | | | | Add a (long) timeout to when a "busy" device is considered not online. This does *not* match MSC3026, but is a reasonable thing for an implementation to do. Expands tests for the (unstable) busy presence with multiple devices.
* | | Track presence state per-device and combine to a user state. (#16066)Patrick Cloke2023-09-051-10/+490
|/ / | | | | | | | | | | | | | | | | | | | | Tracks presence on an individual per-device basis and combine the per-device state into a per-user state. This should help in situations where a user has multiple devices with conflicting status (e.g. one is syncing with unavailable and one is syncing with online). The tie-breaking is done by priority: BUSY > ONLINE > UNAVAILABLE > OFFLINE
* | Don't wake up destination transaction queue if they're not due for retry. ↵Erik Johnston2023-09-043-23/+66
| | | | | | | | (#16223)
* | Add last_seen_ts to the admin users API (#16218)Mathieu Velten2023-09-042-0/+61
| |
* | Don't reset retry timers on "valid" error codes (#16221)Erik Johnston2023-09-041-2/+2
| |
* | Log the details of background update failures (#16212)David Robertson2023-09-011-1/+23
| |
* | Fix rare bug that broke looping calls (#16210)Erik Johnston2023-08-301-0/+2
| | | | | | | | | | | | | | | | | | | | * Fix rare bug that broke looping calls We can't interact with the reactor from the main thread via looping call. Introduced in v1.90.0 / #15791. * Newsfile
* | Stop writing to the event_txn_id table (#16175)Patrick Cloke2023-08-301-11/+4
| |
* | Describe which rate limiter was hit in logs (#16135)David Robertson2023-08-303-29/+84
| |
* | Bump mypy-zope & mypy. (#16188)Patrick Cloke2023-08-2933-111/+111
| |
* | Support IPv6-only SMTP servers (#16155)Evilham2023-08-293-12/+113
| | | | | | | | Use Twisted HostnameEndpoint to connect to SMTP servers (instead of connectTCP/connectSSL) which properly supports IPv6-only servers.
* | Pass the device ID around in the presence handler (#16171)Patrick Cloke2023-08-281-11/+27
| | | | | | | | | | | | Refactoring to pass the device ID (in addition to the user ID) through the presence handler (specifically the `user_syncing`, `set_state`, and `bump_presence_active_time` methods and their replication versions).
* | Combine logic about not overriding BUSY presence. (#16170)Patrick Cloke2023-08-281-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | Simplify some of the presence code by reducing duplicated code between worker & non-worker modes. The main change is to push some of the logic from `user_syncing` into `set_state`. This is done by passing whether the user is setting the presence via a `/sync` with a new `is_sync` flag to `set_state`. If this is `true` some additional logic is performed: * Don't override `busy` presence. * Update the `last_user_sync_ts`. * Never update the status message.
* | Task scheduler: add replication notify for new task to launch ASAP (#16184)Mathieu Velten2023-08-281-18/+40
| |
* | Prepare unit tests for Python 3.12 (#16099)V024602023-08-259-71/+80
| |
* | Replace simple_async_mock with AsyncMock (#16180)Patrick Cloke2023-08-2514-160/+139
| | | | | | | | Python 3.8 has a native AsyncMock, use it instead of a custom implementation.
* | Replace make_awaitable with AsyncMock (#16179)Patrick Cloke2023-08-2435-603/+506
| | | | | | | | Python 3.8 provides a native AsyncMock, we can replace the homegrown version we have.
* | Fix typechecking with twisted trunk (#16121)David Robertson2023-08-241-8/+6
| |
* | Add `Retry-After` to M_LIMIT_EXCEEDED error responses (#16136)Will Hunt2023-08-242-6/+54
| | | | | | Implements MSC4041 behind an experimental configuration flag.
* | Stabilize support for MSC3958 (suppress notifications from edits). (#16113)Patrick Cloke2023-08-231-1/+0
|/
* Filter out unwanted user_agents from udv. (#16124)Neil Johnson2023-08-231-0/+65
|
* Add tests for restoring the presence state after a restart. (#16151)Patrick Cloke2023-08-231-0/+116
|
* Properly update retry_last_ts when hitting the maximum retry interval (#16156)DeepBlueV7.X2023-08-231-0/+51
| | | | | | | | | | | | | | | | | | | | | * Properly update retry_last_ts when hitting the maximum retry interval This was broken in 1.87 when the maximum retry interval got changed from almost infinite to a week (and made configurable). fixes #16101 Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de> * Add changelog * Change fix + add test * Add comment --------- Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de> Co-authored-by: Mathieu Velten <mathieuv@matrix.org>
* Clean-up presence tests (#16158)Patrick Cloke2023-08-221-92/+37
| | | Reduce duplicated code & remove unused variables.
* Disable `m.3pid_changes` capability when MSC3861 is enabled. (#16134)Mathieu Velten2023-08-221-0/+5
|
* Add an admin endpoint to allow authorizing server to signal token ↵Shay2023-08-222-1/+95
| | | | revocations (#16125)
* Fix user directory test for deactivated support user. (#16157)Patrick Cloke2023-08-221-8/+11
| | | | Support users should not be added to the user directory after being deactivated.
* Properly call setup_background_tasks in unit tests. (#16150)Patrick Cloke2023-08-221-2/+0
| | | | | This should only be called on HomeServer objects which are configured to run background tasks, which is automatically (and properly) done via the call to setup().
* Disallow user_consent where experimental MSC3861 is enabled (#16127)Hugh Nimmo-Smith2023-08-221-0/+16
|
* Implements a task scheduler for resumable potentially long running tasks ↵Mathieu Velten2023-08-211-0/+186
| | | | (#15891)
* Speed up state res in rare case we don't have all events (#16116)Erik Johnston2023-08-181-48/+193
| | | | | | | If we don't have all the auth events in a room then not all state events will have a chain cover index. Even so, we can still use the chain cover index on the events that do have it, rather than bailing and using the slower functions. This situation should not arise for newly persisted rooms, as we check we have the full auth chain for each event, but can happen for existing rooms. c.f. #15245
* MSC3861: allow impersonation by an admin using a query param (#16132)Mathieu Velten2023-08-181-0/+35
|
* Allow filtering for admins in the list accounts admin API (#16114)Alexander Fechler2023-08-181-0/+38
|
* Add cache to `get_server_keys_json_for_remote` (#16123)Erik Johnston2023-08-181-38/+23
|
* Cache token introspection response from OIDC provider (#16117)Shay2023-08-171-0/+62
|
* Fix database performance of read/write worker locks (#16061)Erik Johnston2023-08-171-3/+4
| | | | | | | We were seeing serialization errors when taking out multiple read locks. The transactions were retried, so isn't causing any failures. Introduced in #15782.
* Run pyupgrade for python 3.7 & 3.8. (#16110)Patrick Cloke2023-08-1513-42/+43
|
* Implements admin API to lock an user (MSC3939) (#15870)Mathieu Velten2023-08-103-1/+114
|
* Support MSC3814: Dehydrated Devices Part 2 (#16010)Shay2023-08-082-7/+79
|
* Fix deletion for Dehydrated Devices (#16046)Shay2023-08-041-1/+138
|
* Move support for application service query parameter authorization behind a ↵Shay2023-08-031-4/+81
| | | | configuration option (#16017)
* Allow config of the backoff algorithm for the federation client. (#15754)Mathieu Velten2023-08-032-13/+18
| | | | | | | | | | | Adds three new configuration variables: * destination_min_retry_interval is identical to before (10mn). * destination_retry_multiplier is now 2 instead of 5, the maximum value will be reached slower. * destination_max_retry_interval is one day instead of (essentially) infinity. Capping this will cause destinations to continue to be retried sometimes instead of being lost forever. The previous value was 2 ^ 62 milliseconds.
* Add forward-compatibility for the redacts property (MSC2174). (#16013)Patrick Cloke2023-08-021-17/+50
| | | | | | | | The location of the redacts field changes in room version 11. Ensure it is copied to the *new* location for *old* room versions for forwards-compatibility with clients. Note that copying it to the *old* location for the *new* room version was previously handled.
* Update MSC3958 support to interact with intentional mentions. (#15992)Patrick Cloke2023-08-021-2/+19
| | | | | | | * Updates the rule ID. * Use `event_property_is` instead of `event_match`. This updates the implementation of MSC3958 to match the latest text from the MSC.
* Trim whitespace when setting display names (#16031)Mohit Rathee2023-08-011-0/+12
|
* Add ability to wait for locks and add locks to purge history / room deletion ↵Erik Johnston2023-07-313-2/+128
| | | | | (#15791) c.f. #13476
* Fix 404 on /profile when the display name is empty but not the avatar (#16012)Mathieu Velten2023-07-271-0/+10
|
* Remove support for legacy application service paths (#15964)Shay2023-07-261-53/+0
|
* Support MSC3814: Dehydrated Devices (#15929)Shay2023-07-242-3/+246
| | | | | | Signed-off-by: Nicolas Werner <n.werner@famedly.com> Co-authored-by: Nicolas Werner <n.werner@famedly.com> Co-authored-by: Nicolas Werner <89468146+nico-famedly@users.noreply.github.com> Co-authored-by: Hubert Chathi <hubert@uhoreg.ca>
* Properly handle redactions of creation events (#15973)Shay2023-07-231-2/+7
|
* Actually stop reading from column `user_id` of tables `profiles` (#15955)Shay2023-07-231-1/+1
|
* Merge branch 'master' into developOlivier Wilkinson (reivilibre)2023-07-182-0/+157
|\
| * Revert "Stop writing to column `user_id` of tables `profiles` and ↵Shay2023-07-182-0/+157
| | | | | | | | | | | | | | | | | | `user_filters`. (#15953) * Revert "Stop writing to column `user_id` of tables `profiles` and `user_filters` (#15787)" This reverts commit f25b0f88081bb436bef914983cff7087b54eba5f. * newsfragement
* | Support room version 11 (#15912)Patrick Cloke2023-07-182-18/+33
| | | | | | | | | | And fix a bug in the implementation of the updated redaction format (MSC2174) where the top-level redacts field was not properly added for backwards-compatibility.
* | Re-introduce the outbound federation proxy (#15913)Eric Eastwood2023-07-1817-39/+396
| | | | | | | | | | Allow configuring the set of workers to proxy outbound federation traffic through (`outbound_federation_restricted_to`). This is useful when you have a worker setup with `federation_sender` instances responsible for sending outbound federation requests and want to make sure *all* outbound federation traffic goes through those instances. Before this change, the generic workers would still contact federation themselves for things like profile lookups, backfill, etc. This PR allows you to set more strict access controls/firewall for all workers and only allow the `federation_sender`'s to contact the outside world.
* | Mark get_user_in_directory private since only used in tests (#15884)Mathieu Velten2023-07-122-12/+12
| |
* | Unix Sockets for HTTP Replication (#15708)Jason Little2023-07-112-2/+37
| | | | | | | | | | | | | | | | | | Unix socket support for `federation` and `client` Listeners has existed now for a little while(since [1.81.0](https://github.com/matrix-org/synapse/pull/15353)), but there was one last hold out before it could be complete: HTTP Replication communication. This should finish it up. The Listeners would have always worked, but would have had no way to be talked to/at. --------- Co-authored-by: Eric Eastwood <madlittlemods@gmail.com> Co-authored-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> Co-authored-by: Eric Eastwood <erice@element.io>
* | Add + as an allowed character for Matrix IDs (MSC4009) (#15911)Patrick Cloke2023-07-111-6/+5
|/
* Add `Server` to Access-Control-Expose-Headers header (#15908)Michael Telatynski2023-07-111-1/+1
|
* Revert "Federation outbound proxy" (#15910)Eric Eastwood2023-07-1016-299/+37
| | | | | | Revert "Federation outbound proxy (#15773)" This reverts commit b07b14b494ae1dd564b4c44f844c9a9545b3d08a.
* Fix downgrading to previous version of Synapse (#15907)Erik Johnston2023-07-101-2/+6
| | | We do this by marking the constraint as deferrable.
* Stop writing to column `user_id` of tables `profiles` and `user_filters` ↵Shay2023-07-072-157/+0
| | | | (#15787)
* Remove `worker_replication_*` deprecated settings, with helpful errors on ↵Jason Little2023-07-072-29/+4
| | | | | | startup (#15860) Co-authored-by: reivilibre <oliverw@matrix.org>
* Federation outbound proxy (#15773)Eric Eastwood2023-07-0516-37/+299
| | | | | | | Allow configuring the set of workers to proxy outbound federation traffic through (`outbound_federation_restricted_to`). This is useful when you have a worker setup with `federation_sender` instances responsible for sending outbound federation requests and want to make sure *all* outbound federation traffic goes through those instances. Before this change, the generic workers would still contact federation themselves for things like profile lookups, backfill, etc. This PR allows you to set more strict access controls/firewall for all workers and only allow the `federation_sender`'s to contact the outside world. The original code is from @erikjohnston's branches which I've gotten in-shape to merge.
* Remove support for Python 3.7 (#15851)Eric Eastwood2023-07-051-8/+2
| | | Fix https://github.com/matrix-org/synapse/issues/15836
* Add basic read/write lock (#15782)Erik Johnston2023-07-051-1/+282
|
* Add foreign key constraint to `event_forward_extremities`. (#15751)Erik Johnston2023-07-052-4/+258
|
* Add not_user_type param to the list accounts admin API (#15844)Michael Weimann2023-07-041-0/+78
| | | Signed-off-by: Michael Weimann <michaelw@element.io>
* Add login spam checker API (#15838)Erik Johnston2023-06-261-2/+106
|
* Fix forgotten rooms missing in initial sync (#15815)Nicolas Werner2023-06-211-0/+21
| | | | | | | | If you leave a room and forget it, then rejoin it, the room would be missing from the next initial sync. fixes #13262 Signed-off-by: Nicolas Werner <n.werner@famedly.com>
* Allow for the configuration of max request retries and min/max retry delays ↵Mathieu Velten2023-06-211-1/+19
| | | | in the matrix federation client (#15783)
* Switch from `matrix://` to `matrix-federation://` scheme for internal ↵Eric Eastwood2023-06-202-19/+23
| | | | | | | Synapse routing of outbound federation traffic (#15806) `matrix://` is a registered specced scheme nowadays and doesn't make sense for our internal to Synapse use case anymore. ([discussion] (https://github.com/matrix-org/synapse/pull/15773#discussion_r1227598679))
* Remove experimental MSC2716 implementation to incrementally import history ↵Eric Eastwood2023-06-162-513/+0
| | | | | | | | | | | | into existing rooms (#15748) Context for why we're removing the implementation: - https://github.com/matrix-org/matrix-spec-proposals/pull/2716#issuecomment-1487441010 - https://github.com/matrix-org/matrix-spec-proposals/pull/2716#issuecomment-1504262734 Anyone wanting to continue MSC2716, should also address these leftover tasks: https://github.com/matrix-org/synapse/issues/10737 Closes https://github.com/matrix-org/synapse/issues/10737 in the fact that it is not longer necessary to track those things.