summary refs log tree commit diff
path: root/synapse/rest (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fixups to new push stream (#17038)Erik Johnston2024-03-281-1/+3
| | | Follow on from #17037
* Add support for moving `/push_rules` off of main process (#17037)Erik Johnston2024-03-281-3/+3
|
* Bump black from 23.10.1 to 24.2.0 (#16936)dependabot[bot]2024-03-135-26/+30
|
* deactivated flag refactored to filter deactivated users. (#16874)Alexander Fechler2024-03-112-2/+21
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Accept unprefixed form of MSC3981 recurse parameter (#16842)David Baker2024-02-061-1/+1
| | | Now that the MSC3981 has passed FCP
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-2383-0/+98
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* feat: add msc4028 to versions api (#16787)Hanadi2024-01-161-0/+2
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Search non ASCII display names using Admin API (#16767)Adam Jędrzejewski2024-01-041-1/+1
| | | | | Closes #16370 Signed-off-by: Adam Jedrzejewski <adamjedrzejewski@icloud.com>
* Fix email verification redirection (#16761)FadhlanR2024-01-021-1/+1
| | | | | | 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-9/+0
| | | | | | | | | | | 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-1394-953/+1502
|\
| * Update license headersPatrick Cloke2023-11-2194-953/+1502
| |
* | Expose OIDC discovery information under the CSAPI (#16726)David Robertson2023-12-062-0/+65
| | | | | | | | Co-authored-by: Quentin Gliech <quenting@element.io>
* | Set response values to zero if None for ↵Will Hunt2023-12-051-2/+2
| | | | | | | | | | | | /_synapse/admin/v1/federation/destinations (#16729)
* | Implement MSC4069: Inhibit profile propagation (#16636)Travis Ralston2023-12-042-3/+30
| | | | | | MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/4069
* | ModuleAPI SSO auth callbacks (#15207)Andrew Yasinishyn2023-12-011-0/+8
| | | | | | Signed-off-by: Andrii Yasynyshyn yasinishyn.a.n@gmail.com
* | Declare support for Matrix v1.7, v1.8, and v1.9. (#16707)Patrick Cloke2023-11-291-0/+3
| |
* | Enable refreshable tokens on the admin registration endpoint (#16642)Charles Wright2023-11-221-1/+9
|/ | | Signed-off-by: Charles Wright <cvwright@futo.org>
* Add an Admin API to temporarily grant the ability to update an existing ↵David Robertson2023-11-153-5/+53
| | | | cross-signing key without UIA (#16634)
* Asynchronous Uploads (#15503)Sumner Evans2023-11-155-42/+215
| | | Support asynchronous uploads as defined in MSC2246.
* Fix a long-standing bug where Synapse would not unbind third-party ↵reivilibre2023-11-091-11/+8
| | | | | | | | | | | | | | | identifiers for Application Service users when deactivated and would not emit a compliant response. (#16617) * Don't skip unbinding 3PIDs and returning success status when deactivating AS user Fixes #16608 * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* Convert simple_select_one_txn and simple_select_one to return tuples. (#16612)Patrick Cloke2023-11-092-5/+5
|
* Return attrs for more media repo APIs. (#16611)Patrick Cloke2023-11-091-8/+8
|
* Remove remaining usage of cursor_to_dict. (#16564)Patrick Cloke2023-10-314-9/+31
|
* Add new module API for adding custom fields to events `unsigned` section ↵Erik Johnston2023-10-275-16/+16
| | | | (#16549)
* Remove more usages of cursor_to_dict. (#16551)Patrick Cloke2023-10-263-3/+36
| | | Mostly to improve type safety.
* Add a new module API to update user presence state. (#16544)Patrick Cloke2023-10-261-4/+2
| | | | | | | | | | 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 user_get_threepids response to attrs. (#16468)Patrick Cloke2023-10-112-3/+4
| | | This improves type annotations by not having a dictionary of Any values.
* Inline simple_search_list/simple_search_list_txn. (#16434)Patrick Cloke2023-10-101-1/+12
| | | | This only has a single use and is over abstracted. Inline it so that we can improve type hints.
* Convert simple_select_list_paginate_txn to return tuples. (#16433)Patrick Cloke2023-10-061-1/+7
|
* Return ThumbnailInfo in more places (#16438)Patrick Cloke2023-10-061-56/+42
| | | | Improves type hints by using concrete types instead of dictionaries.
* Register media servlets via regex. (#16419)Patrick Cloke2023-10-066-72/+89
| | | | | 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-1/+1
|
* Remove Python version from `/_synapse/admin/v1/server_version` (#16380)MomentQYC2023-10-021-5/+1
| | | | There's no reason to expose the full Python version over what is frequently a public API.
* Add support for pydantic v2 via pydantic.v1 compat module (#16332)Maxwell G2023-09-256-6/+40
| | | While maintaining support with pydantic v1.
* Add missing license header. (#16359)Patrick Cloke2023-09-211-0/+13
|
* Convert more cached return values to immutable types (#16356)Patrick Cloke2023-09-201-2/+2
|
* Filter locked users in the admin API (#16328)Hanadi2023-09-181-1/+5
| | | | Co-authored-by: Hanadi Tamimi <hanadi.tamimi@sdui.de>
* Make cached account data/tags/admin types immutable (#16325)Patrick Cloke2023-09-182-9/+9
|
* Additional validation of receipts (#16327)Patrick Cloke2023-09-182-2/+2
| | | | 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-152-36/+62
| | | | | | 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-141-1/+1
|
* Use StrCollection in additional places. (#16301)Patrick Cloke2023-09-131-2/+2
|
* Add the List-Unsubscribe header for notification emails. (#16274)Patrick Cloke2023-09-111-0/+17
| | | | | | | | 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).
* Avoid temporary storage of sensitive information. (#16272)Patrick Cloke2023-09-081-2/+2
| | | | During the UI auth process, avoid storing sensitive information into the database.
* Reduce CPU overhead of change password endpoint (#16264)Erik Johnston2023-09-081-58/+54
|
* Add `/notifications` endpoint to workers (#16265)Erik Johnston2023-09-072-1/+3
|
* Merge remote-tracking branch 'origin/release-v1.91' into release-v1.92Patrick Cloke2023-09-062-58/+0
|\
| * Revert MSC3861 introspection cache, admin impersonation and account lock ↵Quentin Gliech2023-09-062-58/+0
| | | | | | | | (#16258)
* | Add last_seen_ts to the admin users API (#16218)Mathieu Velten2023-09-041-0/+1
| |
* | Describe which rate limiter was hit in logs (#16135)David Robertson2023-08-303-9/+10
| |
* | Bump ruff from 0.0.277 to 0.0.286 (#16198)dependabot[bot]2023-08-294-11/+21
| | | | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | Pass the device ID around in the presence handler (#16171)Patrick Cloke2023-08-285-4/+11
| | | | | | | | | | | | 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).
* | Validate input to POST /key/v2/query endpoint. (#16183)Patrick Cloke2023-08-251-10/+29
|/ | | To avoid 500 internal server errors with garbage input.
* Add an admin endpoint to allow authorizing server to signal token ↵Shay2023-08-222-0/+58
| | | | revocations (#16125)
* Allow filtering for admins in the list accounts admin API (#16114)Alexander Fechler2023-08-181-0/+3
|
* Add cache to `get_server_keys_json_for_remote` (#16123)Erik Johnston2023-08-181-19/+25
|
* Rename pagination&purge locks and add comments explaining them (#16112)Mathieu Velten2023-08-161-2/+2
|
* Add linearizer on user ID to push rule PUT/DELETE requests (#16052)Nick Mills-Barrett2023-08-111-6/+22
| | | | | See: #16053 Signed off by Nick @ Beeper (@Fizzadar)
* Implements admin API to lock an user (MSC3939) (#15870)Mathieu Velten2023-08-102-2/+23
|
* Support MSC3814: Dehydrated Devices Part 2 (#16010)Shay2023-08-081-15/+1
|
* Fix endpoint improperly declaring support for MSC3814 (#16068)Shay2023-08-071-10/+8
|
* Fix deletion for Dehydrated Devices (#16046)Shay2023-08-041-4/+10
|
* Stabilize support for MSC3970: updated transaction semantics (scope to ↵Patrick Cloke2023-08-041-6/+6
| | | | | | | `device_id`) (#15629) For now this maintains compatible with old Synapses by falling back to using transaction semantics on a per-access token. A future version of Synapse will drop support for this.
* Add ability to wait for locks and add locks to purge history / room deletion ↵Erik Johnston2023-07-311-3/+8
| | | | | (#15791) c.f. #13476
* Support MSC3814: Dehydrated Devices (#15929)Shay2023-07-241-6/+226
| | | | | | 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>
* Support room version 11 (#15912)Patrick Cloke2023-07-181-2/+2
| | | | | 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.
* Stop accepting 'user' parameter for application service registration. (#15928)Patrick Cloke2023-07-131-8/+4
| | | This is unspecced, but has existed for a very long time.
* Add not_user_type param to the list accounts admin API (#15844)Michael Weimann2023-07-041-0/+9
| | | Signed-off-by: Michael Weimann <michaelw@element.io>
* Add login spam checker API (#15838)Erik Johnston2023-06-261-4/+48
|
* Remove experimental MSC2716 implementation to incrementally import history ↵Eric Eastwood2023-06-163-258/+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.
* Remove some unused `server_name` fields (#15723)Sean Quah2023-06-061-1/+0
| | | Signed-off-by: Sean Quah <seanq@matrix.org>
* Stabilize support for MSC3952: Intentional mentions. (#15520)Patrick Cloke2023-06-061-2/+0
|
* `N + 3`: Read from column `full_user_id` rather than `user_id` of tables ↵Shay2023-06-022-2/+2
| | | | `profiles` and `user_filters` (#15649)
* Implement stable support for MSC3882 to allow an existing device/session to ↵Hugh Nimmo-Smith2023-06-014-23/+62
| | | | | | | | generate a login token for use on a new device/session (#15388) Implements stable support for MSC3882; this involves updating Synapse's support to match the MSC / the spec says. Continue to support the unstable version to allow clients to transition.
* Disable incompatible Admin API endpointsQuentin Gliech2023-05-302-8/+21
|
* Make AS tokens work & allow ASes to /registerQuentin Gliech2023-05-301-0/+69
|
* Refactor config to be an experimental featureHugh Nimmo-Smith2023-05-309-20/+19
| | | | Also enforce you can't combine it with incompatible config options
* Disable account related endpoints when using OAuth delegationQuentin Gliech2023-05-306-15/+59
|
* MSC2965: OIDC Provider discovery via well-known documentQuentin Gliech2023-05-301-0/+9
|
* Expose the public keys used for client authentication on an endpointQuentin Gliech2023-05-302-0/+78
|
* Add requesting user id parameter to key claim methods in ↵Shay2023-05-241-4/+4
| | | | `TransportLayerClient` (#15663)
* Consolidate logic to check for deactivated users. (#15634)Patrick Cloke2023-05-231-3/+20
| | | | | | | This moves the deactivated user check to the method which all login types call. Additionally updates the application service tests to be more realistic by removing invalid tests and fixing server names.
* Do not allow deactivated users to login with JWT. (#15624)Patrick Cloke2023-05-191-65/+12
| | | | | To improve the organization of this code it moves the JWT login checks to a separate handler and then fixes the bug (and a deprecation warning).
* Update Mutual Rooms (MSC2666) implementation (#15621)Jonathan de Jong2023-05-182-13/+32
| | | | | | | | To track changes in MSC2666: - The change from `/mutual_rooms/{user_id}` to `/mutual_rooms?user_id={user_id}`. - The addition of `next_batch_token` (and logic). - Unstable flag now being `uk.half-shot.msc2666.query_mutual_rooms`. - The error code when your own user is requested.
* Add a new admin API to create a new device for a user. (#15611)Quentin Gliech2023-05-171-0/+29
| | | | This allows an external service (e.g. the matrix-authentication-service) to create devices for users.
* Add an unstable feature flag for MSC3981 to the /versions endpoint (#15558)Michael Weimann2023-05-151-0/+2
| | | | Signed-off-by: Michael Weimann <michaelw@matrix.org> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Declare support for Matrix 1.6 (#15559)Patrick Cloke2023-05-123-1/+22
| | | | | | | Adds logging for key server requests which include a key ID. This is technically in violation of the 1.6 spec, but is the only way to remain backwards compatibly with earlier versions of Synapse (and possibly other homeservers) which *did* include the key ID.
* Add an unstable feature flag for MSC3391 to the /versions endpoint (#15562)Andrew Morgan2023-05-111-0/+2
|
* Stabilize MSC2659 support for AS ping endpoint. (#15528)Tulir Asokan2023-05-092-7/+5
|
* Add config option to prevent media downloads from listed domains. (#15197)Travis Ralston2023-05-091-0/+9
| | | | | | | This stops media (and thumbnails) from being accessed from the listed domains. It does not delete any already locally cached media, but will prevent accessing it. Note that admin APIs are unaffected by this change.
* Error if attempting to set m.push_rules account data, per MSC4010. (#15555)Patrick Cloke2023-05-092-22/+70
| | | | | m.push_rules, like m.fully_read, is a special account data type that cannot be set using the normal /account_data endpoint. Return an error instead of allowing data that will not be used to be stored.
* Use account data constants in more places. (#15554)Patrick Cloke2023-05-091-1/+2
|
* Clean up and clarify "Create or modify Account" Admin API documentation (#15544)Andrew Morgan2023-05-051-1/+1
|
* Factor out an `is_mine_server_name` method (#15542)Sean Quah2023-05-054-8/+8
| | | | | | | | | | | | Add an `is_mine_server_name` method, similar to `is_mine_id`. Ideally we would use this consistently, instead of sometimes comparing against `hs.hostname` and other times reaching into `hs.config.server.server_name`. Also fix a bug in the tests where `hs.hostname` would sometimes differ from `hs.config.server.server_name`. Signed-off-by: Sean Quah <seanq@matrix.org>
* Move ThirdPartyEventRules into module_api/callbacks (#15535)Andrew Morgan2023-05-041-1/+1
|
* Remove references to supporting per-user flag for msc2654 (#15522)Shay2023-05-021-1/+0
|
* Initial implementation of MSC3981: recursive relations API (#15315)Patrick Cloke2023-05-021-1/+9
| | | | | | | | | | | Adds an optional keyword argument to the /relations API which will recurse a limited number of event relationships. This will cause the API to return not just the events related to the parent event, but also events related to those related to the parent event, etc. This is disabled by default behind an experimental configuration flag and is currently implemented using prefixed parameters.
* Add an admin API endpoint to support per-user feature flags (#15344)Shay2023-04-282-0/+121
|
* Add support for claiming multiple OTKs at once. (#15468)Patrick Cloke2023-04-271-5/+37
| | | | | | | MSC3983 provides a way to request multiple OTKs at once from appservices, this extends this concept to the Client-Server API. Note that this will likely be spit out into a separate MSC, but is currently part of MSC3983.
* Add column `full_user_id` to tables `profiles` and `user_filters`. (#15458)Shay2023-04-261-1/+1
|
* Add admin endpoint to query room sizes (#15482)Erik Johnston2023-04-262-1/+30
|
* Add unstable /keys/claim endpoint which always returns fallback keys. (#15462)Patrick Cloke2023-04-251-1/+30
| | | | | | | | | | | | | It can be useful to always return the fallback key when attempting to claim keys. This adds an unstable endpoint for `/keys/claim` which always returns fallback keys in addition to one-time-keys. The fallback key(s) are not marked as "used" unless there are no corresponding OTKs. This is currently defined in MSC3983 (although likely to be split out to a separate MSC). The endpoint shape may change or be requested differently (i.e. a keyword parameter on the current endpoint), but the core logic should be reasonable.
* Experimental support for MSC3970: per-device transaction IDs (#15318)Quentin Gliech2023-04-251-0/+13
|
* Modify StoreKeyFetcher to read from server_keys_json. (#15417)Patrick Cloke2023-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change: * `PerspectivesKeyFetcher` and `ServerKeyFetcher` write to `server_keys_json`. * `PerspectivesKeyFetcher` also writes to `server_signature_keys`. * `StoreKeyFetcher` reads from `server_signature_keys`. After this change: * `PerspectivesKeyFetcher` and `ServerKeyFetcher` write to `server_keys_json`. * `PerspectivesKeyFetcher` also writes to `server_signature_keys`. * `StoreKeyFetcher` reads from `server_keys_json`. This results in `StoreKeyFetcher` now using the results from `ServerKeyFetcher` in addition to those from `PerspectivesKeyFetcher`, i.e. keys which are directly fetched from a server will now be pulled from the database instead of refetched. An additional minor change is included to avoid creating a `PerspectivesKeyFetcher` (and checking it) if no `trusted_key_servers` are configured. The overall impact of this should be better usage of cached results: * If a server has no trusted key servers configured then it should reduce how often keys are fetched. * if a server's trusted key server does not have a requested server's keys cached then it should reduce how often keys are directly fetched.
* Load `/capabilities` endpoint on workers (#15436)Dirk Klimpel2023-04-142-1/+2
|
* Load `/directory/room/{roomAlias}` endpoint on workers (#15333)Dirk Klimpel2023-04-142-4/+5
| | | | | | | | | * Enable `directory` * move to worker store * newsfile * disable `ClientDirectoryListServer` and `ClientAppserviceDirectoryListServer` for workers
* Implement MSC2174: move redacts to a content property. (#15395)Patrick Cloke2023-04-131-9/+26
| | | | | | | This moves `redacts` from being a top-level property to a `content` property in a new room version. MSC2176 (which was previously implemented) states to not `redact` this property.
* Only load the SSO redirect servlet if SSO is enabled. (#15421)Dirk Klimpel2023-04-131-1/+6
|
* Disable loading `RefreshTokenServlet` on workers (#15428)Dirk Klimpel2023-04-131-1/+4
|
* Load `/password_policy` endpoint on workers. (#15331)Dirk Klimpel2023-03-272-2/+2
|
* Make cleaning up pushers depend on the device_id instead of the token_id ↵Quentin Gliech2023-03-242-2/+0
| | | | | | | | | | | | | | (#15280) This makes it so that we rely on the `device_id` to delete pushers on logout, instead of relying on the `access_token_id`. This ensures we're not removing pushers on token refresh, and prepares for a world without access token IDs (also known as the OIDC). This actually runs the `set_device_id_for_pushers` background update, which was forgotten in #13831. Note that for backwards compatibility it still deletes pushers based on the `access_token` until the background update finishes.
* Add a primitive helper script for listing worker endpoints. (#15243)reivilibre2023-03-2327-12/+92
| | | | Co-authored-by: Patrick Cloke <patrickc@matrix.org>
* Make `POST /_matrix/client/v3/rooms/{roomId}/report/{eventId}` endpoint ↵Andrew Morgan2023-03-211-5/+11
| | | | return 404 if event exists, but the user lacks access (#15300)
* Separate HTTP preview code and URL previewer. (#15269)Patrick Cloke2023-03-201-792/+4
| | | Separates REST layer code from the actual URL previewing.
* Add /versions flag for MSC3952. (#15293)Patrick Cloke2023-03-201-0/+2
|
* Load `/register/available` endpoint on workers (#15268)Jason Little2023-03-171-1/+1
|
* Implement MSC2659: application service ping endpoint (#15249)Tulir Asokan2023-03-163-0/+119
| | | Signed-off-by: Tulir Asokan <tulir@maunium.net>
* Move Account Validity callbacks to a dedicated file (#15237)Andrew Morgan2023-03-161-9/+8
|
* Pass the Requester down to the HttpTransactionCache. (#15200)Quentin Gliech2023-03-074-116/+172
|
* Pass the requester during event serialization. (#15174)Quentin Gliech2023-03-064-21/+35
| | | | This allows Synapse to properly include the transaction ID in the unsigned data of events.
* Stop applying edits to event contents (MSC3925). (#15193)Patrick Cloke2023-03-061-1/+1
| | | | | | | | | | | Enables MSC3925 support by default, which: * Includes the full edit event in the bundled aggregations of an edited event. * Stops modifying the original event's content to return the new content from the edit event. This is a backwards-incompatible change that is considered to be "correct" by the spec.
* Remove unspecced and buggy `PUT` method on the unstable ↵Quentin Gliech2023-03-031-15/+1
| | | | `/rooms/<room_id>/batch_send` endpoint. (#15199)
* Add support for knocking to workers. (#15133)Dirk Klimpel2023-03-023-3/+2
|
* Remove the unspecced and bugged PUT /knock/{roomIdOrAlias} endpoint (#15189)Quentin Gliech2023-03-021-15/+1
|
* Fix conflicting URLs for dehydrated devices. (#15180)Patrick Cloke2023-03-021-1/+1
|
* Implementation of MSC3967: Don't require UIA for initial upload of cross ↵Hugh Nimmo-Smith2023-03-021-9/+23
| | | | signing keys (#15077)
* Fix a long-standing bug where an initial sync would not respond to changes ↵reivilibre2023-02-281-2/+23
| | | | to the list of ignored users if there was an initial sync cached. (#15163)
* Allow use of the `/filter` Client-Server APIs on workers. (#15134)reivilibre2023-02-281-2/+1
|
* Admin API endpoint to delete a reported event (#15116)Dirk Klimpel2023-02-281-8/+33
| | | | | | | | | | | | | | | | | | | | | * Admin api to delete event report * lint + tests * newsfile * Apply suggestions from code review Co-authored-by: David Robertson <david.m.robertson1@gmail.com> * revert changes - move to WorkerStore * update unit test * Note that timestamp is in millseconds --------- Co-authored-by: David Robertson <david.m.robertson1@gmail.com>
* Add module API callbacks for adding and deleting local 3PID associations (#15044Andrew Morgan2023-02-272-3/+17
|
* Refactor media modules. (#15146)Patrick Cloke2023-02-2714-3520/+117
| | | | | | | * Removes the `v1` directory from `test.rest.media.v1`. * Moves the non-REST code from `synapse.rest.media.v1` to `synapse.media`. * Flatten the `v1` directory from `synapse.rest.media`, but leave compatiblity with 3rd party media repositories and spam checkers.
* Do not fail completely if oEmbed autodiscovery fails. (#15092)Patrick Cloke2023-02-231-10/+23
| | | | | | Previously if an autodiscovered oEmbed request failed (e.g. the oEmbed endpoint is down or does not exist) then the entire URL preview would fail. Instead we now return everything we can, even if this additional request fails.
* Stop parsing the unspecced type parameter on thumbnail requests. (#15137)Patrick Cloke2023-02-231-1/+2
| | | | | | | | Ideally we would replace this with parsing of the Accept header or something else, but for now just make Synapse spec compliant by ignoring the unspecced parameter. It does not seem that this is ever sent by a client, and even if it is there's a reasonable fallback.
* Bump black from 22.12.0 to 23.1.0 (#15103)dependabot[bot]2023-02-227-17/+17
|
* Remove unused `room_alias` field from `/createRoom` response (#15093)David Robertson2023-02-221-2/+2
| | | | | | | | | | | | | | * Change `create_room` return type * Don't return room alias from /createRoom * Update other callsites * Fix up mypy complaints It looks like new_room_user_id is None iff new_room_id is None. It's a shame we haven't expressed this in a way that mypy can understand. * Changelog
* Use mypy 1.0 (#15052)David Robertson2023-02-161-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update mypy and mypy-zope * Remove unused ignores These used to suppress ``` synapse/storage/engines/__init__.py:28: error: "__new__" must return a class instance (got "NoReturn") [misc] ``` and ``` synapse/http/matrixfederationclient.py:1270: error: "BaseException" has no attribute "reasons" [attr-defined] ``` (note that we check `hasattr(e, "reasons")` above) * Avoid empty body warnings, sometimes by marking methods as abstract E.g. ``` tests/handlers/test_register.py:58: error: Missing return statement [empty-body] tests/handlers/test_register.py:108: error: Missing return statement [empty-body] ``` * Suppress false positive about `JaegerConfig` Complaint was ``` synapse/logging/opentracing.py:450: error: Function "Type[Config]" could always be true in boolean context [truthy-function] ``` * Fix not calling `is_state()` Oops! ``` tests/rest/client/test_third_party_rules.py:428: error: Function "Callable[[], bool]" could always be true in boolean context [truthy-function] ``` * Suppress false positives from ParamSpecs ```` synapse/logging/opentracing.py:971: error: Argument 2 to "_custom_sync_async_decorator" has incompatible type "Callable[[Arg(Callable[P, R], 'func'), **P], _GeneratorContextManager[None]]"; expected "Callable[[Callable[P, R], **P], _GeneratorContextManager[None]]" [arg-type] synapse/logging/opentracing.py:1017: error: Argument 2 to "_custom_sync_async_decorator" has incompatible type "Callable[[Arg(Callable[P, R], 'func'), **P], _GeneratorContextManager[None]]"; expected "Callable[[Callable[P, R], **P], _GeneratorContextManager[None]]" [arg-type] ```` * Drive-by improvement to `wrapping_logic` annotation * Workaround false "unreachable" positives See https://github.com/Shoobx/mypy-zope/issues/91 ``` tests/http/test_proxyagent.py:626: error: Statement is unreachable [unreachable] tests/http/test_proxyagent.py:762: error: Statement is unreachable [unreachable] tests/http/test_proxyagent.py:826: error: Statement is unreachable [unreachable] tests/http/test_proxyagent.py:838: error: Statement is unreachable [unreachable] tests/http/test_proxyagent.py:845: error: Statement is unreachable [unreachable] tests/http/federation/test_matrix_federation_agent.py:151: error: Statement is unreachable [unreachable] tests/http/federation/test_matrix_federation_agent.py:452: error: Statement is unreachable [unreachable] tests/logging/test_remote_handler.py:60: error: Statement is unreachable [unreachable] tests/logging/test_remote_handler.py:93: error: Statement is unreachable [unreachable] tests/logging/test_remote_handler.py:127: error: Statement is unreachable [unreachable] tests/logging/test_remote_handler.py:152: error: Statement is unreachable [unreachable] ``` * Changelog * Tweak DBAPI2 Protocol to be accepted by mypy 1.0 Some extra context in: - https://github.com/matrix-org/python-canonicaljson/pull/57 - https://github.com/python/mypy/issues/6002 - https://mypy.readthedocs.io/en/latest/common_issues.html#covariant-subtyping-of-mutable-protocol-members-is-rejected * Pull in updated canonicaljson lib so the protocol check just works * Improve comments in opentracing I tried to workaround the ignores but found it too much trouble. I think the corresponding issue is https://github.com/python/mypy/issues/12909. The mypy repo has a PR claiming to fix this (https://github.com/python/mypy/pull/14677) which might mean this gets resolved soon? * Better annotation for INTERACTIVE_AUTH_CHECKERS * Drive-by AUTH_TYPE annotation, to remove an ignore
* Prevent clients from reporting nonexistent events. (#13779)reivilibre2023-02-141-1/+10
|
* Refactor arguments of `try_unbind_threepid(_with_id_server)` from dict to ↵Andrew Morgan2023-02-131-6/+1
| | | | separate args (#15053)
* Apply logging from hotfixes branch to develop (#15054)David Robertson2023-02-131-0/+3
| | | | | | | | | * Apply logging from hotfixes branch to develop Part of #4826. Originally added in #11882. * Changelog
* Avoid fetching unused account data in sync. (#14973)Patrick Cloke2023-02-101-1/+2
| | | | | | | The per-room account data is no longer unconditionally fetched, even if all rooms will be filtered out. Global account data will not be fetched if it will all be filtered out.
* Respond correctly to unknown methods on known endpoints (#14605)Patrick Cloke2023-02-093-22/+48
| | | | Respond with a 405 error if a request is received on a known endpoint, but to an unknown method, per MSC3743.
* Typecheck tests.rest.media.v1.test_media_storage (#15008)David Robertson2023-02-071-4/+3
| | | | | | | | | | | * Fix MediaStorage type hint * Typecheck tests.rest.media.v1.test_media_storage * Changelog * Remove assert and make the comment succinct * Fix syntax for olddeps
* Add helper to parse an enum from query args & use it. (#14956)Patrick Cloke2023-02-018-43/+37
| | | | | | | | The `parse_enum` helper pulls an enum value from the query string (by delegating down to the parse_string helper with values generated from the enum). This is used to pull out "f" and "b" in most places and then we thread the resulting Direction enum throughout more code.
* Prefer `type(x) is int` to `isinstance(x, int)` (#14945)David Robertson2023-01-316-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Perfer `type(x) is int` to `isinstance(x, int)` This covered all additional instances I could see where `x` was user-controlled. The remaining cases are ``` $ rg -s 'isinstance.*[^_]int' tests/replication/_base.py 576: if isinstance(obj, int): synapse/util/caches/stream_change_cache.py 136: assert isinstance(stream_pos, int) 214: assert isinstance(stream_pos, int) 246: assert isinstance(stream_pos, int) 267: assert isinstance(stream_pos, int) synapse/replication/tcp/external_cache.py 133: if isinstance(result, int): synapse/metrics/__init__.py 100: if isinstance(calls, (int, float)): synapse/handlers/appservice.py 262: assert isinstance(new_token, int) synapse/config/_util.py 62: if isinstance(p, int): ``` which cover metrics, logic related to `jsonschema`, and replication and data streams. AFAICS these are all internal to Synapse * Changelog
* Add missing type hints in tests (#14879)Patrick Cloke2023-01-261-1/+2
| | | | * FIx-up type hints in tests.logging. * Add missing type hints to test_transactions.
* Use StrCollection in place of Collection[str] in (most) handlers code. (#14922)Patrick Cloke2023-01-261-2/+2
| | | | Due to the increased safety of StrCollection over Collection[str] and Sequence[str].
* Remove unnecessary reactor reference from `_PerHostRatelimiter` (#14842)Sean Quah2023-01-161-1/+0
| | | | | Fix up #14812 to avoid introducing a reference to the reactor. Signed-off-by: Sean Quah <seanq@matrix.org>
* Fix stack overflow in `_PerHostRatelimiter` due to synchronous requests (#14812)Sean Quah2023-01-131-0/+1
| | | | | | | | | | | | | | | | | | When there are many synchronous requests waiting on a `_PerHostRatelimiter`, each request will be started recursively just after the previous request has completed. Under the right conditions, this leads to stack exhaustion. A common way for requests to become synchronous is when the remote client disconnects early, because the homeserver is overloaded and slow to respond. Avoid stack exhaustion under these conditions by deferring subsequent requests until the next reactor tick. Fixes #14480. Signed-off-by: Sean Quah <seanq@matrix.org>
* Unescape HTML entities in oEmbed titles. (#14781)Jeyachandran Rathnam2023-01-091-6/+9
| | | | | | | It doesn't seem valid that HTML entities should appear in the title field of oEmbed responses, but a popular WordPress plug-in seems to do it. There should not be harm in unescaping these.
* Disable sending confirmation email when 3pid is disabled #14682 (#14725)Jeyachandran Rathnam2023-01-091-0/+5
| | | | | | | | | | | * Fixes #12277 :Disable sending confirmation email when 3pid is disabled * Fix test_add_email_if_disabled test case to reflect changes to enable_3pid_changes flag * Add changelog file * Rename newsfragment. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Add experimental support for MSC3391: deleting account data (#14714)Andrew Morgan2023-01-011-0/+115
|
* Move `StateFilter` to `synapse.types` (#14668)David Robertson2022-12-122-2/+2
| | | | | * Move `StateFilter` to `synapse.types` * Changelog
* Respond with proper error responses on unknown paths. (#14621)Patrick Cloke2022-12-081-2/+2
| | | | Returns a proper 404 with an errcode of M_RECOGNIZED for unknown endpoints per MSC3743.
* Reject receipt requests with invalid room or event IDs. (#14632)Nick Mills-Barrett2022-12-071-1/+4
| | | | If the room or event IDs are empty or of an invalid form they should be rejected.
* Fix a long-standing bug where the user directory would return 1 more row ↵reivilibre2022-12-071-2/+2
| | | | than requested. (#14631)
* Improve logging and opentracing for to-device message handling (#14598)Richard van der Hoff2022-12-061-1/+0
| | | | | | | A batch of changes intended to make it easier to trace to-device messages through the system. The intention here is that a client can set a property org.matrix.msgid in any to-device message it sends. That ID is then included in any tracing or logging related to the message. (Suggestions as to where this field should be documented welcome. I'm not enthusiastic about speccing it - it's very much an optional extra to help with debugging.) I've also generally improved the data we send to opentracing for these messages.
* Suppress empty body warnings in room servelets (#14600)David Robertson2022-12-051-12/+2
| | | | | | | | | * Suppress empty body warnings in room servelets We've already decided to allow empty bodies for backwards compat. The change here stops us from emitting a misleading warning; see also https://github.com/matrix-org/synapse/issues/14478#issuecomment-1319157105 * Changelog
* Use ClientRestResource on both the main process and workers. (#14528)Patrick Cloke2022-12-026-47/+68
| | | | | | | Add logic to ClientRestResource to decide whether to mount servlets or not based on whether the current process is a worker. This is clearer to see what a worker runs than the completely separate / copy & pasted list of servlets being mounted for workers.
* Advertise support for Matrix v1.5. (#14576)Patrick Cloke2022-11-291-0/+1
| | | | All features of Matrix v1.5 were already supported: this was mostly a maintenance release.
* Move MSC3030 `/timestamp_to_event` endpoint to stable v1 location (#14471)Eric Eastwood2022-11-282-9/+3
| | | | | | | | Fix https://github.com/matrix-org/synapse/issues/14390 - Client API: `/_matrix/client/unstable/org.matrix.msc3030/rooms/<roomID>/timestamp_to_event?ts=<timestamp>&dir=<direction>` -> `/_matrix/client/v1/rooms/<roomID>/timestamp_to_event?ts=<timestamp>&dir=<direction>` - Federation API: `/_matrix/federation/unstable/org.matrix.msc3030/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction>` -> `/_matrix/federation/v1/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction>` Complement test changes: https://github.com/matrix-org/complement/pull/559
* Add a type hint for `get_device_handler()` and fix incorrect types. (#14055)Patrick Cloke2022-11-224-20/+45
| | | | | This was the last untyped handler from the HomeServer object. Since it was being treated as Any (and thus unchecked) it was being used incorrectly in a few places.
* Remove need for `worker_main_http_uri` setting to use /keys/upload. (#14400)realtyem2022-11-161-18/+50
|
* Remove redundant types from comments. (#14412)Patrick Cloke2022-11-164-7/+8
| | | | | | | Remove type hints from comments which have been added as Python type hints. This helps avoid drift between comments and reality, as well as removing redundant information. Also adds some missing type hints which were simple to fill in.
* Add an Admin API endpoint for looking up users based on 3PID (#14405)Ashish Kumar2022-11-112-0/+27
|
* Fix /refresh endpoint version (#14364)Tulir Asokan2022-11-041-1/+1
|
* Implement MSC3912: Relation-based redactions (#14260)Brendan Abolivier2022-11-032-14/+45
| | | Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Fix dehydrated device REST checks (#14336)David Robertson2022-10-311-3/+2
|
* Support OIDC backchannel logouts (#11414)Quentin Gliech2022-10-312-0/+39
| | | | | | | If configured an OIDC IdP can log a user's session out of Synapse when they log out of the identity provider. The IdP sends a request directly to Synapse (and must be configured with an endpoint) when a user logs out.
* Reject history insertion during partial joins (#14291)David Robertson2022-10-271-0/+7
|
* Save login tokens in database (#13844)Quentin Gliech2022-10-262-5/+3
| | | | | | | | | | | * Save login tokens in database Signed-off-by: Quentin Gliech <quenting@element.io> * Add upgrade notes * Track login token reuse in a Prometheus metric Signed-off-by: Quentin Gliech <quenting@element.io>
* Implementation for MSC3664: Pushrules for relations (#11804)DeepBlueV7.X2022-10-251-0/+5
|
* Return NOT_JSON if decode fails and defer set_timeline_upper_limit ca… ↵Ryan Miguel2022-10-241-4/+4
| | | | | | | (#14262) * Return NOT_JSON if decode fails and defer set_timeline_upper_limit call until after check_valid_filter. Fixes #13661. Signed-off-by: Ryan Miguel <miguel.ryanj@gmail.com>. * Reword changelog
* Use servlets for /key/ endpoints. (#14229)Patrick Cloke2022-10-203-50/+64
| | | | | To fix the response for unknown endpoints under that prefix. See MSC3743.
* Implementation of HTTP 307 response for MSC3886 POST endpoint (#14018)Hugh Nimmo-Smith2022-10-186-4/+85
| | | | Co-authored-by: reivilibre <olivier@librepush.net> Co-authored-by: Andrew Morgan <andrewm@element.io>
* Support filtering the /messages API by relation type (MSC3874). (#14148)Patrick Cloke2022-10-171-0/+2
| | | Gated behind an experimental configuration flag.
* Use Pydantic when PUTting room aliases (#14179)David Robertson2022-10-171-23/+35
|
* Accept threaded receipts for events related to the root event. (#14174)Patrick Cloke2022-10-141-2/+42
| | | | | | | | | The root node of a thread (and events related to it) are considered "part of a thread" when validating receipts. This allows clients which show the root node in both the main timeline and the threaded timeline to easily send receipts in either. Note that threaded notifications are not created for these events, these events created notifications on the main timeline.
* Advertise support for Matrix 1.4. (#14184)Patrick Cloke2022-10-141-0/+1
| | | | All features / changes in Matrix 1.4 are now supported in Synapse.
* Do not allow a None-limit on PaginationConfig. (#14146)Patrick Cloke2022-10-143-3/+9
| | | | | | | The callers either set a default limit or manually handle a None-limit later on (by setting a default value). Update the callers to always instantiate PaginationConfig with a default limit and then assume the limit is non-None.
* Stabilize the threads API. (#14175)Patrick Cloke2022-10-141-7/+2
| | | | | | | Stabilize the threads API (MSC3856) by supporting (only) the v1 path for the endpoint. This also marks the API as safe for workers since it is a read-only API.
* Add an API for listing threads in a room. (#13394)Patrick Cloke2022-10-131-1/+49
| | | | | | | | | Implement the /threads endpoint from MSC3856. This is currently unstable and behind an experimental configuration flag. It includes a background update to backfill data, results from the /threads endpoint will be partial until that finishes.
* Remove support for the unstable dir flag on relations. (#14106)Patrick Cloke2022-10-071-35/+10
| | | | | | From MSC3715, this was unused by clients (and there was no way for clients to know it was supported). Matrix 1.4 defines the stable field.
* Be more lenient in the oEmbed response parsing. (#14089)Patrick Cloke2022-10-071-50/+57
| | | | | | Attempt to parse any valid information from an oEmbed response (instead of bailing at the first unexpected data). This should allow for more partial oEmbed data to be returned, resulting in better / more URL previews, even if those URL previews are only partial.
* Use stable identifiers for MSC3771 & MSC3773. (#14050)Patrick Cloke2022-10-073-29/+30
| | | | | These are both part of Matrix 1.4 which has now been released. For now, support both the unstable and stable identifiers.
* Use Pydantic to validate /devices endpoints (#14054)David Robertson2022-10-071-46/+52
|
* Recursively fetch the thread for receipts & notifications. (#13824)Patrick Cloke2022-10-041-2/+20
| | | | | | Consider an event to be part of a thread if you can follow a chain of relations up to a thread root. Part of MSC3773 & MSC3771.
* Advertise supporting version 1.3 of the Matrix spec. (#14032)Patrick Cloke2022-10-041-0/+1
| | | Now that all features / changes in 1.3 are supported in Synapse.
* Track notification counts per thread (implement MSC3773). (#13776)Patrick Cloke2022-10-042-1/+6
| | | | | | | | When retrieving counts of notifications segment the results based on the thread ID, but choose whether to return them as individual threads or as a single summed field by letting the client opt-in via a sync flag. The summarization code is also updated to be per thread, instead of per room.
* Do not return unspecced original_event field when using the stable ↵Patrick Cloke2022-10-031-0/+6
| | | | | | | | | | /relations endpoint. (#14025) Keep the old behavior (of including the original_event field) for any requests to the /unstable version of the endpoint, but do not include the field when the /v1 version is used. This should avoid new clients from depending on this field, but will not help with current dependencies.
* Add query parameter `ts` to allow appservices set the `origin_server_ts` for ↵lukasdenk2022-10-031-13/+21
| | | | | | | state events. (#11866) MSC3316 declares that both /rooms/{roomId}/send and /rooms/{roomId}/state should accept a ts parameter for appservices. This change expands support to /state and adds tests.
* Allow admins to require a manual approval process before new accounts can be ↵Brendan Abolivier2022-09-293-6/+96
| | | | used (using MSC3866) (#13556)
* Expose MSC3882 only be under an unstable endpoint. (#13868)Hugh Nimmo-Smith2022-09-291-1/+3
|
* Support the stable dir parameter for /relations. (#13920)Patrick Cloke2022-09-271-9/+15
| | | | | | | Since MSC3715 has passed FCP, the stable parameter can be used. This currently falls back to the unstable parameter if the stable parameter is not provided (and MSC3715 support is enabled in the configuration).
* Accept & store thread IDs for receipts (implement MSC3771). (#13782)Patrick Cloke2022-09-233-1/+17
| | | | Updates the `/receipts` endpoint and receipt EDU handler to parse a `thread_id` from the body and insert it in the database.
* Last batch of Pydantic for synapse/rest/client/account.py (#13832)David Robertson2022-09-211-6/+13
| | | | | | | * Validation for `/add_threepid/msisdn/submit_token` * Don't validate deprecated endpoint * Changelog
* Add version flag for MSC3881 (#13860)Brendan Abolivier2022-09-211-0/+2
|
* Track device IDs for pushers (#13831)Brendan Abolivier2022-09-211-0/+3
| | | Second half of the MSC3881 implementation
* Implementation of MSC3882 login token request (#13722)Hugh Nimmo-Smith2022-09-213-0/+98
|
* Support enabling/disabling pushers (from MSC3881) (#13799)Brendan Abolivier2022-09-212-5/+17
| | | Partial implementation of MSC3881
* Add an admin API endpoint to find a user based on its external ID in an auth ↵Quentin Gliech2022-09-162-0/+29
| | | | provider. (#13810)
* A third batch of Pydantic validation for rest/client/account.py (#13736)David Robertson2022-09-152-42/+51
|
* Add a `MXCUri` class to make working with mxc uri's easier. (#13162)Andrew Morgan2022-09-152-4/+8
|
* A second batch of Pydantic models for rest/client/account.py (#13687)David Robertson2022-09-072-32/+46
|
* Cancel the processing of key query requests when they time out. (#13680)reivilibre2022-09-071-2/+4
|
* Add Admin API to Fetch Messages Within a Particular Window (#13672)Connor Davis2022-09-072-0/+108
| | | This adds two new admin APIs that allow us to fetch messages from a room within a particular time.
* Return keys for unwhitelisted servers from `/_matrix/key/v2/query` (#13683)Richard van der Hoff2022-09-011-20/+21
|
* Remove support for unstable private read receipts (#13653)Šimon Brandner2022-09-014-6/+0
| | | Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Drop support for calling `/_matrix/client/v3/rooms/{roomId}/invite` without ↵Jacek Kuśnierz2022-08-312-9/+12
| | | | | | | an `id_access_token` (#13241) Fixes #13206 Signed-off-by: Jacek Kusnierz jacek.kusnierz@tum.de
* Generalise the `@cancellable` annotation so it can be used on functions ↵reivilibre2022-08-311-1/+2
| | | | other than just servlet methods. (#13662)
* Fix bug where we wedge media plugins if clients disconnect early (#13660)Erik Johnston2022-08-301-19/+21
| | | | | | | | We incorrectly didn't use the returned `Responder` if the client had disconnected, which meant that the resource used by the Responder wasn't correctly released. In particular, this exhausted the thread pools so that *all* requests timed out.
* Do not wait for background updates to complete do expire URL cache. (#13657)Patrick Cloke2022-08-301-4/+0
| | | | | | | | | | | | | | Media downloaded as part of a URL preview is normally deleted after two days. However, while a background database migration is running, the process is stopped. A long-running database migration can therefore cause the media store to fill up with old preview files. This logic was added in #2697 to make sure that we didn't try to run the expiry without an index on `local_media_repository.created_ts`; the original logic that needs that index was added in #2478 (in `get_url_cache_media_before`, as amended by 93247a424a5068b088567fa98b6990e47608b7cb), and is still present. Given that the background update was added before Synapse v1.0.0, just drop this check and assume the index exists.
* Drop support for delegating email validation, round 2 (#13596)David Robertson2022-08-233-118/+57
|
* Fix Prometheus metrics being negative (mixed up start/end) (#13584)Eric Eastwood2022-08-231-1/+5
| | | | | | | Fix: - https://github.com/matrix-org/synapse/pull/13535#discussion_r949582508 - https://github.com/matrix-org/synapse/pull/13533#discussion_r949577244
* `synapse.api.auth.Auth` cleanup: make permission-related methods use ↵Quentin Gliech2022-08-227-35/+28
| | | | | | | | | `Requester` instead of the `UserID` (#13024) Part of #13019 This changes all the permission-related methods to rely on the Requester instead of the UserID. This is a first step towards enabling scoped access tokens at some point, since I expect the Requester to have scope-related informations in it. It also changes methods which figure out the user/device/appservice out of the access token to return a Requester instead of something else. This avoids having store-related objects in the methods signatures.
* Remove redundant opentracing spans for `/sendToDevice` and `/keys/upload` ↵Andrew Morgan2022-08-222-4/+2
| | | | (#13574)
* Implement MSC3852: Expose `last_seen_user_agent` to users for their own ↵Andrew Morgan2022-08-191-0/+27
| | | | devices; also expose to Admin API (#13549)
* Fix validation problem that occurs when a user tries to deactivate their ↵reivilibre2022-08-191-3/+3
| | | | account or change their password. (#13563)
* Add metrics to track `/messages` response time by room size (#13545)Eric Eastwood2022-08-181-2/+53
| | | | | Follow-up to https://github.com/matrix-org/synapse/pull/13533 Part of https://github.com/matrix-org/synapse/issues/13356
* Add forgotten status to Room Details API (#13503)Dirk Klimpel2022-08-171-0/+1
|
* Add specific metric to time long-running `/messages` requests (#13533)Eric Eastwood2022-08-171-0/+32
|
* Use Pydantic to systematically validate a first batch of endpoints in ↵David Robertson2022-08-153-85/+155
| | | | `synapse.rest.client.account`. (#13188)
* Support stable identifiers for MSC2285: private read receipts. (#13273)Šimon Brandner2022-08-054-7/+19
| | | | | This adds support for the stable identifiers of MSC2285 while continuing to support the unstable identifiers behind the configuration flag. These will be removed in a future version.
* Rename `RateLimitConfig` to `RatelimitSettings` (#13442)Dirk Klimpel2022-08-031-2/+2
|
* Merge tag 'v1.64.0rc2' into developRichard van der Hoff2022-07-293-56/+117
|\ | | | | | | | | | | | | Synapse 1.64.0rc2 (2022-07-29) ============================== This RC reintroduces support for `account_threepid_delegates.email`, which was removed in 1.64.0rc1. It remains deprecated and will be removed altogether in a future release. ([\#13406](https://github.com/matrix-org/synapse/issues/13406))
| * Revert "Drop support for delegating email validation (#13192)" (#13406)3nprob2022-07-293-56/+117
| | | | | | | | | | Reverts commit fa71bb18b527d1a3e2629b48640ea67fff2f8c59, and tweaks documentation. Signed-off-by: 3nprob <git@3n.anonaddy.com>
* | Use stable prefixes for MSC3827: filtering of `/publicRooms` by room type ↵Šimon Brandner2022-07-271-2/+2
|/ | | | | | (#13370) Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Add missing types to opentracing. (#13345)Patrick Cloke2022-07-211-1/+3
| | | After this change `synapse.logging` is fully typed.
* Add type annotations to `trace` decorator. (#13328)Patrick Cloke2022-07-194-15/+18
| | | | Functions that are decorated with `trace` are now properly typed and the type hints for them are fixed.
* Provide more info why we don't have any thumbnails to serve (#13038)Eric Eastwood2022-07-151-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix https://github.com/matrix-org/synapse/issues/13016 ## New error code and status ### Before Previously, we returned a `404` for `/thumbnail` which isn't even in the spec. ```json { "errcode": "M_NOT_FOUND", "error": "Not found [b'hs1', b'tefQeZhmVxoiBfuFQUKRzJxc']" } ``` ### After What does the spec say? > 400: The request does not make sense to the server, or the server cannot thumbnail the content. For example, the client requested non-integer dimensions or asked for negatively-sized images. > > *-- https://spec.matrix.org/v1.1/client-server-api/#get_matrixmediav3thumbnailservernamemediaid* Now with this PR, we respond with a `400` when we don't have thumbnails to serve and we explain why we might not have any thumbnails. ```json { "errcode": "M_UNKNOWN", "error": "Cannot find any thumbnails for the requested media ([b'example.com', b'12345']). This might mean the media is not a supported_media_format=(image/jpeg, image/jpg, image/webp, image/gif, image/png) or that thumbnailing failed for some other reason. (Dynamic thumbnails are disabled on this server.)", } ``` > Cannot find any thumbnails for the requested media ([b'example.com', b'12345']). This might mean the media is not a supported_media_format=(image/jpeg, image/jpg, image/webp, image/gif, image/png) or that thumbnailing failed for some other reason. (Dynamic thumbnails are disabled on this server.) --- We still respond with a 404 in many other places. But we can iterate on those later and maybe keep some in some specific places after spec updates/clarification: https://github.com/matrix-org/matrix-spec/issues/1122 We can also iterate on the bugs where Synapse doesn't thumbnail when it should in other issues/PRs.
* Reduce duplicate code in receipts servlets. (#13198)Patrick Cloke2022-07-132-44/+32
|
* Fix "add user" admin api error when request contains a "msisdn" threepid ↵Thomas Weston2022-07-131-0/+1
| | | | | | (#13263) Co-authored-by: Thomas Weston <thomas.weston@clearspancloud.com> Co-authored-by: David Robertson <david.m.robertson1@gmail.com>
* Inline URL preview documentation. (#13261)Patrick Cloke2022-07-121-4/+58
| | | Inline URL preview documentation near the implementation.
* Drop support for calling `/_matrix/client/v3/account/3pid/bind` without an ↵Jacek Kuśnierz2022-07-121-2/+4
| | | | | | | `id_access_token` (#13239) Fixes #13201 Signed-off-by: Jacek Kusnierz jacek.kusnierz@tum.de
* Drop support for delegating email validation (#13192)Richard van der Hoff2022-07-123-118/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Drop support for delegating email validation Delegating email validation to an IS is insecure (since it allows the owner of the IS to do a password reset on your HS), and has long been deprecated. It will now cause a config error at startup. * Update unit test which checks for email verification Give it an `email` config instead of a threepid delegate * Remove unused method `requestEmailToken` * Simplify config handling for email verification Rather than an enum and a boolean, all we need here is a single bool, which says whether we are or are not doing email verification. * update docs * changelog * upgrade.md: fix typo * update version number this will be in 1.64, not 1.63 * update version number this one too
* Make the AS login method call `Auth.get_user_by_req` for checking the AS ↵Quentin Gliech2022-07-121-2/+8
| | | | | | | | token. (#13094) This gets rid of another usage of get_appservice_by_req, with all the benefits, including correctly tracking the appservice IP and setting the tracing attributes correctly. Signed-off-by: Quentin Gliech <quenting@element.io>
* Uniformize spam-checker API, part 5: expand other spam-checker callbacks to ↵David Teller2022-07-111-1/+3
| | | | | | return `Tuple[Codes, dict]` (#13044) Signed-off-by: David Teller <davidt@element.io> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Extra validation for rest/client/account_data (#13148)David Robertson2022-07-011-2/+17
| | | | | | | * Extra validation for rest/client/account_data This is a fairly simple endpoint and we did pretty well here. * Changelog
* Implement MSC3827: Filtering of `/publicRooms` by room type (#13031)Šimon Brandner2022-06-291-0/+2
| | | | Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* fix linting error from the 1.61.1 main -> develop mergeAndrew Morgan2022-06-281-1/+2
|
* Merge branch 'master' into developAndrew Morgan2022-06-281-24/+39
|\
| * Merge pull request from GHSA-22p3-qrh9-cx32reivilibre2022-06-281-24/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make _iterate_over_text easier to read by using simple data structures * Prefer a set of tags to ignore In my tests, it's 4x faster to check for containment in a set of this size * Add a stack size limit to _iterate_over_text * Continue accepting the case where there is no body element * Use an early return instead for None Co-authored-by: Richard van der Hoff <richard@matrix.org>
* | Remove unspecced DELETE endpoint that modifies room visibility (#13123)santhoshivan232022-06-281-11/+0
| |
* | Add Cross-Origin-Resource-Policy header to thumbnail and download media ↵Robert Long2022-06-272-2/+12
| | | | | | | | endpoints (#12944)
* | validate room alias before interacting with the room directory (#13106)santhoshivan232022-06-221-0/+6
| |
* | Simplify the alias deletion logic as an application service. (#13093)Quentin Gliech2022-06-171-22/+13
| |
* | Allow MSC3030 'timestamp_to_event' calls from anyone on world-readable ↵Quentin Gliech2022-06-171-1/+3
| | | | | | | | | | rooms. (#13062) Signed-off-by: Quentin Gliech <quenting@element.io>
* | Improve URL previews for sites with only Twitter card information. (#13056)Patrick Cloke2022-06-161-17/+95
| | | | | | | | | | | | Pull out `twitter:` meta tags when generating a preview and use it to augment any `og:` meta tags. Prefers Open Graph information over Twitter card information.
* | Add custom well-known (#13035)Jacek Kuśnierz2022-06-161-1/+8
| | | | | | Co-authored-by: David Robertson <david.m.robertson1@gmail.com>
* | Replace pyjwt with authlib in `org.matrix.login.jwt` (#13011)Hannes Lerchl2022-06-151-8/+38
| |