Hannes Lerchl
7d99414edf
Replace pyjwt with authlib in org.matrix.login.jwt
( #13011 )
2022-06-15 16:45:16 +00:00
reivilibre
e12ff697a4
Sort failing jobs in Complement CI to the top of the logs to make them easier to read. ( #13057 )
2022-06-15 16:13:36 +00:00
Erik Johnston
de334ac183
Add a CI job to check that schema deltas are in the correct folder. ( #13063 )
2022-06-15 16:27:18 +01:00
David Robertson
97e9fbe1b2
Type annotations in synapse.databases.main.devices
( #13025 )
...
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-06-15 15:20:04 +00:00
Erik Johnston
0d1d3e0708
Speed up get_unread_event_push_actions_by_room
( #13005 )
...
Fixes #11887 hopefully.
The core change here is that `event_push_summary` now holds a summary of counts up until a much more recent point, meaning that the range of rows we need to count in `event_push_actions` is much smaller.
This needs two major changes:
1. When we get a receipt we need to recalculate `event_push_summary` rather than just delete it
2. The logic for deleting `event_push_actions` is now divorced from calculating `event_push_summary`.
In future it would be good to calculate `event_push_summary` while we persist a new event (it should just be a case of adding one to the relevant rows in `event_push_summary`), as that will further simplify the get counts logic and remove the need for us to periodically update `event_push_summary` in a background job.
2022-06-15 15:17:14 +00:00
Erik Johnston
9ad2197fa7
Rename complement-developonly ( #13046 )
2022-06-15 15:11:42 +00:00
reivilibre
212be2edc1
Use updated update_user_directory_from_worker
options in Complement tests. ( #13069 )
2022-06-15 15:54:32 +01:00
reivilibre
538044ac01
Collapse Docker build commands in Complement CI runs to make the logs easier to read. ( #13058 )
2022-06-15 14:42:27 +00:00
David Robertson
941dc3db13
Track a histogram of state res durations ( #13036 )
2022-06-15 15:19:49 +01:00
reivilibre
0dbdc39940
Fix a long-standing bug which meant that rate limiting was not restrictive enough in some cases. ( #13018 )
2022-06-15 14:11:55 +00:00
Brendan Abolivier
417f4cf40b
Don't use keyword arguments when initialising modules ( #13060 )
2022-06-15 15:36:16 +02:00
Richard van der Hoff
75fb10ee45
Clean up schema for event_edges
( #12893 )
...
* Remove redundant references to `event_edges.room_id`
We don't need to care about the room_id here, because we are already checking
the event id.
* Clean up the event_edges table
We make a number of changes to `event_edges`:
* We give the `room_id` and `is_state` columns defaults (null and false
respectively) so that we can stop populating them.
* We drop any rows that have `is_state` set true - they should no longer
exist.
* We drop any rows that do not exist in `events` - these should not exist
either.
* We drop the old unique constraint on all the colums, which wasn't much use.
* We create a new unique index on `(event_id, prev_event_id)`.
* We add a foreign key constraint to `events`.
These happen rather differently depending on whether we are on Postgres or
SQLite. For SQLite, we just rebuild the whole table, copying only the rows we
want to keep. For Postgres, we try to do things in the background as much as
possible.
* Stop populating `event_edges.room_id` and `is_state`
We can just rely on the defaults.
2022-06-15 12:29:42 +01:00
David Robertson
a4ae1406d1
Fix typechecks against twisted trunk ( #13061 )
2022-06-15 11:49:58 +01:00
reivilibre
5b645ae2ad
Refactor entry points so that they all have a main
function. ( #13052 )
2022-06-14 17:41:06 +00:00
David Robertson
c99b511db9
Fix destination_is
errors seen in sentry. ( #13041 )
...
* Rename test_fedclient to match its source file
* Require at least one destination to be truthy
* Explicitly validate user ID in profile endpoint GETs
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-06-14 18:28:26 +01:00
Erik Johnston
aef398457f
Up complement time outs ( #13048 )
2022-06-14 17:59:06 +01:00
Brendan Abolivier
bdb6628dcf
Fix version number in spam checker callbacks doc ( #13047 )
2022-06-14 17:24:25 +02:00
Shay
493c2fc44a
Remove code generating comments in configuration file ( #12941 )
2022-06-14 07:53:42 -07:00
Patrick Cloke
5f4ecf759d
Rename delta to apply in the proper schema version. ( #13050 )
2022-06-14 14:34:04 +00:00
Quentin Gliech
fe1daad672
Move the "email unsubscribe" resource, refactor the macaroon generator & 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.
2022-06-14 09:12:08 -04:00
reivilibre
09a3c5ce0b
Fix Complement runs always being Postgres ( #13034 )
...
* Fix Complement runs always being Postgres
* Newsfile
Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
2022-06-14 13:13:35 +01:00
Sami Olmari
a542a92c57
Mention removed community/group worker endpoints in upgrade.md ( #13023 )
2022-06-14 11:35:22 +01:00
Quentin Gliech
92103cb2c8
Decouple synapse.api.auth_blocking.AuthBlocking
from synapse.api.auth.Auth
. ( #13021 )
2022-06-14 09:51:15 +01:00
David Teller
a164a46038
Uniformize spam-checker API, part 4: port other spam-checker callbacks to return Union[Allow, Codes]
. ( #12857 )
...
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-06-13 18:16:16 +00:00
Patrick Cloke
53b77b203a
Replace noop background updates with DELETE. ( #12954 )
...
Removes the `register_noop_background_update` and deletes the background
updates directly in a delta file.
2022-06-13 14:06:27 -04:00
Richard van der Hoff
f68b5e5773
Merge branch 'rav/simplify_event_auth_interface' into develop
2022-06-13 11:34:59 +01:00
Richard van der Hoff
a6173a16fe
changelog
2022-06-12 23:13:10 +01:00
David Robertson
cfff055fa2
Revert "Changelog"
...
This reverts commit ae09cc2ee4
.
This commit was intended for a different branch.
2022-06-10 19:33:21 +01:00
David Robertson
ae09cc2ee4
Changelog
2022-06-10 19:32:40 +01:00
David Robertson
4579445cc5
Add missing TOC link to poetry cheat sheet ( #13022 )
...
Missed by #12475 .
2022-06-10 15:47:49 +01:00
Patrick Cloke
84cd0fe4e2
Fix-up the contrib/graph scripts. ( #13013 )
...
* Clarifies comments and documentation.
* Adds type-hints.
* Fixes Python 3 compatibility (and runs pyupgrade).
* Updates for changes in Synapse internals.
2022-06-10 08:30:14 -04:00
Patrick Cloke
81608490e3
Stop depending on room_id
to be returned for children state in the hierarchy response. ( #12991 )
...
The `room_id` field was removed from MSC2946 before
it was accepted. It was initially kept for backwards compatibility
and should be removed now that the stable form of the API
is used.
This change only stops Synapse from validating that it is returned,
a future PR will remove returning it as part of the response.
2022-06-10 07:15:51 -04:00
reivilibre
3d1d510fa9
Enable testing against PostgreSQL databases in Complement CI. ( #12965 )
2022-06-09 14:16:34 +01:00
Patrick Cloke
1df22e16df
Fix example of running complement.sh. ( #12990 )
2022-06-09 07:21:15 -04:00
Richard van der Hoff
7c6b2204d1
Faster joins: add issue links to the TODOs ( #13004 )
...
... to help us keep track of these things
2022-06-09 10:13:03 +00:00
David Robertson
97053c9406
Type annotations for test_v2
( #12985 )
2022-06-09 09:48:04 +01:00
Nick Mills-Barrett
04ca3a52f6
Use READ COMMITTED isolation level when inserting read receipts ( #12957 )
2022-06-09 09:44:16 +01:00
Patrick Cloke
dd2d66b0c9
Move the (unstable) dir
parameter for /relations behind an experimental flag. ( #12984 )
...
MSC3715 defines this parameter, but the unstable version of it should be
behind an experimental flag.
2022-06-08 09:00:35 -04:00
reivilibre
3c8f1290b8
Use a GitHub form for issues rather than a hard-to-read, easy-to-ignore template. ( #12982 )
...
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-06-08 11:11:02 +00:00
reivilibre
67f51c84f8
Merge the Complement testing Docker images into a single, multi-purpose image. ( #12881 )
...
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-06-08 09:57:05 +00:00
James
c316fe8d4a
Docker Compose Worker Documentation and Examples ( #12737 )
2022-06-08 10:26:42 +01:00
Sean Quah
3c1c40d843
Clean up the test code for client disconnections ( #12929 )
...
* Reword failure message about `await_result=False`
* Use `reactor.advance()` instead of `reactor.pump()`
* Raise `AssertionError`s ourselves
* Un-instance method `_test_disconnect`
* Replace `ThreadedMemoryReactorClock` with `MemoryReactorClock`
2022-06-07 18:17:32 +01:00
David Robertson
586bfc6dc0
Use dummy fallback engines if imports fail ( #12979 )
2022-06-07 17:33:55 +01:00
Sean Quah
a10cc5f824
Test cancellation at every await
during request handling ( #12674 )
...
* Add tests for `/rooms/<room_id>/members` cancellation.
* Add tests for `/rooms/<room_id>/state` cancellation.
Signed-off-by: Sean Quah <seanq@element.io>
2022-06-07 17:14:47 +01:00
Olivier Wilkinson (reivilibre)
00d915b2a7
Merge branch 'master' into develop
2022-06-07 16:59:41 +01:00
Daniel Aloni
b5a3aecf18
Return the same error message from /login
when password is incorrect and when account doesn't exist. ( #12738 )
2022-06-07 14:58:48 +00:00
David Robertson
f30bcbd84a
Fix Synapse git info missing in version strings ( #12973 )
2022-06-07 15:24:11 +01:00
Erik Johnston
a7e506ddee
Reduce amount of state we pull out when attempting to send catchup PDUs. ( #12963 )
...
* Don't pull out state for catchup
* Newsfile
* Merge newsfile
2022-06-07 14:35:56 +01:00
Olivier Wilkinson (reivilibre)
495fbf5d63
1.61.0rc1
2022-06-07 13:18:02 +01:00
Patrick Cloke
d2fd7f7b5c
Fix a stale comment in get_room_version_id_txn. ( #12969 )
2022-06-07 07:44:31 -04:00
Patrick Cloke
9dc3293e0b
Consolidate the logic of delete_device/delete_devices. ( #12970 )
...
By always using delete_devices and sometimes passing a list
with a single device ID.
Previously these methods had gotten out of sync with each
other and it seems there's little benefit to the single-device
variant.
2022-06-07 07:43:35 -04:00
Andrew Morgan
c51f5b9592
Prevent breaking old sqlite's when media retention is enabled ( #12977 )
2022-06-07 11:28:08 +00:00
Andrew Morgan
a47636c570
Prevent local quarantined media from being claimed by media retention ( #12972 )
2022-06-07 10:53:47 +00:00
Patrick Cloke
f7baffd8ec
Remove remaining pieces of groups code. ( #12966 )
...
* Remove an unused stream ID generator.
* Remove the now unused remote profile cache.
2022-06-06 13:20:05 -04:00
Erik Johnston
44de53bb79
Reduce state pulled from DB due to sending typing and receipts over 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-06 16:46:11 +01:00
Patrick Cloke
148fe58a24
Do not break URL previews if an image is unreachable. ( #12950 )
...
Avoid breaking a URL preview completely if the chosen image 404s
or is unreachable for some other reason (e.g. DNS).
2022-06-06 07:46:04 -04:00
Patrick Cloke
1acc897c31
Implement MSC3816, consider the root event for thread participation. ( #12766 )
...
As opposed to only considering a user to have "participated" if they
replied to the thread.
2022-06-06 07:18:04 -04:00
Jan Christian Grünhage
fcd8703508
Allow updating passwords using the admin api without logging out devices ( #12952 )
2022-06-06 12:10:13 +01:00
Erik Johnston
e3163e2e11
Reduce the amount of state we pull from the DB ( #12811 )
2022-06-06 09:24:12 +01:00
Patrick Cloke
6b46c3eb3d
Remove groups code from synapse_port_db. ( #12899 )
2022-06-03 12:13:35 -04:00
Patrick Cloke
01df5bacac
Improve URL previews for some pages ( #12951 )
...
* 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-03 12:09:12 -04:00
Erik Johnston
888a29f412
Wait for lazy join to complete when getting current state ( #12872 )
2022-06-01 16:02:53 +01:00
Michael Telatynski
782cb7420a
Fix complement tests using the wrong path ( #12933 )
2022-06-01 15:57:09 +01:00
Patrick Cloke
7bc08f3201
Remove remaining bits of groups code. ( #12936 )
...
* 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-01 09:41:25 -04:00
Jacek Kuśnierz
88193f2125
Remove direct refeferences to PyNaCl (use signedjson instead). ( #12902 )
2022-06-01 07:32:35 -04:00
Richard van der Hoff
79dadf7216
Fix 404 on /sync
when the last event is a redaction of an unknown/purged 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-01 11:29:51 +00:00
Erik Johnston
5949ab86f8
Fix potential thumbnail memory leaks. ( #12932 )
2022-06-01 10:57:49 +00:00
Patrick Cloke
2e8763ec96
Remove most groups datastore code. ( #12895 )
...
The remaining piece is a background update that is needed
for backwards compatibility.
2022-05-31 20:28:17 -04:00
Richard van der Hoff
f0aec0abef
Improve logging when signature checks fail ( #12925 )
...
* 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-31 23:32:56 +01:00
Patrick Cloke
cf05258f76
Remove groups replication code. ( #12900 )
...
The replication logic for groups is no longer used, so the message
passing infrastructure can be removed.
2022-05-31 13:04:08 -04:00
Andrew Morgan
2fc787c341
Add config options for media retention ( #12732 )
2022-05-31 16:35:29 +00:00
Sean Quah
641908f72f
Faster room joins: Resume state re-syncing after a Synapse restart ( #12813 )
...
Signed-off-by: Sean Quah <seanq@matrix.org>
2022-05-31 15:15:08 +00:00
Sean Quah
2fba1076c5
Faster room joins: Try other destinations when resyncing the state of a partial-state room ( #12812 )
...
Signed-off-by: Sean Quah <seanq@matrix.org>
2022-05-31 15:50:29 +01:00
reivilibre
bf01e51554
Test Synapse against Complement with workers. ( #12810 )
...
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-05-31 13:02:00 +00:00
Erik Johnston
c8684e6792
Reduce DB load of /sync when using presence ( #12885 )
...
While the query was fast, we were calling it *a lot*.
2022-05-31 13:01:05 +00:00
Richard van der Hoff
5e17922ef7
Stop reading from event_edges.room_id
. ( #12914 )
...
event_edges.room_id is implied by the event id, so there is no need to join on the room id.
2022-05-31 13:51:49 +01:00
Erik Johnston
1e453053cb
Rename storage classes ( #12913 )
2022-05-31 12:17:50 +00:00
Patrick Cloke
e541bb9eed
Rework stream token to stop caring about groups. ( #12897 )
2022-05-31 07:42:50 -04:00
Travis Ralston
d0e40dfe29
Fix M_USER_ACCOUNT_SUSPENDED error code for spec compliance ( #12923 )
2022-05-31 08:42:18 +01:00
Travis Ralston
bcfdfeb65d
Revert "Fix M_USER_ACCOUNT_SUSPENDED error code for spec compliance ( #12922 )"
...
This reverts commit e0fae823e9
.
2022-05-30 20:29:40 -06:00
Travis Ralston
e0fae823e9
Fix M_USER_ACCOUNT_SUSPENDED error code for spec compliance ( #12922 )
...
`M_` is a reserved namespace.
2022-05-31 02:27:19 +00:00
Jacek Kuśnierz
c4f548e05d
Don't return end
from /messages
if there are no more events ( #12903 )
...
Signed-off-by: Jacek Kusnierz <jacek.kusnierz@tum.de>
2022-05-30 21:03:52 +01:00
Brendan Abolivier
cd9fc058de
Document the Synapse version of a new module API method ( #12917 )
2022-05-30 18:37:52 +02:00
David Teller
af7db19e1e
Uniformize spam-checker API, part 3: Expand check_event_for_spam with the ability to return additional fields ( #12846 )
...
Signed-off-by: David Teller <davidt@element.io>
2022-05-30 18:24:56 +02:00
Mathieu Velten
1fd1856afc
demo: check if we are in a virtualenv before overriding PYTHONPATH ( #12916 )
2022-05-30 15:41:24 +00:00
Mathieu Velten
7f92ac4c1c
Add a migration step to cleanup potential leftovers of bug 11833 ( #12784 )
...
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
2022-05-30 16:51:37 +02:00
DeepBlueV7.X
b10211871f
Fix invite notifications for users without pushers ( #12840 )
...
Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
Co-authored-by: Brendan Abolivier <github@brendanabolivier.com>
2022-05-30 13:14:43 +02:00
Richard van der Hoff
2480461879
Fix get_metadata_for_events
( #12904 )
...
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-30 10:51:09 +01:00
David Robertson
119938792b
Remove unused contrib/experiments/cursesio.py
( #12910 )
2022-05-30 10:47:54 +01:00
David Robertson
80bd614dac
Remove contrib/experiments/test_messaging.py
( #12911 )
2022-05-30 10:47:47 +01:00
David Robertson
563ef172ae
Remove contrib/jitsimeetbridge ( #12909 )
2022-05-30 10:47:40 +01:00
David Robertson
72df42078b
Remove contrib/scripts/kick_users.py ( #12908 )
2022-05-30 10:47:25 +01:00
David Robertson
796a0312e1
Bump jsonschema stubs ( #12912 )
2022-05-30 10:47:09 +01:00
Jonathan de Jong
6be4953b99
Mutual rooms: Remove dependency on user directory ( #12836 )
2022-05-30 10:05:31 +01:00
Sumner Evans
bda4600399
LockStore: fix acquiring a lock via LockStore.try_acquire_lock
( #12832 )
...
Signed-off-by: Sumner Evans <sumner@beeper.com>
2022-05-30 09:41:13 +01:00
Brendan Abolivier
28989cb301
Add a background job to automatically delete stale devices ( #12855 )
...
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-05-27 17:47:32 +02:00
David Teller
888eb736a1
Add code M_USER_ACCOUNT_SUSPENDED, as per MSC3823. ( #12845 )
...
Signed-off-by: David Teller <davidt@element.io>
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
2022-05-27 13:13:29 +00:00
Patrick Cloke
724e11d620
Clean-up some receipts code ( #12888 )
...
* Properly marks private methods as private.
* Adds missing docstrings.
* Rework inline methods.
2022-05-27 07:44:10 -04:00
Patrick Cloke
c52abc1cfd
Additional constants for EDU types. ( #12884 )
...
Instead of hard-coding strings in many places.
2022-05-27 07:14:36 -04:00
Patrick Cloke
d9f092285b
Remove federation client code for groups. ( #12563 )
2022-05-27 07:13:58 -04:00