summary refs log tree commit diff
path: root/scripts-dev/mypy_synapse_plugin.py (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-10-14Remember mappings when we bind a 3pid using the internal sydent bind API (#66)Andrew Morgan3-0/+16
https://github.com/matrix-org/synapse-dinsic/pull/51 added an option that would automatically bind a user's threepid to a configured identity server after they had registered. Unfortunately, when you bind threepids, ideally you would store that mapping in the database so that later on you can remove those mappings when you deactivate an account. We found that due the fact that we did not store these mappings, threepids were not unbound upon user account deactivation. This PR fixes the issue by creating the mappings again, meaning they will again be removed upon account deactivation.
2020-10-13"Freeze" a room when the last admin of that room leaves (#59)Andrew Morgan3-4/+302
If the last admin of a room departs, and thus the room no longer has any admins within it, we "freeze" the room. Freezing a room means that the power level required to do anything in the room (sending messages, inviting others etc) will require power level 100. At the moment, an admin can come back and unfreeze the room manually. The plan is to eventually make unfreezing of the room automatic on admin rejoin, though that will be in a separate PR. This *could* work in mainline, however if the admin who leaves is on a homeserver without this functionality, then the room isn't frozen. I imagine this would probably be pretty confusing to people. Part of this feature was allowing Synapse modules to send events, which has been implemented in mainline at https://github.com/matrix-org/synapse/pull/8479, and cherry-picked to the `dinsic` fork in 62c7b10. The actual freezing logic has been implemented here in the RoomAccessRules module.
2020-10-12Allow modules to create and send events into rooms (#8479)Andrew Morgan7-89/+299
This PR allows Synapse modules making use of the `ModuleApi` to create and send non-membership events into a room. This can useful to have modules send messages, or change power levels in a room etc. Note that they must send event through a user that's already in the room. The non-membership event limitation is currently arbitrary, as it's another chunk of work and not necessary at the moment. This commit has been cherry-picked from mainline.
2020-09-29Only assert valid next_link params when provided (#65)Andrew Morgan2-6/+10
Bug introduced in https://github.com/matrix-org/synapse-dinsic/commit/ff91a451b We were checking whether the `nextLink` param was valid, even if it wasn't provided. In that case, `nextLink` was `None`, which would clearly not be a valid URL. This would prevent password reset and other operations if `nextLink` was not provided and the `next_link_domain_whitelist` config option was in use.
2020-09-18Don't push if an user account has expired (#58)Mathieu Velten4-5/+40
2020-09-18Swap method calls in RoomAccessTestCase.test_change_rules (#64)Andrew Morgan2-5/+7
Swap these calls around, as the check for changing `restricted` to `unrestricted` will actually change `self.restricted_room` to an unrestricted room. Do that last, instead of first. Additionally add a comment with a warning.
2020-09-18Make all rooms noisy by default (#60)Mathieu Velten3-8/+17
2020-09-18Make AccessRules use the public rooms directory instead of checking a room's ↵Andrew Morgan10-116/+579
join rules on rule change (#63) This PR switches several conditions regarding room access rules to check against the status of the room's inclusion in the public room list instead of its join rules. The code includes a snapshot of https://github.com/matrix-org/synapse/pull/8292, which will likely change in time and need merging in again.
2020-09-11Override the power levels defaults, enforce mod requirement for invites, ↵Andrew Morgan3-7/+119
admin requirements for unknown state events (#61) This PR modifies the `RoomAccessRules` module, an implementation of `ThirdPartyEventRules`, to both: * Modify the default power levels when creating a room to set: - `invite` to be minimum PL50 - `state_default` to be minimum PL100 * Enforce this when creating the room.
2020-09-10RoomAccessRules cleanup (#62)Andrew Morgan3-149/+210
Various cleanups of the DINUM-specific `RoomAccessRules` module, including: * Type hints * Docstring cleanups * Some code cleanups
2020-09-09Add a config option for validating 'next_link' parameters against a domain ↵Andrew Morgan5-18/+218
whitelist (#8275) This is a config option ported over from DINUM's Sydent: https://github.com/matrix-org/sydent/pull/285 They've switched to validating 3PIDs via Synapse rather than Sydent, and would like to retain this functionality. This original purpose for this change is phishing prevention. This solution could also potentially be replaced by a similar one to https://github.com/matrix-org/synapse/pull/8004, but across all `*/submit_token` endpoint. This option may still be useful to enterprise even with that safeguard in place though, if they want to be absolutely sure that their employees don't follow links to other domains.
2020-09-08Add types to async_helpers (#8260)Patrick Cloke3-51/+88
2020-09-08Fix mypy error on develop (#8282)Erik Johnston2-3/+7
2020-09-08Include method in thumbnail media name (#7124)DeepBlueV7.X6-1/+181
This fixes an issue where different methods (crop/scale) overwrite each other. This first tries the new path. If that fails and we are looking for a remote thumbnail, it tries the old path. If that still isn't found, it continues as normal. This should probably be removed in the future, after some of the newer thumbnails were generated with the new path on most deployments. Then the overhead should be minimal if the other thumbnails need to be regenerated. Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
2020-09-08Add types to StreamToken and RoomStreamToken (#8279)Erik Johnston5-91/+95
The intention here is to change `StreamToken.room_key` to be a `RoomStreamToken` in a future PR, but that is a big enough change without this refactoring too.
2020-09-08Add a config option for validating 'next_link' parameters against a domain ↵Andrew Morgan5-17/+204
whitelist (#8275) This is a config option ported over from DINUM's Sydent: https://github.com/matrix-org/sydent/pull/285 They've switched to validating 3PIDs via Synapse rather than Sydent, and would like to retain this functionality. This original purpose for this change is phishing prevention. This solution could also potentially be replaced by a similar one to https://github.com/matrix-org/synapse/pull/8004, but across all `*/submit_token` endpoint. This option may still be useful to enterprise even with that safeguard in place though, if they want to be absolutely sure that their employees don't follow links to other domains.
2020-09-08Fix /notifications and pushers misbehaving because of unread counts (#8280)Brendan Abolivier2-2/+4
2020-09-08Clean up types for PaginationConfig (#8250)Erik Johnston7-86/+52
This removes `SourcePaginationConfig` and `get_pagination_rows`. The reasoning behind this is that these generic classes/functions erased the types of the IDs it used (i.e. instead of passing around `StreamToken` it'd pass in e.g. `token.room_key`, which don't have uniform types).
2020-09-08Use the right constructor for log records (#8278)Richard van der Hoff2-3/+4
Update `log_function` to use the right factory to create log records, to make sure that they have `request` attributes. Fixes: #8267.
2020-09-08Fix `MultiWriterIdGenerator.current_position`. (#8257)Erik Johnston3-6/+88
It did not correctly handle IDs finishing being persisted out of order, resulting in the `current_position` lagging until new IDs are persisted.
2020-09-08fix typo v1.20.0rc1Richard van der Hoff1-1/+1
2020-09-08s/fixes/fix/Richard van der Hoff1-2/+2
2020-09-081.20.0rc1Richard van der Hoff116-123/+80
2020-09-08Directly import json from the standard library. (#8259)Patrick Cloke5-6/+7
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.
2020-09-08Allow for make_awaitable's return value to be re-used. (#8261)Patrick Cloke12-70/+56
2020-09-08Rename 'populate_stats_process_rooms_2' background job back to ↵Andrew Morgan4-39/+35
'populate_stats_process_rooms' again (#8243) Fixes https://github.com/matrix-org/synapse/issues/8238 Alongside the delta file, some changes were also necessary to the codebase to remove references to the now defunct `populate_stats_process_rooms_2` background job. Thankfully the latter doesn't seem to have made it into any documentation yet :)
2020-09-08Systemd docs: configure workers to start after main process. (#8276)Richard van der Hoff2-0/+6
2020-09-07Only add rows to the push actions table if the event notifies or should be ↵Brendan Abolivier2-1/+7
marked unread (#8274)
2020-09-07Fix stack overflow when logging system encounters an error (#8268)Richard van der Hoff2-2/+24
2020-09-07Avoid table-scanning users at startup (#8271)Richard van der Hoff2-11/+15
This takes about 10 seconds in the best case; often more.
2020-09-07Fix unread count failing on NULL values (#8270)Brendan Abolivier2-1/+7
Fix unread counts making sync fail if the value of the `unread_count` column in `event_push_summary` is `None`.
2020-09-07Add more logging to debug slow startup (#8264)Richard van der Hoff5-7/+33
I'm hoping this will provide some pointers for debugging https://github.com/matrix-org/synapse/issues/7968.
2020-09-07Refuse to upgrade database on worker processes (#8266)Richard van der Hoff2-17/+62
2020-09-07Bump canonicaljson to version 1.4.0 (#8262)Alexandre Morignot2-1/+2
The version 1.3.0 has a bug with unicode charecters: ``` >>> from canonicaljson import encode_pretty_printed_json >>> encode_pretty_printed_json({'a': 'à'}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/erdnaxeli/.pyenv/versions/3.6.7/lib/python3.6/site-packages/canonicaljson.py", line 96, in encode_pretty_printed_json return _pretty_encoder.encode(json_object).encode("ascii") UnicodeEncodeError: 'ascii' codec can't encode character '\xe0' in position 12: ordinal not in range(128) ``` Signed-off-by: Alexandre Morignot <erdnaxeli@cervoi.se> Co-authored-by: Alexandre Morignot <erdnaxeli@cervoi.se>
2020-09-07Run database updates in a transaction (#8265)Richard van der Hoff2-5/+23
Fixes: #6467
2020-09-07Add tests for `last_successful_stream_ordering` (#8258)reivilibre2-0/+77
2020-09-04In light of #8255, use BIGINTs for destination_rooms (#8256)reivilibre2-1/+2
2020-09-04Catch up after Federation Outage (split, 2): Track last successful stream ↵reivilibre4-0/+71
ordering after transmission (#8247) Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2020-09-04Add cross-signing sigs to the `keys` object (#8234)Richard van der Hoff3-34/+18
All the callers want this info in the same place, so let's reduce the duplication by doing it here.
2020-09-04Unread counts fixes (#8254)Brendan Abolivier3-4/+5
* Fixup `ALTER TABLE` database queries Make the new columns nullable, because doing otherwise can wedge a server with a big database, as setting a default value rewrites the table. * Switch back to using the notifications count in the push badge Clients are likely to be confused if we send a push but the badge count is the unread messages one, and not the notifications one. * Changelog
2020-09-04Fix a regression from calling read_templates. (#8252)Patrick Cloke2-1/+2
Regressed in #8037.
2020-09-04Catch-up after Federation Outage (split, 1) (#8230)reivilibre7-7/+201
Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
2020-09-04Fix type signature in simple_select_one_onecol and friends (#8241)reivilibre2-10/+8
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2020-09-04Stop sub-classing object (#8249)Patrick Cloke168-292/+293
2020-09-04Revert "Add experimental support for sharding event persister. (#8170)" (#8242)Brendan Abolivier19-206/+78
* Revert "Add experimental support for sharding event persister. (#8170)" This reverts commit 82c1ee1c22a87b9e6e3179947014b0f11c0a1ac3. * Changelog
2020-09-03Add type hints to more handlers (#8244)Erik Johnston5-79/+110
2020-09-03Remove obsolete order field in `send_new_transaction` (#8245)reivilibre4-28/+23
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2020-09-03Split fetching device keys and signatures into two transactions (#8233)Richard van der Hoff2-44/+66
I think this is simpler (and moves stuff out of the db threads)
2020-09-03Fix typing for `@cached` wrapped functions (#8240)Erik Johnston5-20/+121
This requires adding a mypy plugin to fiddle with the type signatures a bit.
2020-09-03Remove useless changelog about reverting a #8239.Patrick Cloke1-1/+0
2020-09-03Revert pinning of setuptools (#8239)Patrick Cloke4-6/+2
2020-09-03Fix typing for SyncHandler (#8237)Erik Johnston4-10/+13
2020-09-03wrap `_get_e2e_device_keys_and_signatures_txn` in a non-txn method (#8231)Richard van der Hoff3-17/+40
We have three things which all call `_get_e2e_device_keys_and_signatures_txn` with their own `runInteraction`. Factor out the common code.
2020-09-02Add an overload for simple_select_one_onecol_txn. (#8235)Patrick Cloke2-0/+25
2020-09-02Convert runInteraction to async/await (#8156)Patrick Cloke2-15/+15
2020-09-02Add StreamStore to mypy (#8232)Erik Johnston5-20/+66
2020-09-02Re-implement unread counts (again) (#8059)Brendan Abolivier12-122/+457
2020-09-02Remove duplicated error definitions, likely due to mergeAndrew Morgan1-7/+0
2020-09-02Refactor `_get_e2e_device_keys_for_federation_query_txn` (#8225)Richard van der Hoff2-11/+7
We can use the existing `_get_e2e_device_keys_and_signatures_txn` instead of creating our own txn function
2020-09-02Add experimental support for sharding event persister. (#8170)Erik Johnston18-77/+206
This is *not* ready for production yet. Caveats: 1. We should write some tests... 2. The stream token that we use for events can get stalled at the minimum position of all writers. This means that new events may not be processed and e.g. sent down sync streams if a writer isn't writing or is slow.
2020-09-02Add /user/{user_id}/shared_rooms/ api (#7785)Will Hunt8-1/+270
* Add shared_rooms api * Add changelog * Add . * Wrap response in {"rooms": } * linting * Add unstable_features key * Remove options from isort that aren't part of 5.x `-y` and `-rc` are now default behaviour and no longer exist. `dont-skip` is no longer required https://timothycrosley.github.io/isort/CHANGELOG/#500-penny-july-4-2020 * Update imports to make isort happy * Add changelog * Update tox.ini file with correct invocation * fix linting again for isort * Vendor prefix unstable API * Fix to match spec * import Codes * import Codes * Use FORBIDDEN * Update changelog.d/7785.feature Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Implement get_shared_rooms_for_users * a comma * trailing whitespace * Handle the easy feedback * Switch to using runInteraction * Add tests * Feedback * Seperate unstable endpoint from v2 * Add upgrade node * a line * Fix style by adding a blank line at EOF. * Update synapse/storage/databases/main/user_directory.py Co-authored-by: Tulir Asokan <tulir@maunium.net> * Update synapse/storage/databases/main/user_directory.py Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Update UPGRADE.rst Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Fix UPGRADE/CHANGELOG unstable paths unstable unstable unstable Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Co-authored-by: Tulir Asokan <tulir@maunium.net> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Tulir Asokan <tulir@maunium.net>
2020-09-02Do not try to store invalid data in the stats table (#8226)Patrick Cloke2-8/+27
2020-09-02Convert the main methods run by the reactor to async. (#8213)Patrick Cloke3-21/+18
2020-09-02Make _get_e2e_device_keys_and_signatures_txn return an attrs (#8224)Richard van der Hoff3-20/+41
this makes it a bit clearer what's going on.
2020-09-01Fix errors when updating the user directory with invalid data (#8223)Patrick Cloke4-1/+19
2020-09-01Explain better what GDPR-erased means (#8189)Brendan Abolivier2-3/+6
Fixes https://github.com/matrix-org/synapse/issues/8185
2020-09-01Convert additional databases to async/await part 3 (#8201)Patrick Cloke7-87/+121
2020-09-01Convert appservice code to async/await. (#8207)Patrick Cloke2-8/+12
2020-09-01Rename `_get_e2e_device_keys_txn` (#8222)Richard van der Hoff3-6/+9
... to `_get_e2e_device_keys_and_signatures_txn`, to better reflect what it does.
2020-09-01Convert additional databases to async/await (#8199)Patrick Cloke7-137/+147
2020-09-01Convert the well known resolver to async (#8214)Patrick Cloke5-34/+53
2020-09-01Convert additional databases to async/await part 2 (#8200)Patrick Cloke15-81/+111
2020-09-01Make MultiWriterIDGenerator work for streams that use negative stream IDs ↵Erik Johnston3-11/+134
(#8203) This is so that we can use it for the backfill events stream.
2020-09-01Do not install setuptools 50.0. (#8212)Patrick Cloke3-1/+6
This is due to compatibility issues with old Python versions.
2020-09-01Move and rename `get_devices_with_keys_by_user` (#8204)Richard van der Hoff6-49/+67
* Move `get_devices_with_keys_by_user` to `EndToEndKeyWorkerStore` this seems a better fit for it. This commit simply moves the existing code: no other changes at all. * Rename `get_devices_with_keys_by_user` to better reflect what it does. * get_device_stream_token abstract method To avoid referencing fields which are declared in the derived classes, make `get_device_stream_token` abstract, and define that in the classes which define `_device_list_id_gen`.
2020-08-29Rename `get_e2e_device_keys` to better reflect its purpose (#8205)Richard van der Hoff4-19/+14
... and to show that it does something slightly different to `_get_e2e_device_keys_txn`. `include_all_devices` and `include_deleted_devices` were never used (and `include_deleted_devices` was broken, since that would cause `None`s in the result which were not handled in the loop below. Add some typing too.
2020-08-29Add a comment about _LimitedHostnameResolverRichard van der Hoff1-0/+7
2020-08-28Convert ReadWriteLock to async/await. (#8202)Patrick Cloke4-33/+39
2020-08-28Fix incorrect return signatureAndrew Morgan1-1/+1
2020-08-28Fix `wait_for_stream_position` for multiple waiters. (#8196)Erik Johnston3-5/+6
This fixes a bug where having multiple callers waiting on the same stream and position will cause it to try and compare two deferreds, which fails (due to the sorted list having an entry of `Tuple[int, Deferred]`).
2020-08-28Convert `event_push_actions`, `registration`, and `roommember` datastores to ↵Patrick Cloke4-160/+169
async (#8197)
2020-08-28Only return devices with keys from `/federation/v1/user/devices/` (#8198)Richard van der Hoff2-3/+2
There's not much point in returning all the others, and some people have a silly number of devices.
2020-08-28Convert state and stream stores and related code to async (#8194)Patrick Cloke7-45/+51
2020-08-28Ensure that the OpenID Connect remote ID is a string. (#8190)Patrick Cloke3-2/+43
2020-08-28Convert additional database code to async/await. (#8195)Patrick Cloke11-175/+246
2020-08-28Define StateMap as immutable and add a MutableStateMap type. (#8183)Patrick Cloke8-32/+52
2020-08-28Move and refactor LoginRestServlet helper methods (#8182)Andrew Morgan3-55/+94
This is split out from https://github.com/matrix-org/synapse/pull/7438, which had gotten rather large. `LoginRestServlet` has a couple helper methods, `login_submission_legacy_convert` and `login_id_thirdparty_from_phone`. They're primarily used for converting legacy user login submissions to "identifier" dicts ([see spec](https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-login)). Identifying information such as usernames or 3PID information used to be top-level in the login body. They're now supposed to be put inside an [identifier](https://matrix.org/docs/spec/client_server/r0.6.1#identifier-types) parameter instead. #7438's purpose is to allow using the new identifier parameter during User-Interactive Authentication, which is currently handled in AuthHandler. That's why I've moved these helper methods there. I also moved the refactoring of these method from #7438 as they're relevant.
2020-08-27Do not yield on awaitables in tests. (#8193)Patrick Cloke15-131/+230
2020-08-27Convert stats and related calls to async/await (#8192)Patrick Cloke8-77/+78
2020-08-27Convert simple_delete to async/await. (#8191)Patrick Cloke5-37/+90
2020-08-27Convert calls of async database methods to async (#8166)Patrick Cloke14-84/+114
2020-08-27simple_search_list_txn should return None, not 0. (#8187)Patrick Cloke2-4/+4
2020-08-27Fix missing _add_persisted_position (#8179)Erik Johnston3-3/+52
This was forgotten in #8164.
2020-08-27Convert additional database methods to async (select list, search, ↵Patrick Cloke8-84/+67
insert_many, delete_*) (#8168)
2020-08-27Convert simple_update* and simple_select* to async (#8173)Patrick Cloke19-133/+164
2020-08-27Reduce run-times of tests by advancing the reactor less (#7757)Andrew Morgan7-8/+9
2020-08-271.19.1 v1.19.1 github/release-v1.19.1 release-v1.19.1Brendan Abolivier3-1/+13
2020-08-27Update debian systemd service to use Type=notify (#8169)Dexter Chua2-1/+7
This ensures systemctl start matrix-synapse returns only after synapse is actually started, which is very useful for automated deployments. Fixes #5761 Signed-off-by: Dexter Chua <dec41@srcf.net>
2020-08-26Remove remaining is_guest argument uses from get_room_data calls (#8181)Andrew Morgan2-10/+3
#8174 removed the `is_guest` parameter from `get_room_data`, at the same time that #8157 was merged using it, colliding together to break unit tests on develop. This PR removes the `is_guest` parameter from the call in the broken test. Uses the same changelog as #8174.
2020-08-26Do not propagate typing notifications from shadow-banned users. (#8176)Patrick Cloke6-24/+102
2020-08-26Remove unused parameter from, and add safeguard in, get_room_data (#8174)Andrew Morgan4-10/+14
Small cleanup PR. * Removed the unused `is_guest` argument * Added a safeguard to a (currently) impossible code path, fixing static checking at the same time.
2020-08-26Add required Debian dependencies to allow docker builds on the arm platform ↵Christopher May-Townsend2-3/+11
(#8144) Signed-off-by: Christopher May-Townsend <chris@maytownsend.co.uk>
2020-08-26Allow running mypy directly. (#8175)Patrick Cloke3-51/+51
2020-08-26Update the test federation client to handle streaming responses (#8130)Richard van der Hoff2-8/+28
Now that the server supports streaming back JSON responses, it would be nice to show the response as it is streamed, in the test tool.
2020-08-26Do not propagate profile changes of shadow-banned users into rooms. (#8157)Patrick Cloke5-160/+291
2020-08-26Make SlavedIdTracker.advance have same interface as MultiWriterIDGenerator ↵Erik Johnston12-15/+16
(#8171)
2020-08-26Convert simple_select_one and simple_select_one_onecol to async (#8162)Patrick Cloke25-113/+220
2020-08-26Fix rate limiting unit tests. (#8167)Patrick Cloke2-13/+15
These were passing on the release-v1.19.1 branch but started failing once merged to develop.
2020-08-25Add functions to `MultiWriterIdGen` used by events stream (#8164)Erik Johnston4-3/+145
2020-08-25Do not allow send_nonmember_event to be called with shadow-banned users. (#8158)Patrick Cloke2-5/+35
2020-08-25Changelog fixes v1.19.1rc1Brendan Abolivier1-1/+1
2020-08-251.19.1rc1Brendan Abolivier4-3/+11
2020-08-25Make StreamIdGen `get_next` and `get_next_mult` async (#8161)Erik Johnston14-49/+54
This is mainly so that `StreamIdGenerator` and `MultiWriterIdGenerator` will have the same interface, allowing them to be used interchangeably.
2020-08-25Wording fixes to 'name' user admin api filter (#8163)Andrew Morgan4-5/+7
Some fixes to wording I noticed after merging #7377.
2020-08-25Fix missing double-backtick in RST documentAndrew Morgan1-1/+1
2020-08-25Search in columns 'name' and 'displayname' in the admin users endpoint (#7377)Manuel Stahl4-15/+27
* Search in columns 'name' and 'displayname' in the admin users endpoint Signed-off-by: Manuel Stahl <manuel.stahl@awesome-technologies.de>
2020-08-24Add type hints for state. (#8140)Patrick Cloke10-203/+420
2020-08-24Stop shadow-banned users from sending non-member events. (#8142)Patrick Cloke8-42/+155
2020-08-24Allow capping a room's retention policy (#8104)Brendan Abolivier6-107/+127
2020-08-24Add healthcheck for default localhost 8008 port on /health endpoint. (#8147)Christopher May-Townsend3-0/+34
2020-08-24Fix flaky shadow-ban tests. (#8152)Patrick Cloke2-1/+4
2020-08-24Fix join ratelimiter breaking profile updates and idempotency (#8153)Brendan Abolivier4-25/+119
2020-08-24Do not apply ratelimiting on joins to appservices (#8139)Will Hunt4-6/+119
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>
2020-08-24Don't fail /submit_token requests on incorrect session ID if ↵Brendan Abolivier5-6/+68
request_token_inhibit_3pid_errors is turned on (#7991) * Don't raise session_id errors on submit_token if request_token_inhibit_3pid_errors is set * Changelog * Also wait some time before responding to /requestToken * Incorporate review * Update synapse/storage/databases/main/registration.py Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Incorporate review Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2020-08-21Do not apply ratelimiting on joins to appservices (#8139)Will Hunt4-6/+119
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>
2020-08-21Micro-optimisations to get_auth_chain_ids (#8132)Richard van der Hoff2-23/+18
2020-08-20Allow denying or shadow banning registrations via the spam checker (#8034)Patrick Cloke14-18/+258
2020-08-20Stop shadow-banned users from sending invites. (#8095)Patrick Cloke7-31/+226
2020-08-20Be more tolerant of membership events in unknown rooms (#8110)Richard van der Hoff3-6/+28
It turns out that not all out-of-band membership events are labelled as such, so we need to be more accepting here.
2020-08-20Improve the error code when trying to register using a name reserved for ↵Patrick Cloke2-1/+4
guests. (#8135)
2020-08-20Use the JSON encoder without whitespace in more places. (#8124)Patrick Cloke9-27/+21
2020-08-20Add more types to synapse.storage.database. (#8127)Patrick Cloke3-222/+367
2020-08-20Ensure a group ID is valid before trying to get rooms for it. (#8129)Patrick Cloke2-0/+5
2020-08-20Do not assume calls to runInteraction return Deferreds. (#8133)Patrick Cloke7-31/+41
2020-08-19Close the database connection we create during startup (#8131)Richard van der Hoff2-1/+11
... otherwise it gets leaked.
2020-08-19Remove `ChainedIdGenerator`. (#8123)Erik Johnston7-95/+26
It's just a thin wrapper around two ID gens to make `get_current_token` and `get_next` return tuples. This can easily be replaced by calling the appropriate methods on the underlying ID gens directly.
2020-08-19Switch the JSON byte producer from a pull to a push producer. (#8116)Patrick Cloke5-46/+53
2020-08-19Updated docs: Added note about missing 308 redirect support. (#8120)Ryan Cole2-0/+13
* Updated docs: Added note about missing 308 redirect support. * Added changelog
2020-08-19Be stricter about JSON that is accepted by Synapse (#8106)Patrick Cloke20-62/+85
2020-08-19Convert runWithConnection to async. (#8121)Patrick Cloke3-15/+15
2020-08-19Remove the unused inlineCallbacks code-paths in the caching code (#8119)Patrick Cloke3-52/+15
2020-08-19Separate `get_current_token` into two. (#8113)Erik Johnston6-20/+47
The function is used for two purposes: 1) for subscribers of streams to get a token they can use to get further updates with, and 2) for replication to track position of the writers of the stream. For streams with a single writer the two scenarios produce the same result, however the situation becomes complicated for streams with multiple writers. The current `MultiWriterIdGenerator` does not correctly handle the first case (which is not an issue as its only used for the `caches` stream which nothing subscribes to outside of replication).
2020-08-18Convert events worker database to async/await. (#8071)Patrick Cloke12-97/+106
2020-08-18TO REVERT: add user_id to presence response in client worker (#57)Mathieu Velten2-1