summary refs log tree commit diff
path: root/synapse/api (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Implement MSC3827: Filtering of `/publicRooms` by room type (#13031)Šimon Brandner2022-06-291-0/+10
| | | | Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Fix a long-standing bug which meant that rate limiting was not restrictive ↵reivilibre2022-06-151-1/+4
| | | | enough in some cases. (#13018)
* Move the "email unsubscribe" resource, refactor the macaroon generator & ↵Quentin Gliech2022-06-141-148/+45
| | | | | | | | | | | | | | | | | | | | | simplify the access token verification logic. (#12986) This simplifies the access token verification logic by removing the `rights` parameter which was only ever used for the unsubscribe link in email notifications. The latter has been moved under the `/_synapse` namespace, since it is not a standard API. This also makes the email verification link more secure, by embedding the app_id and pushkey in the macaroon and verifying it. This prevents the user from tampering the query parameters of that unsubscribe link. Macaroon generation is refactored: - Centralised all macaroon generation and verification logic to the `MacaroonGenerator` - Moved to `synapse.utils` - Changed the constructor to require only a `Clock`, hostname, and a secret key (instead of a full `Homeserver`). - Added tests for all methods.
* Decouple `synapse.api.auth_blocking.AuthBlocking` from ↵Quentin Gliech2022-06-141-14/+0
| | | | `synapse.api.auth.Auth`. (#13021)
* Reduce the amount of state we pull from the DB (#12811)Erik Johnston2022-06-061-23/+22
|
* Remove remaining bits of groups code. (#12936)Patrick Cloke2022-06-011-1/+0
| | | | | | * Update worker docs to remove group endpoints. * Removes an unused parameter to `ApplicationService`. * Break dependency between media repo and groups. * Avoid copying `m.room.related_groups` state events during room upgrades.
* Fix M_USER_ACCOUNT_SUSPENDED error code for spec compliance (#12923)Travis Ralston2022-05-311-1/+1
|
* Revert "Fix M_USER_ACCOUNT_SUSPENDED error code for spec compliance (#12922)"Travis Ralston2022-05-301-1/+1
| | | | This reverts commit e0fae823e9938618a260adadb82bfee6e4c2f907.
* Fix M_USER_ACCOUNT_SUSPENDED error code for spec compliance (#12922)Travis Ralston2022-05-311-1/+1
| | | `M_` is a reserved namespace.
* Uniformize spam-checker API, part 3: Expand check_event_for_spam with the ↵David Teller2022-05-301-10/+13
| | | | | ability to return additional fields (#12846) Signed-off-by: David Teller <davidt@element.io>
* Add code M_USER_ACCOUNT_SUSPENDED, as per MSC3823. (#12845)David Teller2022-05-271-0/+7
| | | | Signed-off-by: David Teller <davidt@element.io> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Additional constants for EDU types. (#12884)Patrick Cloke2022-05-272-3/+9
| | | Instead of hard-coding strings in many places.
* Remove user-visible groups/communities code (#12553)Patrick Cloke2022-05-251-5/+0
| | | | | | | | | Makes it so that groups/communities no longer exist from a user-POV. E.g. we remove: * All API endpoints (including Client-Server, Server-Server, and admin). * Documented configuration options (and the experimental flag, which is now unused). * Special handling during room upgrades. * The `groups` section of the `/sync` response.
* Uniformize spam-checker API, part 2: check_event_for_spam (#12808)David Teller2022-05-231-3/+1
| | | Signed-off-by: David Teller <davidt@element.io>
* Uniformize spam-checker API, part 1: the `Code` enum. (#12703)David Teller2022-05-201-2/+9
|
* Add a new room version for MSC3787's knock+restricted join rule (#12623)Travis Ralston2022-05-172-0/+34
|
* Fix incorrect type hint in filtering code. (#12695)Patrick Cloke2022-05-101-2/+3
|
* Improve comments and error messages around access tokens. (#12577)reivilibre2022-05-051-8/+11
|
* Use `getClientAddress` instead of `getClientIP`. (#12599)Patrick Cloke2022-05-041-2/+2
| | | | | getClientIP was deprecated in Twisted 18.4.0, which also added getClientAddress. The Synapse minimum version for Twisted is currently 18.9.0, so all supported versions have the new API.
* Implement changes to MSC2285 (hidden read receipts) (#12168)Šimon Brandner2022-05-041-4/+2
| | | | | * Changes hidden read receipts to be a separate receipt type (instead of a field on `m.read`). * Updates the `/receipts` endpoint to accept `m.fully_read`.
* Implement MSC2815: allow room moderators to view redacted event content (#12427)Tulir Asokan2022-04-201-0/+18
| | | | | | Implements matrix-org/matrix-spec-proposals#2815 Signed-off-by: Tulir Asokan <tulir@maunium.net>
* Remove references to unstable identifiers from MSC3440. (#12382)Patrick Cloke2022-04-122-14/+0
| | | | | Removes references to unstable thread relation, unstable identifiers for filtering parameters, and the experimental config flag.
* Bump `black` and `click` versions (#12320)David Robertson2022-03-291-1/+1
|
* Support stable identifiers for MSC3440: Threading (#12151)Patrick Cloke2022-03-102-12/+15
| | | | The unstable identifiers are still supported if the experimental configuration flag is enabled. The unstable identifiers will be removed in a future release.
* Fix `PushRuleEvaluator` and `Filter` to work on frozendicts (#12100)Richard van der Hoff2022-02-281-2/+3
| | | | | | | | | | * Fix `PushRuleEvaluator` to work on frozendicts frozendicts do not (necessarily) inherit from dict, so this needs to handle them correctly. * Fix event filtering for frozen events Looks like this one was introduced by #11194.
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-233-4/+4
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Fix M_WRONG_ROOM_KEYS_VERSION error not including `current_version` field ↵Michael Telatynski2022-02-141-0/+3
| | | | | (#11988) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Stabilise MSC3231 (Token Based Registration) (#11867)Jonathan de Jong2022-02-041-1/+1
|
* Remove support for the webclient listener. (#11895)Patrick Cloke2022-02-031-1/+0
| | | Also remove support for non-HTTP(S) web_client_location.
* Use auto_attribs/native type hints for attrs classes. (#11692)Patrick Cloke2022-01-131-15/+15
|
* Allow tracking puppeted users for MAU (#11561)Jason Robinson2022-01-121-0/+13
| | | | | | | | | | | | | | | Currently when puppeting another user, the user doing the puppeting is tracked for client IPs and MAU (if configured). When tracking MAU is important, it becomes necessary to be possible to also track the client IPs and MAU of puppeted users. As an example a client that manages user creation and creation of tokens via the Synapse admin API, passing those tokens for the client to use. This PR adds optional configuration to enable tracking of puppeted users into monthly active users. The default behaviour stays the same. Signed-off-by: Jason Robinson <jasonr@matrix.org>
* Convert all namedtuples to attrs. (#11665)Patrick Cloke2021-12-301-2/+1
| | | To improve type hints throughout the code.
* Various opentracing enhancements (#11619)Richard van der Hoff2021-12-211-16/+37
| | | | | | | | | | | | | | | | | | | | | | | | | * Wrap `auth.get_user_by_req` in an opentracing span give `get_user_by_req` its own opentracing span, since it can result in a non-trivial number of sub-spans which it is useful to group together. This requires a bit of reorganisation because it also sets some tags (and may force tracing) on the servlet span. * Emit opentracing span for encoding json responses This can be a significant time sink. * Rename all sync spans with a prefix * Write an opentracing span for encoding sync response * opentracing span to group generate_room_entries * opentracing spans within sync.encode_response * changelog * Use the `trace` decorator instead of context managers
* Add experimental support for MSC3202: allowing application services to ↵reivilibre2021-12-151-14/+72
| | | | masquerade as specific devices. (#11538)
* Add a constant for receipt types (m.read). (#11531)Patrick Cloke2021-12-081-0/+4
| | | And expand some type hints in the receipts storage module.
* Annotate string constants in `synapse.api.constants` with `Final` (#11356)Sean Quah2021-11-251-98/+100
| | | | | | | | | | This change makes mypy complain if the constants are ever reassigned, and, more usefully, makes mypy type them as `Literal`s instead of `str`s, allowing code of the following form to pass mypy: ```py def do_something(membership: Literal["join", "leave"], ...): ... do_something(Membership.JOIN, ...) ```
* Add support for `/_matrix/media/v3` APIs (#11371)Aaron R2021-11-171-1/+2
| | | | | | | | | | | | | * Add support for `/_matrix/media/v3` APIs Signed-off-by: Aaron Raimist <aaron@raim.ist> * Update `workers.md` to use v3 client and media APIs Signed-off-by: Aaron Raimist <aaron@raim.ist> * Add changelog Signed-off-by: Aaron Raimist <aaron@raim.ist>
* Support filtering by relations per MSC3440 (#11236)Patrick Cloke2021-11-091-31/+84
| | | | Adds experimental support for `relation_types` and `relation_senders` fields for filters.
* Default value for `public_baseurl` (#11210)Richard van der Hoff2021-11-081-3/+0
| | | | | We might as well use a default value for `public_baseurl` based on `server_name` - in many cases, it will be correct.
* Make `check_event_allowed` module API callback not fail open (accept events) ↵reivilibre2021-11-011-0/+7
| | | | when an exception is raised (#11033)
* Refactor `Filter` to handle fields according to data being filtered. (#11194)Patrick Cloke2021-10-271-61/+78
| | | | This avoids filtering against fields which cannot exist on an event source. E.g. presence updates don't have a room.
* Add a thread relation type per MSC3440. (#11088)Patrick Cloke2021-10-211-0/+1
| | | | Adds experimental support for MSC3440's `io.element.thread` relation type (and the aggregation for it).
* Add missing type hints to synapse.api. (#11109)Patrick Cloke2021-10-186-94/+75
| | | | * Convert UserPresenceState to attrs. * Remove args/kwargs from error classes and explicitly pass msg/errorcode.
* Remove the deprecated BaseHandler. (#11005)Patrick Cloke2021-10-081-0/+86
| | | | | | | | The shared ratelimit function was replaced with a dedicated RequestRatelimiter class (accessible from the HomeServer object). Other properties were copied to each sub-class that inherited from BaseHandler.
* Add type hints to filtering classes. (#10958)Patrick Cloke2021-10-011-43/+74
|
* Strip "join_authorised_via_users_server" from join events which do not need ↵Patrick Cloke2021-09-301-0/+3
| | | | | | | it. (#10933) This fixes a "Event not signed by authorising server" error when transition room member from join -> join, e.g. when updating a display name or avatar URL for restricted rooms.
* Fix AuthBlocking check when requester is appservice (#10881)Jason Robinson2021-09-241-1/+1
| | | | | If the MAU count had been reached, Synapse incorrectly blocked appservice users even though they've been explicitly configured not to be tracked (the default). This was due to bypassing the relevant if as it was chained behind another earlier hit if as an elif. Signed-off-by: Jason Robinson <jasonr@matrix.org>
* Use direct references for configuration variables (part 4). (#10893)Patrick Cloke2021-09-231-2/+2
|
* Rename MSC2716 things from `chunk` to `batch` to match `/batch_send` ↵Eric Eastwood2021-09-212-24/+8
| | | | | | | | endpoint (#10838) See https://github.com/matrix-org/matrix-doc/pull/2716#discussion_r684574497 Dropping support for older MSC2716 room versions so we don't have to worry about supporting both chunk and batch events.
* Use direct references for some configuration variables (part 2) (#10812)Patrick Cloke2021-09-152-9/+11
|
* Use direct references for some configuration variables (#10798)Patrick Cloke2021-09-131-2/+2
| | | | Instead of proxying through the magic getter of the RootConfig object. This should be more performant (and is more explicit).
* Add types to synapse.util. (#10601)reivilibre2021-09-101-4/+4
|
* Prefer room v9 for restricted rooms. (#10772)Patrick Cloke2021-09-091-1/+1
| | | | | Hint to clients via the room capabilities API (MSC3244) that room version 9 should be preferred for creating a room with restricted join rules (instead of room version 8).
* Add a constant for m.federate. (#10775)Patrick Cloke2021-09-081-0/+3
|
* Merge tag 'v1.42.0rc2' into developBrendan Abolivier2021-09-061-0/+31
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synapse 1.42.0rc2 (2021-09-06) ============================== This version of Synapse removes deprecated room-management admin APIs, removes out-of-date email pushers, and improves error handling for fallback templates for user-interactive authentication. For more information on these points, server administrators are encouraged to read [the upgrade notes](docs/upgrade.md#upgrading-to-v1420). Features -------- - Support room version 9 from [MSC3375](https://github.com/matrix-org/matrix-doc/pull/3375). ([\#10747](https://github.com/matrix-org/synapse/issues/10747)) Internal Changes ---------------- - Print a warning when using one of the deprecated `template_dir` settings. ([\#10768](https://github.com/matrix-org/synapse/issues/10768))
| * Support MSC3375: room version 9. (#10747)Patrick Cloke2021-09-031-0/+31
| |
* | Move `maybe_kick_guest_users` out of `BaseHandler` (#10744)Richard van der Hoff2021-09-061-0/+9
| | | | | | This is part of my ongoing war against BaseHandler. I've moved kick_guest_users into RoomMemberHandler (since it calls out to that handler anyway), and split maybe_kick_guest_users into the two places it is called.
* | Populate `rooms.creator` field for easy lookup (#10697)Eric Eastwood2021-09-011-0/+3
|/ | | | | | Part of https://github.com/matrix-org/synapse/pull/10566 - Fill in creator whenever we insert into the rooms table - Add background update to backfill any missing creator values
* Merge branch 'master' into developErik Johnston2021-08-241-1/+1
|\
| * Set room version 8 as preferred for restricted rooms. (#10571)Patrick Cloke2021-08-201-1/+1
| |
* | Implement MSC3231: Token authenticated registration (#10142)Callum Brown2021-08-211-0/+1
| | | | | | | | | | Signed-off-by: Callum Brown <callum@calcuode.com> This is part of my GSoC project implementing [MSC3231](https://github.com/matrix-org/matrix-doc/pull/3231).
* | Validate device_keys for C-S /keys/query requests (#10593)David Robertson2021-08-201-0/+8
|/ | | | | | | | * Validate device_keys for C-S /keys/query requests Closes #10354 A small, not particularly critical fix. I'm interested in seeing if we can find a more systematic approach though. #8445 is the place for any discussion.
* When redacting, keep event fields around that maintain the historical event ↵Eric Eastwood2021-08-091-5/+32
| | | | | | | | | | | | | | | structure intact (MSC2716) (#10538) * Keep event fields that maintain the historical event structure intact Fix https://github.com/matrix-org/synapse/issues/10521 * Add changelog * Bump room version * Better changelog text * Fix up room version after develop merge
* Support MSC3289: Room version 8 (#10449)Patrick Cloke2021-08-092-15/+15
| | | This adds support for MSC3289: room version 8. This is room version 7 + MSC3083.
* Make historical events discoverable from backfill for servers without any ↵Eric Eastwood2021-07-282-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scrollback history (MSC2716) (#10245) * Make historical messages available to federated servers Part of MSC2716: https://github.com/matrix-org/matrix-doc/pull/2716 Follow-up to https://github.com/matrix-org/synapse/pull/9247 * Debug message not available on federation * Add base starting insertion point when no chunk ID is provided * Fix messages from multiple senders in historical chunk Follow-up to https://github.com/matrix-org/synapse/pull/9247 Part of MSC2716: https://github.com/matrix-org/matrix-doc/pull/2716 --- Previously, Synapse would throw a 403, `Cannot force another user to join.`, because we were trying to use `?user_id` from a single virtual user which did not match with messages from other users in the chunk. * Remove debug lines * Messing with selecting insertion event extremeties * Move db schema change to new version * Add more better comments * Make a fake requester with just what we need See https://github.com/matrix-org/synapse/pull/10276#discussion_r660999080 * Store insertion events in table * Make base insertion event float off on its own See https://github.com/matrix-org/synapse/pull/10250#issuecomment-875711889 Conflicts: synapse/rest/client/v1/room.py * Validate that the app service can actually control the given user See https://github.com/matrix-org/synapse/pull/10276#issuecomment-876316455 Conflicts: synapse/rest/client/v1/room.py * Add some better comments on what we're trying to check for * Continue debugging * Share validation logic * Add inserted historical messages to /backfill response * Remove debug sql queries * Some marker event implemntation trials * Clean up PR * Rename insertion_event_id to just event_id * Add some better sql comments * More accurate description * Add changelog * Make it clear what MSC the change is part of * Add more detail on which insertion event came through * Address review and improve sql queries * Only use event_id as unique constraint * Fix test case where insertion event is already in the normal DAG * Remove debug changes * Switch to chunk events so we can auth via power_levels Previously, we were using `content.chunk_id` to connect one chunk to another. But these events can be from any `sender` and we can't tell who should be able to send historical events. We know we only want the application service to do it but these events have the sender of a real historical message, not the application service user ID as the sender. Other federated homeservers also have no indicator which senders are an application service on the originating homeserver. So we want to auth all of the MSC2716 events via power_levels and have them be sent by the application service with proper PL levels in the room. * Switch to chunk events for federation * Add unstable room version to support new historical PL * Fix federated events being rejected for no state_groups Add fix from https://github.com/matrix-org/synapse/pull/10439 until it merges. * Only connect base insertion event to prev_event_ids Per discussion with @erikjohnston, https://matrix.to/#/!UytJQHLQYfvYWsGrGY:jki.re/$12bTUiObDFdHLAYtT7E-BvYRp3k_xv8w0dUQHibasJk?via=jki.re&via=matrix.org * Make it possible to get the room_version with txn * Allow but ignore historical events in unsupported room version See https://github.com/matrix-org/synapse/pull/10245#discussion_r675592489 We can't reject historical events on unsupported room versions because homeservers without knowledge of MSC2716 or the new room version don't reject historical events either. Since we can't rely on the auth check here to stop historical events on unsupported room versions, I've added some additional checks in the processing/persisting code (`synapse/storage/databases/main/events.py` -> `_handle_insertion_event` and `_handle_chunk_event`). I've had to do some refactoring so there is method to fetch the room version by `txn`. * Move to unique index syntax See https://github.com/matrix-org/synapse/pull/10245#discussion_r675638509 * High-level document how the insertion->chunk lookup works * Remove create_event fallback for room_versions See https://github.com/matrix-org/synapse/pull/10245/files#r677641879 * Use updated method name
* Merge tag 'v1.39.0rc3' into developErik Johnston2021-07-281-0/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synapse 1.39.0rc3 (2021-07-28) ============================== Bugfixes -------- - Fix a bug introduced in Synapse 1.38 which caused an exception at startup when SAML authentication was enabled. ([\#10477](https://github.com/matrix-org/synapse/issues/10477)) - Fix a long-standing bug where Synapse would not inform clients that a device had exhausted its one-time-key pool, potentially causing problems decrypting events. ([\#10485](https://github.com/matrix-org/synapse/issues/10485)) - Fix reporting old R30 stats as R30v2 stats. Introduced in v1.39.0rc1. ([\#10486](https://github.com/matrix-org/synapse/issues/10486)) Internal Changes ---------------- - Fix an error which prevented the Github Actions workflow to build the docker images from running. ([\#10461](https://github.com/matrix-org/synapse/issues/10461)) - Fix release script to correctly version debian changelog when doing RCs. ([\#10465](https://github.com/matrix-org/synapse/issues/10465))
| * Always communicate device OTK counts to clients (#10485)Andrew Morgan2021-07-271-0/+8
| | | | | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* | Support for MSC2285 (hidden read receipts) (#10413)Šimon Brandner2021-07-281-0/+4
| | | | | | Implementation of matrix-org/matrix-doc#2285
* | Update the MSC3083 support to verify if joins are from an authorized server. ↵Patrick Cloke2021-07-262-1/+4
| | | | | | | | (#10254)
* | Switch to `chunk` events so we can auth via power_levels (MSC2716) (#10432)Eric Eastwood2021-07-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we were using `content.chunk_id` to connect one chunk to another. But these events can be from any `sender` and we can't tell who should be able to send historical events. We know we only want the application service to do it but these events have the sender of a real historical message, not the application service user ID as the sender. Other federated homeservers also have no indicator which senders are an application service on the originating homeserver. So we want to auth all of the MSC2716 events via power_levels and have them be sent by the application service with proper PL levels in the room.
* | MSC3244 room capabilities implementation (#10283)Michael Telatynski2021-07-201-2/+36
|/
* Add a module type for account validity (#9884)Brendan Abolivier2021-07-161-7/+10
| | | | | This adds an API for third-party plugin modules to implement account validity, so they can provide this feature instead of Synapse. The module implementing the current behaviour for this feature can be found at https://github.com/matrix-org/synapse-email-account-validity. To allow for a smooth transition between the current feature and the new module, hooks have been added to the existing account validity endpoints to allow their behaviours to be overridden by a module.
* Use inline type hints in various other places (in `synapse/`) (#10380)Jonathan de Jong2021-07-155-10/+8
|
* Fix messages from multiple senders in historical chunk (MSC2716) (#10276)Eric Eastwood2021-07-131-4/+33
| | | | | | | Fix messages from multiple senders in historical chunk. This also means that an app service does not need to define `?user_id` when using this endpoint. Follow-up to https://github.com/matrix-org/synapse/pull/9247 Part of MSC2716: https://github.com/matrix-org/matrix-doc/pull/2716
* Move methods involving event authentication to EventAuthHandler. (#10268)Patrick Cloke2021-07-011-73/+2
| | | Instead of mixing them with user authentication methods.
* Correct type hints for synapse.event_auth. (#10253)Patrick Cloke2021-06-301-2/+3
|
* Do not recurse into non-spaces in the spaces summary. (#10256)Patrick Cloke2021-06-291-0/+6
| | | | | Previously m.child.room events in non-space rooms would be treated as part of the room graph, but this is no longer supported.
* MSC2918 Refresh tokens implementation (#9450)Quentin Gliech2021-06-241-0/+5
| | | | | | | | | | This implements refresh tokens, as defined by MSC2918 This MSC has been implemented client side in Hydrogen Web: vector-im/hydrogen-web#235 The basics of the MSC works: requesting refresh tokens on login, having the access tokens expire, and using the refresh token to get a new one. Signed-off-by: Quentin Gliech <quentingliech@gmail.com>
* Add endpoints for backfilling history (MSC2716) (#9247)Eric Eastwood2021-06-222-5/+17
| | | Work on https://github.com/matrix-org/matrix-doc/pull/2716
* Update MSC3083 support per changes in the MSC. (#10189)Patrick Cloke2021-06-171-0/+6
| | | Adds a "type" field and generalize "space" to "room_id".
* Make opentracing trace into event persistence (#10134)Richard van der Hoff2021-06-161-2/+2
| | | | | | | | | | | | | | * Trace event persistence When we persist a batch of events, set the parent opentracing span to the that from the request, so that we can trace all the way in. * changelog * When we force tracing, set a baggage item ... so that we can check again later. * Link in both directions between persist_events spans
* Remove support for unstable MSC1772 prefixes. (#10161)Patrick Cloke2021-06-151-3/+0
| | | | The stable prefixes have been supported since v1.34.0. The unstable prefixes are not supported by any known clients.
* Remove the experimental flag for knocking and use stable prefixes / ↵Patrick Cloke2021-06-152-5/+6
| | | | | | | endpoints. (#10167) * Room version 7 for knocking. * Stable prefixes and endpoints (both client and federation) for knocking. * Removes the experimental configuration flag.
* Implement knock feature (#6739)Sorunome2021-06-093-4/+29
| | | | | | This PR aims to implement the knock feature as proposed in https://github.com/matrix-org/matrix-doc/pull/2403 Signed-off-by: Sorunome mail@sorunome.de Signed-off-by: Andrew Morgan andrewm@element.io
* Set opentracing priority before setting other tags (#10092)Richard van der Hoff2021-05-281-4/+4
| | | ... because tags on spans which aren't being sampled get thrown away.
* Remove the experimental spaces enabled flag. (#10063)Patrick Cloke2021-05-261-1/+1
| | | | In lieu of just always enabling the unstable spaces endpoint and unstable room version.
* Support enabling opentracing by user (#9978)Richard van der Hoff2021-05-141-0/+5
| | | | | Add a config option which allows enabling opentracing by user id, eg for debugging requests made by a test user.
* Correctly ratelimit invites when creating a room (#9968)Brendan Abolivier2021-05-121-5/+17
| | | | | * Correctly ratelimit invites when creating a room Also allow ratelimiting for more than one action at a time.
* Fix `m.room_key_request` to-device messages (#9961)Richard van der Hoff2021-05-111-1/+4
| | | fixes #9960
* Follow-up to #9915 to correct the identifier for room types.Patrick Cloke2021-05-051-1/+1
|
* Support stable MSC1772 spaces identifiers. (#9915)Patrick Cloke2021-05-051-0/+3
| | | | Support both the unstable and stable identifiers. A future release will disable the unstable identifiers.
* Improved validation for received requests (#9817)Richard van der Hoff2021-04-231-0/+3
| | | | | | * Simplify `start_listening` callpath * Correctly check the size of uploaded files
* Add type hints to auth and auth_blocking. (#9876)Patrick Cloke2021-04-232-42/+45
|
* Check for space membership during a remote join of a restricted room (#9814)Patrick Cloke2021-04-231-0/+1
| | | | | | When receiving a /send_join request for a room with join rules set to 'restricted', check if the user is a member of the spaces defined in the 'allow' key of the join rules. This only applies to an experimental room version, as defined in MSC3083.
* Port "Allow users to click account renewal links multiple times without ↵Andrew Morgan2021-04-191-2/+4
| | | | | hitting an 'Invalid Token' page #74" from synapse-dinsic (#9832) This attempts to be a direct port of https://github.com/matrix-org/synapse-dinsic/pull/74 to mainline. There was some fiddling required to deal with the changes that have been made to mainline since (mainly dealing with the split of `RegistrationWorkerStore` from `RegistrationStore`, and the changes made to `self.make_request` in test code).
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-149-9/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Require AppserviceRegistrationType (#9548)Will Hunt2021-04-121-0/+5
| | | This change ensures that the appservice registration behaviour follows the spec. We decided to do this for Dendrite, so it made sense to also make a PR for synapse to correct the behaviour.
* Add an experimental room version to support restricted join rules. (#9717)Patrick Cloke2021-03-312-1/+25
| | | Per MSC3083.
* Make RateLimiter class check for ratelimit overrides (#9711)Erik Johnston2021-03-301-45/+55
| | | | | | | This should fix a class of bug where we forget to check if e.g. the appservice shouldn't be ratelimited. We also check the `ratelimit_override` table to check if the user has ratelimiting disabled. That table is really only meant to override the event sender ratelimiting, so we don't use any values from it (as they might not make sense for different rate limits), but we do infer that if ratelimiting is disabled for the user we should disabled all ratelimits. Fixes #9663
* Make it possible to use dmypy (#9692)Erik Johnston2021-03-261-0/+5
| | | | | | | | | Running `dmypy run` will do a `mypy` check while spinning up a daemon that makes rerunning `dmypy run` a lot faster. `dmypy` doesn't support `follow_imports = silent` and has `local_partial_types` enabled, so this PR enables those options and fixes the issues that were newly raised. Note that `local_partial_types` will be enabled by default in upcoming mypy releases.
* Merge branch 'develop' into babolivier/msc3026Brendan Abolivier2021-03-191-0/+6
|\
| * Initial spaces summary API (#9643)Richard van der Hoff2021-03-181-0/+6
| | | | | | This is very bare-bones for now: federation will come soon, while pagination is descoped for now but will come later.
* | Implement MSC3026: busy presence stateBrendan Abolivier2021-03-181-0/+1
|/
* Fix additional type hints from Twisted 21.2.0. (#9591)Patrick Cloke2021-03-121-1/+1
|
* Record the SSO Auth Provider in the login token (#9510)Richard van der Hoff2021-03-041-32/+9
| | | This great big stack of commits is a a whole load of hoop-jumping to make it easier to store additional values in login tokens, and then to actually store the SSO Identity Provider in the login token. (Making use of that data will follow in a subsequent PR.)
* Ratelimit cross-user key sharing requests. (#8957)Patrick Cloke2021-02-192-6/+11
|
* Add type hints to groups code. (#9393)Patrick Cloke2021-02-171-0/+5
|
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-164-19/+24
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Backout changes for automatically calculating the public baseurl. (#9313)Patrick Cloke2021-02-111-0/+2
| | | | This breaks some people's configurations (if their Client-Server API is not accessed via port 443).
* Give `public_baseurl` a default value (#9159)Richard van der Hoff2021-01-201-2/+0
|
* Kill off `HomeServer.get_ip_from_request()` (#9080)Richard van der Hoff2021-01-121-2/+2
| | | Homeserver.get_ip_from_request() used to be a bit more complicated, but now it is totally redundant. Let's get rid of it.
* Remove SynapseRequest.get_user_agent (#9069)Richard van der Hoff2021-01-121-1/+2
| | | | | | | | | | | SynapseRequest is in danger of becoming a bit of a dumping-ground for "useful stuff relating to Requests", which isn't really its intention (its purpose is to override render, finished and connectionLost to set up the LoggingContext and write the right entries to the request log). Putting utility functions inside SynapseRequest means that lots of our code ends up requiring a SynapseRequest when there is nothing synapse-specific about the Request at all, and any old twisted.web.iweb.IRequest will do. This increases code coupling and makes testing more difficult. In short: move get_user_agent out to a utility function.
* Implement MSC2176: Updated redaction rules (#8984)Patrick Cloke2021-01-051-6/+26
| | | | An experimental room version ("org.matrix.msc2176") contains the new redaction rules for testing.
* Merge remote-tracking branch 'origin/erikj/as_mau_block' into developErik Johnston2020-12-181-0/+7
|\
| * Don't MAU limit AS ghost usersErik Johnston2020-12-171-0/+7
| |
* | Try and drop stale extremities. (#8929)Erik Johnston2020-12-181-0/+2
| | | | | | | | If we see stale extremities while persisting events, and notice that they don't change the result of state resolution, we drop them.
* | Do not assume that the contents dictionary includes history_visibility. (#8945)Patrick Cloke2020-12-162-2/+10
| |
* | Honour AS ratelimit settings for /login requests (#8920)Erik Johnston2020-12-111-1/+3
|/ | | | Fixes #8846.
* Add admin API for logging in as a user (#8617)Erik Johnston2020-11-171-4/+29
|
* Add ability for access tokens to belong to one user but grant access to ↵Erik Johnston2020-10-291-67/+46
| | | | | | | | | | another user. (#8616) We do it this way round so that only the "owner" can delete the access token (i.e. `/logout/all` by the "owner" also deletes that token, but `/logout/all` by the "target user" doesn't). A future PR will add an API for creating such a token. When the target user and authenticated entity are different the `Processed request` log line will be logged with a: `{@admin:server as @bob:server} ...`. I'm not convinced by that format (especially since it adds spaces in there, making it harder to use `cut -d ' '` to chop off the start of log lines). Suggestions welcome.
* Fix handling of User-Agent headers with bad utf-8. (#8632)Erik Johnston2020-10-231-3/+1
|
* type annotations for LruCacheRichard van der Hoff2020-10-161-1/+3
|
* Make LruCache register its own metrics (#8561)Richard van der Hoff2020-10-161-3/+1
| | | | | rather than have everything that instantiates an LruCache manage metrics separately, have LruCache do it itself.
* Do not assume that account data is of the correct form. (#8454)Patrick Cloke2020-10-051-0/+5
| | | | This fixes a bug where `m.ignored_user_list` was assumed to be a dict, leading to odd behavior for users who set it to something else.
* Don't push if an user account has expired (#8353)Mathieu Velten2020-09-231-5/+1
|
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-182-28/+24
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Show a confirmation page during user password reset (#8004)Andrew Morgan2020-09-101-0/+1
| | | | | This PR adds a confirmation step to resetting your user password between clicking the link in your email and your password actually being reset. This is to better align our password reset flow with the industry standard of requiring a confirmation from the user after email validation.
* Directly import json from the standard library. (#8259)Patrick Cloke2020-09-081-1/+1
| | | | | By importing from canonicaljson the simplejson module was still being used in some situations. After this change the std lib json is consistenty used throughout Synapse.
* Stop sub-classing object (#8249)Patrick Cloke2020-09-048-26/+26
|
* Do not apply ratelimiting on joins to appservices (#8139)Will Hunt2020-08-211-0/+37
| | | | | | Add new method ratelimiter.can_requester_do_action and ensure that appservices are exempt from being ratelimited. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Erik Johnston <erik@matrix.org>
* Stop shadow-banned users from sending invites. (#8095)Patrick Cloke2020-08-201-0/+8
|
* Be stricter about JSON that is accepted by Synapse (#8106)Patrick Cloke2020-08-191-3/+3
|
* Convert stream database to async/await. (#8074)Patrick Cloke2020-08-172-1/+70
|
* Add a shadow-banned flag to users. (#8092)Patrick Cloke2020-08-141-1/+11
|
* Convert synapse.api to async/await (#8031)Patrick Cloke2020-08-063-80/+63
|
* Improve performance of the register endpoint (#8009)Patrick Cloke2020-08-061-1/+3
|
* Convert a synapse.events to async/await. (#7949)Patrick Cloke2020-07-271-1/+1
|
* Convert state resolution to async/await (#7942)Patrick Cloke2020-07-241-4/+8
|
* Ensure that calls to `json.dumps` are compatible with the standard library ↵Patrick Cloke2020-07-151-1/+3
| | | | json. (#7836)
* Improve the type hints of synapse.api.errors. (#7820)Patrick Cloke2020-07-141-55/+73
|
* Do not use canonicaljson to magically handle decoding bytes from JSON. (#7802)Patrick Cloke2020-07-101-4/+2
|
* Fix some spelling mistakes / typos. (#7811)Patrick Cloke2020-07-091-1/+1
|
* isort 5 compatibility (#7786)Will Hunt2020-07-051-2/+1
| | | The CI appears to use the latest version of isort, which is a problem when isort gets a major version bump. Rather than try to pin the version, I've done the necessary to make isort5 happy with synapse.
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-163-9/+5
|
* Replace iteritems/itervalues/iterkeys with native versions. (#7692)Patrick Cloke2020-06-152-5/+2
|
* Add option to enable encryption by default for new rooms (#7639)Andrew Morgan2020-06-101-0/+5
| | | | | | | | | Fixes https://github.com/matrix-org/synapse/issues/2431 Adds config option `encryption_enabled_by_default_for_room_type`, which determines whether encryption should be enabled with the default encryption algorithm in private or public rooms upon creation. Whether the room is private or public is decided based upon the room creation preset that is used. Part of this PR is also pulling out all of the individual instances of `m.megolm.v1.aes-sha2` into a constant variable to eliminate typos ala https://github.com/matrix-org/synapse/pull/7637 Based on #7637
* Update to the stable SSO prefix for UI Auth. (#7630)Patrick Cloke2020-06-051-1/+1
|
* Fix type information on `assert_*_is_admin` methods (#7645)Richard van der Hoff2020-06-051-4/+4
| | | These things don't return Deferreds.
* Remove some unused constants. (#7644)Richard van der Hoff2020-06-051-4/+0
|
* Performance improvements and refactor of Ratelimiter (#7595)Andrew Morgan2020-06-051-35/+118
| | | | | | | | | | While working on https://github.com/matrix-org/synapse/issues/5665 I found myself digging into the `Ratelimiter` class and seeing that it was both: * Rather undocumented, and * causing a *lot* of config checks This PR attempts to refactor and comment the `Ratelimiter` class, as well as encourage config file accesses to only be done at instantiation. Best to be reviewed commit-by-commit.
* Implement room version 6 (MSC2240). (#7506)Patrick Cloke2020-05-151-26/+4
|
* Strictly enforce canonicaljson requirements in a new room version (#7381)Patrick Cloke2020-05-141-1/+23
|
* Enforce MSC2209: auth rules for notifications in power level event (#7502)Patrick Cloke2020-05-141-1/+21
| | | | In a new room version, the "notifications" key of power level events are subject to restricted auth rules.
* Allow expired accounts to logout (#7443)Andrew Morgan2020-05-141-17/+33
|
* Allow configuration of Synapse's cache without using synctl or environment ↵Amber Brown2020-05-111-2/+2
| | | | variables (#6391)
* Stop Auth methods from polling the config on every req. (#7420)Andrew Morgan2020-05-062-73/+114
|
* async/await is_server_admin (#7363)Andrew Morgan2020-05-011-5/+4
|
* Stop the master relaying USER_SYNC for other workers (#7318)Richard van der Hoff2020-04-221-0/+2
| | | | | | | Long story short: if we're handling presence on the current worker, we shouldn't be sending USER_SYNC commands over replication. In an attempt to figure out what is going on here, I ended up refactoring some bits of the presencehandler code, so the first 4 commits here are non-functional refactors to move this code slightly closer to sanity. (There's still plenty to do here :/). Suggest reviewing individual commits. Fixes (I hope) #7257.
* Convert http.HTTPStatus objects to their int equivalent (#7188)Andrew Morgan2020-04-031-1/+8
|
* Support SAML in the user interactive authentication workflow. (#7102)Patrick Cloke2020-04-011-0/+1
|
* Allow server admins to define and enforce a password policy (MSC2000). (#7118)Dirk Klimpel2020-03-261-0/+21
|
* Remove special auth and redaction rules for aliases events in experimental ↵Patrick Cloke2020-03-091-4/+5
| | | | room ver. (#7037)
* Allow deleting an alias if the user has sufficient power level (#6986)Patrick Cloke2020-03-041-7/+2
|
* Validate the alt_aliases property of canonical alias events (#6971)Patrick Cloke2020-03-031-0/+1
|
* Publishing/removing from the directory requires a power level greater than ↵Patrick Cloke2020-02-211-5/+5
| | | | canonical aliases.
* Add `allow_departed_users` param to `check_in_room_or_world_readable`Richard van der Hoff2020-02-191-3/+13
| | | | | | | ... and set it everywhere it's called. while we're here, rename it for consistency with `check_user_in_room` (and to help check that I haven't missed any instances)
* Refactor the membership check methods in AuthRichard van der Hoff2020-02-181-43/+37
| | | | | these were getting a bit unwieldy, so let's combine `check_joined_room` and `check_user_was_in_room` into a single `check_user_in_room`.
* Fix detecting unknown devices from remote encrypted events. (#6848)Erik Johnston2020-02-041-2/+1
| | | | | | | | We were looking at the wrong event type (`m.room.encryption` vs `m.room.encrypted`). Also fixup the duplicate `EvenTypes` entries. Introduced in #6776.
* Add `get_room_version` methodRichard van der Hoff2020-01-311-4/+2
| | | | So that we can start factoring out some of this boilerplatey boilerplate.
* Implement updated auth rules from MSC2260Richard van der Hoff2020-01-281-0/+16
|
* Pass room version object into event_auth.check and check_redaction (#6788)Richard van der Hoff2020-01-281-2/+5
| | | | | | | These are easier to work with than the strings and we normally have one around. This fixes `FederationHander._persist_auth_tree` which was passing a RoomVersion object into event_auth.check instead of a string.
* Fixup synapse.api to pass mypy (#6733)Erik Johnston2020-01-202-3/+8
|
* Add StateMap type alias (#6715)Erik Johnston2020-01-161-6/+2
|
* Implement RedirectException (#6687)Richard van der Hoff2020-01-151-1/+26
| | | | | Allow REST endpoint implemnentations to raise a RedirectException, which will redirect the user's browser to a given location.
* Kill off RegistrationError (#6691)Richard van der Hoff2020-01-131-6/+0
| | | This is pretty pointless. Let's just use SynapseError.
* Remove unused, undocumented "content repo" resource (#6628)Richard van der Hoff2020-01-031-1/+0
| | | | | | This looks like it got half-killed back in #888. Fixes #6567.
* Change EventContext to use the Storage class (#6564)Erik Johnston2019-12-201-1/+1
|
* Add auth events as per spec. (#6556)Erik Johnston2019-12-161-67/+34
| | | | | Previously we tried to be clever and filter out some unnecessary event IDs to keep the auth chain small, but that had some annoying interactions with state res v2 so we stop doing that for now.
* Merge pull request #6329 from matrix-org/babolivier/context_filtersBrendan Abolivier2019-12-042-1/+5
|\ | | | | Filter state, events_before and events_after in /context requests
| * Merge branch 'develop' into babolivier/context_filtersBrendan Abolivier2019-12-042-1/+3
| |\
| * | Update copyrightsBrendan Abolivier2019-11-052-1/+5
| | |
* | | Add ephemeral messages support (MSC2228) (#6409)Brendan Abolivier2019-12-031-0/+4
| |/ |/| | | | | | | | | | | | | Implement part [MSC2228](https://github.com/matrix-org/matrix-doc/pull/2228). The parts that differ are: * the feature is hidden behind a configuration flag (`enable_ephemeral_messages`) * self-destruction doesn't happen for state events * only implement support for the `m.self_destruct_after` field (not the `m.self_destruct` one) * doesn't send synthetic redactions to clients because for this specific case we consider the clients to be able to destroy an event themselves, instead we just censor it (by pruning its JSON) in the database
* | Merge branch 'develop' into babolivier/message_retentionBrendan Abolivier2019-11-261-1/+1
|\ \
| * | Replace instance variations of homeserver with correct case/spacingAndrew Morgan2019-11-121-1/+1
| |/
* / Implement per-room message retention policiesBrendan Abolivier2019-11-041-0/+2
|/
* Merge pull request #6301 from matrix-org/babolivier/msc2326Brendan Abolivier2019-11-012-2/+20
|\ | | | | Implement MSC2326 (label based filtering)
| * Incorporate reviewBrendan Abolivier2019-11-012-2/+2
| |
| * LintBrendan Abolivier2019-11-011-0/+1
| |
| * Incorporate reviewBrendan Abolivier2019-11-012-3/+8
| |
| * Add unit testsBrendan Abolivier2019-10-301-1/+1
| |
| * Implement filteringBrendan Abolivier2019-10-301-2/+11
| |
| * Store labels for new eventsBrendan Abolivier2019-10-301-0/+3
| |
* | Remove usage of deprecated logger.warn method from codebase (#6271)Andrew Morgan2019-10-311-1/+1
|/ | | Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
* Option to suppress resource exceeded alerting (#6173)Neil Johnson2019-10-242-3/+16
| | | | The expected use case is to suppress MAU limiting on small instances
* Remove Auth.check method (#6217)Richard van der Hoff2019-10-181-18/+1
| | | This method was somewhat redundant, and confusing.
* Merge branch 'uhoreg/e2e_cross-signing_merged' into developHubert Chathi2019-10-181-0/+1
|\
| * Merge branch 'develop' into uhoreg/e2e_cross-signing_mergedHubert Chathi2019-10-183-5/+18
| |\
| * \ Merge branch 'develop' into cross-signing_keysHubert Chathi2019-09-041-8/+7
| |\ \
| * \ \ Merge branch 'uhoreg/e2e_cross-signing_merged' into cross-signing_keysHubert Chathi2019-08-283-2/+8
| |\ \ \
| * \ \ \ Merge branch 'cross-signing_hidden' into cross-signing_keysHubert Chathi2019-08-012-48/+26
| |\ \ \ \
| * | | | | allow uploading keys for cross-signingHubert Chathi2019-07-251-0/+1
| | | | | |
* | | | | | rip out some unreachable codeRichard van der Hoff2019-10-171-2/+0
| |_|_|_|/ |/| | | | | | | | | | | | | | The only possible rejection reason is AUTH_ERROR, so all of this is unreachable.
* | | | | Fix up some typechecking (#6150)Amber Brown2019-10-022-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * type checking fixes * changelog
* | | | | Add device and appservice tagsErik Johnston2019-09-251-0/+3
| | | | |
* | | | | Don't create new span for get_user_by_reqErik Johnston2019-09-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't actually care about what happens in `get_user_by_req` and having it as a separate span means that the entity tag isn't added to the servlet spans, making it harder to search.
* | | | | Ensure support users can be registered even if MAU limit is reachedJason Robinson2019-09-111-2/+9
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows support users to be created even on MAU limits via the admin API. Support users are excluded from MAU after creation, so it makes sense to exclude them in creation - except if the whole host is in disabled state. Signed-off-by: Jason Robinson <jasonr@matrix.org>
* | | | Remove double return statements (#5962)Andrew Morgan2019-09-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove all the "double return" statements which were a result of us removing all the instances of ``` defer.returnValue(...) return ``` statements when we switched to python3 fully.
* | | | Remove unnecessary parentheses around return statements (#5931)Andrew Morgan2019-08-301-7/+7
| |_|/ |/| | | | | | | | | | | Python will return a tuple whether there are parentheses around the returned values or not. I'm just sick of my editor complaining about this all over the place :)
* | | Add bot typeHalf-Shot2019-08-231-1/+2
| | |
* | | Opentracing misc (#5856)Jorik Schellekens2019-08-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add authenticated_entity and servlet_names tags. Functionally: - Add a tag for authenticated_entity - Add a tag for servlet_names Stylistically: Moved to importing methods directly from opentracing.
* | | Change user deactivated errcode to USER_DEACTIVATED and use it (#5686)Andrew Morgan2019-07-311-1/+2
| |/ |/| | | | | | | This is intended as an amendment to #5674 as using M_UNKNOWN as the errcode makes it hard for clients to differentiate between an invalid password and a deactivated user (the problem we were trying to solve in the first place). M_UNKNOWN was originally chosen as it was presumed than an MSC would have to be carried out to add a new code, but as Synapse often is the testing bed for new MSC implementations, it makes sense to try it out first in the wild and then add it into the spec if it is successful. Thus this PR return a new M_USER_DEACTIVATED code when a deactivated user attempts to login.
* | Remove non-functional 'expire_access_token' setting (#5782)Richard van der Hoff2019-07-301-23/+5
| | | | | | | | | | | | | | | | The `expire_access_token` didn't do what it sounded like it should do. What it actually did was make Synapse enforce the 'time' caveat on macaroons used as access tokens, but since our access token macaroons never contained such a caveat, it was always a no-op. (The code to add 'time' caveats was removed back in v0.18.5, in #1656)
* | Replace returnValue with return (#5736)Amber Brown2019-07-232-25/+21
|/
* Ignore redactions of m.room.create events (#5701)Richard van der Hoff2019-07-171-15/+0
|
* Return a different error from Invalid Password when a user is deactivated ↵Andrew Morgan2019-07-151-0/+16
| | | | | (#5674) Return `This account has been deactivated` instead of `Invalid password` when a user is deactivated.
* Implement access token expiry (#5660)Richard van der Hoff2019-07-122-1/+19
| | | | Record how long an access token is valid for, and raise a soft-logout once it expires.
* Clean up exception handling for access_tokens (#5656)Richard van der Hoff2019-07-112-89/+71
| | | | | | | | | | | | | | | | First of all, let's get rid of `TOKEN_NOT_FOUND_HTTP_STATUS`. It was a hack we did at one point when it was possible to return either a 403 or a 401 if the creds were missing. We always return a 401 in these cases now (thankfully), so it's not needed. Let's also stop abusing `AuthError` for these cases. Honestly they have nothing that relates them to the other places that `AuthError` is used, other than the fact that they are loosely under the 'Auth' banner. It makes no sense for them to share exception classes. Instead, let's add a couple of new exception classes: `InvalidClientTokenError` and `MissingClientTokenError`, for the `M_UNKNOWN_TOKEN` and `M_MISSING_TOKEN` cases respectively - and an `InvalidClientCredentialsError` base class for the two of them.
* Run Black. (#5482)Amber Brown2019-06-207-337/+231
|
* Merge pull request #5363 from ↵Brendan Abolivier2019-06-101-2/+13
|\ | | | | | | | | matrix-org/babolivier/account_validity_send_mail_auth Don't check whether the user's account is expired on /send_mail requests
| * Better wordingBrendan Abolivier2019-06-101-1/+1
| |
| * DocBrendan Abolivier2019-06-101-0/+5
| |
| * Don't check whether the user's account is expired on /send_mail requestsBrendan Abolivier2019-06-051-2/+8
| |
* | Add ability to perform password reset via email without trusting the ↵Andrew Morgan2019-06-061-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | identity server (#5377) Sends password reset emails from the homeserver instead of proxying to the identity server. This is now the default behaviour for security reasons. If you wish to continue proxying password reset requests to the identity server you must now enable the email.trust_identity_server_for_password_resets option. This PR is a culmination of 3 smaller PRs which have each been separately reviewed: * #5308 * #5345 * #5368
* | Implement room v5 which enforces signing key validityRichard van der Hoff2019-06-051-5/+5
| | | | | | | | | | Implements [MSC2077](https://github.com/matrix-org/matrix-doc/pull/2077) and fixes #5247 and #4364.
* | Add a test room version where we enforce key validity (#5348)Richard van der Hoff2019-06-051-7/+13
| |
* | Implement the SHHS complexity API (#5216)Amber Brown2019-05-301-0/+1
| |
* | Add config option for setting homeserver's default room version (#5223)Andrew Morgan2019-05-231-4/+0
| | | | | | | | | | Replaces DEFAULT_ROOM_VERSION constant with a method that first checks the config, then returns a hardcoded value if the option is not present. That hardcoded value is now located in the server.py config file.
* | Room Statistics (#4338)Amber Brown2019-05-211-0/+1
| |
* | Introduce room v4 which updates event ID format. (#5217)Richard van der Hoff2019-05-211-4/+4
| | | | | | Implements https://github.com/matrix-org/matrix-doc/pull/2002.
* | Fix error handling for rooms whose versions are unknown. (#5219)Richard van der Hoff2019-05-211-1/+15
| | | | | | | | | | | | | | If we remove support for a particular room version, we should behave more gracefully. This should make client requests fail with a 400 rather than a 500, and will ignore individiual PDUs in a federation transaction, rather than the whole transaction.
* | Add a test room version which updates event ID format (#5210)Richard van der Hoff2019-05-201-2/+11
| | | | | | Implements MSC1884
* | Rename relation types to match MSCErik Johnston2019-05-201-2/+2
| |
* | Merge pull request #5209 from matrix-org/erikj/reactions_baseErik Johnston2019-05-201-0/+8
|\ \ | | | | | | Land basic reaction and edit support.
| * | Add simple send_relation API and track in DBErik Johnston2019-05-151-0/+8
| | |
* | | Limit UserIds to a length that fits in a state key (#5198)ReidAnderson2019-05-201-0/+3
| |/ |/|
* | Drop support for v2_alpha API prefix (#5190)Richard van der Hoff2019-05-151-2/+1
|/
* Do checks on aliases for incoming m.room.aliases events (#5128)Brendan Abolivier2019-05-081-0/+3
| | | | | Follow-up to #5124 Also added a bunch of checks to make sure everything (both the stuff added on #5124 and this PR) works as intended.
* Factor out an "assert_requester_is_admin" function (#5120)Richard van der Hoff2019-05-021-1/+1
| | | | Rather than copying-and-pasting the same four lines hundreds of times
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-04-174-43/+95
|\ | | | | | | babolivier/account_expiration
| * Merge pull request #5047 from matrix-org/babolivier/account_expirationBrendan Abolivier2019-04-171-2/+3
| |\ | | | | | | Send out emails with links to extend an account's validity period
| * | Remove periods from copyright headers (#5046)Andrew Morgan2019-04-113-3/+3
| | |
| * | Merge pull request #5027 from matrix-org/babolivier/account_expirationBrendan Abolivier2019-04-092-0/+13
| |\ \ | | | | | | | | Add time-based account expiration
| * | | Transfer related groups on room upgrade (#4990)Andrew Morgan2019-04-021-0/+1
| | | | | | | | | | | | Transfers the m.room.related_groups state event on room upgrade.
| * | | Collect room-version variations into one place (#4969)Richard van der Hoff2019-04-012-40/+91
| | | | | | | | | | | | | | | | Collect all the things that make room-versions different to one another into one place, so that it's easier to define new room versions.
* | | | Add management endpoints for account validityBrendan Abolivier2019-04-171-1/+1
| |_|/ |/| |
* | | Send out emails with links to extend an account's validity periodBrendan Abolivier2019-04-171-2/+3
| |/ |/|
* | Add account expiration featureBrendan Abolivier2019-04-092-0/+13
|/
* Support 3PID login in password providers (#4931)Andrew Morgan2019-03-261-11/+11
| | | | | Adds a new method, check_3pid_auth, which gives password providers the chance to allow authentication with third-party identifiers such as email or msisdn.
* Enforce hs_disabled_message correctlyRichard van der Hoff2019-03-191-3/+5
| | | | | Fixes a bug where hs_disabled_message was not enforced for 3pid-based requests if there was no server_notices_mxid configured.
* Add ratelimiting on login (#4821)Brendan Abolivier2019-03-151-0/+12
| | | Add two ratelimiters on login (per-IP address and per-userID).