summary refs log tree commit diff
path: root/synapse/storage (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-06-28Merge pull request from GHSA-22p3-qrh9-cx32reivilibre2-24/+56
* 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>
2022-06-14Fix incorrect link in changelog.Patrick Cloke1-1/+1
2022-06-14Fixup upgrades v1.61.0Erik Johnston1-3/+3
2022-06-14Update changelogErik Johnston1-3/+6
2022-06-141.61.0Erik Johnston4-2/+16
2022-06-14Mention removed community/group worker endpoints in upgrade.md (#13023)Sami Olmari2-0/+19
2022-06-07Correct typographical errors in the changelog v1.61.0rc1Olivier Wilkinson (reivilibre)1-2/+2
2022-06-071.61.0rc1Olivier Wilkinson (reivilibre)77-77/+92
2022-06-07Fix Debian changelogOlivier Wilkinson (reivilibre)1-2/+1
2022-06-07Prevent breaking old sqlite's when media retention is enabled (#12977)Andrew Morgan2-1/+2
2022-06-07Prevent local quarantined media from being claimed by media retention (#12972)Andrew Morgan6-29/+185
2022-06-06Remove remaining pieces of groups code. (#12966)Patrick Cloke8-209/+6
* Remove an unused stream ID generator. * Remove the now unused remote profile cache.
2022-06-06Reduce state pulled from DB due to sending typing and receipts over ↵Erik Johnston9-16/+68
federation (#12964) Reducing the amount of state we pull from the DB is useful as fetching state is expensive in terms of DB, CPU and memory.
2022-06-06Do not break URL previews if an image is unreachable. (#12950)Patrick Cloke3-6/+53
Avoid breaking a URL preview completely if the chosen image 404s or is unreachable for some other reason (e.g. DNS).
2022-06-06Implement MSC3816, consider the root event for thread participation. (#12766)Patrick Cloke3-47/+97
As opposed to only considering a user to have "participated" if they replied to the thread.
2022-06-06Allow updating passwords using the admin api without logging out devices ↵Jan Christian Grünhage3-2/+11
(#12952)
2022-06-06Reduce the amount of state we pull from the DB (#12811)Erik Johnston23-146/+161
2022-06-03Remove groups code from synapse_port_db. (#12899)Patrick Cloke3-15/+18
2022-06-03Improve URL previews for some pages (#12951)Patrick Cloke3-18/+72
* Skip `og` and `meta` tags where the value is empty. * Fallback to the favicon if there are no other images. * Ignore tags meant for navigation.
2022-06-01Wait for lazy join to complete when getting current state (#12872)Erik Johnston33-82/+361
2022-06-01Fix complement tests using the wrong path (#12933)Michael Telatynski2-1/+2
2022-06-01Remove remaining bits of groups code. (#12936)Patrick Cloke19-35/+1
* 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.
2022-06-01Remove direct refeferences to PyNaCl (use signedjson instead). (#12902)Jacek Kuśnierz6-20/+12
2022-06-01Fix 404 on `/sync` when the last event is a redaction of an unknown/purged ↵Richard van der Hoff6-65/+129
event (#12905) Currently, we try to pull the event corresponding to a sync token from the database. However, when we fetch redaction events, we check the target of that redaction (because we aren't allowed to send redactions to clients without validating them). So, if the sync token points to a redaction of an event that we don't have, we have a problem. It turns out we don't really need that event, and can just work with its ID and metadata, which sidesteps the whole problem.
2022-06-01Fix potential thumbnail memory leaks. (#12932)Erik Johnston3-135/+202
2022-05-31Remove most groups datastore code. (#12895)Patrick Cloke3-1396/+7
The remaining piece is a background update that is needed for backwards compatibility.
2022-05-31Improve logging when signature checks fail (#12925)Richard van der Hoff4-65/+95
* Raise a dedicated `InvalidEventSignatureError` from `_check_sigs_on_pdu` * Downgrade logging about redactions to DEBUG this can be very spammy during a room join, and it's not very useful. * Raise `InvalidEventSignatureError` from `_check_sigs_and_hash` ... and, more importantly, move the logging out to the callers. * changelog
2022-05-31Remove groups replication code. (#12900)Patrick Cloke7-90/+1
The replication logic for groups is no longer used, so the message passing infrastructure can be removed.
2022-05-31Add config options for media retention (#12732)Andrew Morgan5-2/+353
2022-05-31Faster room joins: Resume state re-syncing after a Synapse restart (#12813)Sean Quah3-2/+53
Signed-off-by: Sean Quah <seanq@matrix.org>
2022-05-31Faster room joins: Try other destinations when resyncing the state of a ↵Sean Quah4-9/+94
partial-state room (#12812) Signed-off-by: Sean Quah <seanq@matrix.org>
2022-05-31Update changelogErik Johnston1-2/+2
2022-05-31Test Synapse against Complement with workers. (#12810)reivilibre3-20/+66
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-05-31Reduce DB load of /sync when using presence (#12885)Erik Johnston2-27/+49
While the query was fast, we were calling it *a lot*.
2022-05-31Stop reading from `event_edges.room_id`. (#12914)Richard van der Hoff4-24/+22
event_edges.room_id is implied by the event id, so there is no need to join on the room id.
2022-05-311.60.0 v1.60.0Erik Johnston4-4/+18
2022-05-31Rename storage classes (#12913)Erik Johnston53-551/+708
2022-05-31Rework stream token to stop caring about groups. (#12897)Patrick Cloke3-3/+8
2022-05-31Fix import in module_api module and docs on the new check_event_for_spam ↵Brendan Abolivier8-78/+66
signature (#12918) Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-05-31Fix M_USER_ACCOUNT_SUSPENDED error code for spec compliance (#12923)Travis Ralston3-2/+3
2022-05-30Revert "Fix M_USER_ACCOUNT_SUSPENDED error code for spec compliance (#12922)"Travis Ralston3-3/+2
This reverts commit e0fae823e9938618a260adadb82bfee6e4c2f907.
2022-05-31Fix M_USER_ACCOUNT_SUSPENDED error code for spec compliance (#12922)Travis Ralston3-2/+3
`M_` is a reserved namespace.
2022-05-30Don't return `end` from `/messages` if there are no more events (#12903)Jacek Kuśnierz2-6/+18
Signed-off-by: Jacek Kusnierz <jacek.kusnierz@tum.de>
2022-05-30Document the Synapse version of a new module API method (#12917)Brendan Abolivier2-1/+7
2022-05-30Uniformize spam-checker API, part 3: Expand check_event_for_spam with the ↵David Teller5-17/+43
ability to return additional fields (#12846) Signed-off-by: David Teller <davidt@element.io>
2022-05-30demo: check if we are in a virtualenv before overriding PYTHONPATH (#12916)Mathieu Velten2-5/+7
2022-05-30Add a migration step to cleanup potential leftovers of bug 11833 (#12784)Mathieu Velten2-0/+20
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
2022-05-30Fix invite notifications for users without pushers (#12840)DeepBlueV7.X4-12/+96
Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de> Co-authored-by: Brendan Abolivier <github@brendanabolivier.com>
2022-05-30Fix `get_metadata_for_events` (#12904)Richard van der Hoff2-2/+3
This method was introduced in #12852. It is using the `state_key` column from the `events` table, which is not (yet) reliable (see #11496).
2022-05-30Remove unused `contrib/experiments/cursesio.py` (#12910)David Robertson2-165/+1
2022-05-30Remove `contrib/experiments/test_messaging.py` (#12911)David Robertson2-367/+1
2022-05-30Remove contrib/jitsimeetbridge (#12909)David Robertson12-5549/+8
2022-05-30Remove contrib/scripts/kick_users.py (#12908)David Robertson2-88/+1
2022-05-30Bump jsonschema stubs (#12912)David Robertson3-5/+11
2022-05-30Mutual rooms: Remove dependency on user directory (#12836)Jonathan de Jong5-58/+27
2022-05-30LockStore: fix acquiring a lock via `LockStore.try_acquire_lock` (#12832)Sumner Evans3-1/+73
Signed-off-by: Sumner Evans <sumner@beeper.com>
2022-05-27Add a background job to automatically delete stale devices (#12855)Brendan Abolivier6-1/+135
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-05-27Add code M_USER_ACCOUNT_SUSPENDED, as per MSC3823. (#12845)David Teller2-0/+8
Signed-off-by: David Teller <davidt@element.io> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-05-27Clean-up some receipts code (#12888)Patrick Cloke2-42/+48
* Properly marks private methods as private. * Adds missing docstrings. * Rework inline methods.
2022-05-27Additional constants for EDU types. (#12884)Patrick Cloke35-96/+146
Instead of hard-coding strings in many places.
2022-05-27Remove federation client code for groups. (#12563)Patrick Cloke2-483/+1
2022-05-27Add storage and module API methods to get monthly active users and their ↵Matt C4-0/+149
appservices (#12838)
2022-05-27Easy type hints in synapse.logging.opentracing (#12894)David Robertson4-57/+73
2022-05-271.60.0rc2 v1.60.0rc2Sean Quah6-5/+29
2022-05-27Close `ijson` coroutines ourselves instead of letting the GC close them (#12875)Sean Quah3-2/+19
Hopefully this means that exceptions raised due to truncated JSON get a sensible logging context and stack. Signed-off-by: Sean Quah <seanq@matrix.org>
2022-05-27Add an option allowing users to use their password to reauthenticate even ↵reivilibre6-12/+83
though password authentication is disabled. (#12883)
2022-05-27Fix room deletion (#12889)Richard van der Hoff2-9/+11
* Fix room deletion ae7858f broke room deletion by attempting to delete the entry from `rooms` before the tables that reference it. * faster_joins: remove database rows on purge
2022-05-27Refactor have_seen_events to reduce OOMs (#12886)Richard van der Hoff2-18/+25
My server is currently OOMing in the middle of have_seen_events, so let's try to fix that.
2022-05-26Improve URL previews by not including the content of media tags in the ↵reivilibre2-1/+10
generated description. (#12887)
2022-05-26Remove backing code for groups/communities (#12558)Patrick Cloke13-1894/+6
Including handlers, configuration code, appservice support, and the GroupID construct.
2022-05-26Bump pyjwt from 2.3.0 to 2.4.0 (#12865)dependabot[bot]2-3/+4
Bumps [pyjwt](https://github.com/jpadilla/pyjwt) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/jpadilla/pyjwt/releases) - [Changelog](https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jpadilla/pyjwt/compare/2.3.0...2.4.0) --- updated-dependencies: - dependency-name: pyjwt dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
2022-05-26Fix ambiguous column name that would prevent use of MSC2716 History Import ↵reivilibre2-1/+2
when using Postgres as a database. (#12843)
2022-05-26Remove unstable APIs for /hierarchy. (#12851)Patrick Cloke6-28/+16
Removes the unstable endpoint as well as a duplicated field which was modified during stabilization.
2022-05-26Avoid attempting to delete push actions for remote users. (#12879)Patrick Cloke5-4/+8
Remote users will never have push actions, so we can avoid a database round-trip/transaction completely.
2022-05-26Pull out less state when handling gaps mk2 (#12852)Erik Johnston8-127/+236
2022-05-25Allow bigger responses to `/federation/v1/state` (#12877)Richard van der Hoff4-32/+19
* Refactor HTTP response size limits Rather than passing a separate `max_response_size` down the stack, make it an attribute of the `parser`. * Allow bigger responses on `federation/v1/state` `/state` can return huge responses, so we need to handle that.
2022-05-25Fix up `state_store` naming (#12871)Erik Johnston15-49/+58
2022-05-25Remove user-visible groups/communities code (#12553)Patrick Cloke19-2217/+3
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.
2022-05-25Fix caching behavior for relations push rules. (#12859)Patrick Cloke3-9/+12
By always returning all requested values from the function wrapped by cachedList. Otherwise implicit None values get added into the cache, which are unexpected.
2022-05-25Misc clean-up of push rules datastore (#12856)Patrick Cloke2-11/+6
2022-05-25Correct typo in changelog for #12858.David Robertson1-1/+1
2022-05-25Add the `batch_send` endpoint to generic workers (#12868)Nick Mills-Barrett4-0/+5
2022-05-25Don't create empty AS txns when the AS is down (#12869)Nick Mills-Barrett2-1/+6
2022-05-25Add the `/account/whoami` endpoint to generic workers (#12866)Nick Mills-Barrett3-1/+4
2022-05-25Fix incorrect worker-allowed path in documentation (#12867)Nick Mills-Barrett2-3/+1
2022-05-25Make sure `prev_ids` defaults to empty list (#12829)Carl Bordum Hansen2-0/+5
Signed-off-by: Carl Bordum Hansen <carl@bordum.dk>
2022-05-25Fix typos in documentation (#12863)Dirk Klimpel4-3/+4
2022-05-24Correct annotation of `_iterate_over_text` (#12860)David Robertson2-1/+2
2022-05-24Fixes to MSC3787 implementation (#12858)David Robertson4-20/+21
2022-05-24Remove `dont_notify` from the `.m.rule.room.server_acl` rule (#12849)Šimon Brandner2-1/+2
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2022-05-24Add authentication to thirdparty bridge APIs (#12746)Will Hunt3-3/+115
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-05-24Experimental support for MSC3772 (#12740)Patrick Cloke10-6/+287
Implements the following behind an experimental configuration flag: * A new push rule kind for mutually related events. * A new default push rule (`.m.rule.thread_reply`) under an unstable prefix. This is missing part of MSC3772: * The `.m.rule.thread_reply_to_me` push rule, this depends on MSC3664 / #11804.
2022-05-24Update changelog v1.60.0rc1Sean Quah1-19/+19
2022-05-241.60.0rc1Sean Quah87-87/+119
2022-05-24contributing_guide.md: fix link to DCORichard van der Hoff1-2/+2
2022-05-24Pin poetry.core in Docker images (#12853)Erik Johnston2-1/+2
2022-05-23Marker events as state - MSC2716 (#12718)Eric Eastwood2-1/+26
Sending marker events as state now so they are always able to be seen by homeservers (not lost in some timeline gap). Part of [MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716) Complement tests: https://github.com/matrix-org/complement/pull/371 As initially discussed at https://github.com/matrix-org/matrix-spec-proposals/pull/2716#discussion_r782629097 and https://github.com/matrix-org/matrix-spec-proposals/pull/2716#discussion_r876684431 When someone joins a room, process all of the marker events we see in the current state. Marker events should be sent with a unique `state_key` so that they can all resolve in the current state to easily be discovered. Marker events as state - If we re-use the same `state_key` (like `""`), then we would have to fetch previous snapshots of state up through time to find all of the marker events. This way we can avoid all of that. This PR was originally doing this but then thought of the smarter way to tackle in an [out of band discussion with @erikjohnston](https://docs.google.com/document/d/1JJDuPfcPNX75fprdTWlxlaKjWOdbdJylbpZ03hzo638/edit#bookmark=id.sm92fqyq7vpp). - Also avoids state resolution conflicts where only one of the marker events win As a homeserver, when we see new marker state, we know there is new history imported somewhere back in time and should process it to fetch the insertion event where the historical messages are and set it as an insertion extremity. This way we know where to backfill more messages when someone asks for scrollback.
2022-05-23Uniformize spam-checker API, part 2: check_event_for_spam (#12808)David Teller10-31/+129
Signed-off-by: David Teller <davidt@element.io>
2022-05-23Prevent expired events from being filtered out when retention is disabled ↵Brendan Abolivier7-32/+71
(#12611) Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-05-23add SpamChecker callback for silently dropping inbound federated events (#12744)Jess Porter5-4/+108
Signed-off-by: jesopo <github@lolnerd.net>
2022-05-23Disable 'faster room join' Complement tests when testing against Synapse ↵reivilibre2-1/+9
with workers. (#12842)
2022-05-23Support registering Application Services when running with workers under ↵reivilibre4-1/+31
Complement. (#12826) Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-05-23Add some type hints to tests files (#12833)Dirk Klimpel7-23/+19
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2022-05-23Fix Complement `TestCanRegisterAdmin` with workers, by adding Complement's ↵reivilibre2-0/+7
shared registration secret. (#12819)
2022-05-23Add a windows->unix file endings commit to git blame ignore file (#12824)Andrew Morgan1-0/+3
2022-05-23Remove Caddy from the Synapse workers image used in Complement. (#12818)reivilibre7-93/+38
2022-05-23Fix media thumbnails being unusable before the index had been added in the ↵reivilibre2-0/+3
background. (#12823)
2022-05-20Send `USER_IP` commands on a different Redis channel, in order to reduce ↵reivilibre5-4/+17
traffic to workers that do not process these commands. (#12809)
2022-05-20Uniformize spam-checker API, part 1: the `Code` enum. (#12703)David Teller2-2/+10
2022-05-20Update EventContext `get_current_event_ids` and `get_prev_event_ids` to ↵Shay10-18/+65
accept state filters and update calls where possible (#12791)
2022-05-19Fix `RetryDestinationLimiter` re-starting finished log contexts (#12803)Sean Quah2-2/+3
Signed-off-by: Sean Quah <seanq@matrix.org>
2022-05-19Add a unit test for copying over arbitrary room types when upgrading a room ↵Andrew Morgan3-2/+33
(#12792)
2022-05-19Lay some foundation work to allow workers to only subscribe to some kinds of ↵reivilibre5-24/+173
messages, reducing replication traffic. (#12672)
2022-05-19Add detail to `cache_autotuning` config option documentation (#12776)Shay2-4/+11
2022-05-19Update configuration manual to document size-related suffixes (#12777)Shay2-0/+10
2022-05-19Properly close providers.json file stream. (#12794)Petr Vaněk2-3/+4
2022-05-19Add a unique index to `state_group_edges` to prevent duplicates being ↵reivilibre5-0/+139
accidentally introduced and the consequential impact to performance. (#12687)
2022-05-19hash_password: raise an error if no config file is specified (#12789)Jae Lo Presti2-5/+6
2022-05-19Simplify untyped-defs config in mypy.ini (#12790)David Robertson2-156/+18
2022-05-19Implement MSC3818: copy room type on upgrade (#12786)Aminda Suomalainen2-8/+9
Resolves: #11896 Signed-off-by: Aminda Suomalainen <suomalainen+git@mikaela.info>
2022-05-19Add missing user directory search endpoint to the generic worker ↵Sami Olmari2-0/+11
documentation (#12773) Signed-off-by: Sami Olmari <sami@olmari.fi>
2022-05-19openid.md: fix some linksRichard van der Hoff1-9/+9
docbook doesn't auto-linkify links
2022-05-18Downgrade some OIDC exceptions to warnings (#12723)David Robertson2-2/+3
2022-05-18Fix federation in demo scripts. (#12783)Patrick Cloke3-6/+11
2022-05-18Skip waiting for full state if a StateFilter does not require it (#12498)Richard van der Hoff2-4/+60
If `StateFilter` specifies a state set which we will have regardless of state-syncing, then we may as well return it immediately.
2022-05-18Fix YAML parsing error in `url_preview_accept_language` (#12785)Andrew Morgan2-6/+7
2022-05-18Refactor `resolve_state_groups_for_events` to not pull out full state when ↵Shay5-23/+40
no state resolution happens. (#12775)
2022-05-18Add documentation for cancellation of request processing (#12761)Sean Quah3-0/+394
Signed-off-by: Sean Quah <seanq@matrix.org>
2022-05-18Add some type hints to `event_federation` datastore (#12753)Dirk Klimpel5-65/+127
Co-authored-by: David Robertson <david.m.robertson1@gmail.com>
2022-05-18Do not keep going if there are 5 back-to-back background update failures. ↵reivilibre2-0/+9
(#12781)
2022-05-18Give a meaningful error message when a client tries to create a room with an ↵reivilibre3-0/+19
invalid alias localpart. (#12779)
2022-05-18Switch the 'Configuration' link in the docs homepage to the config manual ↵Andrew Morgan2-3/+4
(#12748)
2022-05-18Add some documentation around the `rc_invites` option to the config docs ↵Andrew Morgan2-0/+15
(#12759)
2022-05-18Fixup changelog v1.59.1Brendan Abolivier1-2/+4
2022-05-181.59.1Brendan Abolivier4-2/+16
2022-05-18Discard null-containing strings before updating the user directory (#12762)David Robertson6-11/+45
2022-05-18Discard null-containing strings before updating the user directory (#12762)David Robertson6-11/+45
2022-05-18Make handling of federation Authorization header (more) compliant with ↵Hubert Chathi4-5/+35
RFC7230 (#12774) The main differences are: - values with delimiters (such as colons) should be quoted, so always quote the origin, since it could contain a colon followed by a port number - should allow more than one space after "X-Matrix" - quoted values with backslash-escaped characters should be unescaped - names should be case insensitive
2022-05-18Move methods that call add_push_rule to PushRuleStore (#12772)Adam2-51/+52
Signed-off-by: Adam Roddick <ajroddick@tuta.io>
2022-05-17Suggest using docker when testing against postgres (#12765)David Robertson2-3/+29
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
2022-05-17Delete events from federation_inbound_events_staging table on purge (#12770)Mathieu Velten3-0/+3
2022-05-17allow `on_invalidate=None` in `@cached` methods (#12769)David Robertson3-10/+19
2022-05-17Add some type hints to datastore (#12717)Dirk Klimpel10-161/+254
2022-05-17Add a new room version for MSC3787's knock+restricted join rule (#12623)Travis Ralston6-7/+68
2022-05-17Remove code which updates `application_services_state.last_txn` (#12680)Richard van der Hoff5-55/+35
This column is unused as of #12209, so let's stop writing to it.
2022-05-17Fix push for m.read events (#12721)SpiritCroc2-1/+2
badge_count_last_call was always zero when the response for push notifications included a "rejected" key which mapped to an empty list.
2022-05-17Add index to cache invalidations (#12747)Erik Johnston3-0/+27
For workers that rarely write to the cache the `get_all_updated_caches` query can become expensive if the worker falls behind when reading the cache.
2022-05-17Track in memory events using weakrefs (#10533)Erik Johnston4-2/+60
2022-05-17version tweak in changelog v1.59.0David Robertson1-1/+1
2022-05-171.59.0David Robertson4-4/+21
2022-05-17Tidy up and type-hint the database engine modules (#12734)David Robertson7