1
0
Commit Graph

2276 Commits

Author SHA1 Message Date
Andrew Morgan
687d30b2ed Merge commit 'c9c544cda' into anoa/dinsic_release_1_21_x
* commit 'c9c544cda':
  Remove `ChainedIdGenerator`. (#8123)
  Switch the JSON byte producer from a pull to a push producer. (#8116)
  Updated docs: Added note about missing 308 redirect support. (#8120)
  Be stricter about JSON that is accepted by Synapse (#8106)
  Convert runWithConnection to async. (#8121)
  Remove the unused inlineCallbacks code-paths in the caching code (#8119)
  Separate `get_current_token` into two. (#8113)
  Convert events worker database to async/await. (#8071)
  Add a link to the matrix-synapse-rest-password-provider. (#8111)
2020-10-19 19:12:39 +01:00
Andrew Morgan
1e9ec2afff Merge commit '3c01724b3' into anoa/dinsic_release_1_21_x
* commit '3c01724b3':
  Fix the return type of send_nonmember_events. (#8112)
  Remove : from allowed client_secret chars (#8101)
  Rename changelog from bugfix to misc.
  Iteratively encode JSON responses to avoid blocking the reactor. (#8013)
  Return the previous stream token if a non-member event is a duplicate. (#8093)
2020-10-19 18:35:07 +01:00
Andrew Morgan
25b077d747 Merge commit '050e20e7c' into anoa/dinsic_release_1_21_x
* commit '050e20e7c':
  Convert some of the general database methods to async (#8100)
2020-10-19 18:34:31 +01:00
Andrew Morgan
29506f5c50 Merge commit 'e04e465b4' into anoa/dinsic_release_1_21_x
* commit 'e04e465b4':
  Use the default templates when a custom template file cannot be found (#8037)
  Changelog changes
  Convert stream database to async/await. (#8074)
  Add a shadow-banned flag to users. (#8092)
  Convert pusher databases to async/await. (#8075)
  Convert receipts and events databases to async/await. (#8076)
2020-10-19 18:27:56 +01:00
Andrew Morgan
464db5f27d Merge commit 'dd8f28bd3' into anoa/dinsic_release_1_21_x
* commit 'dd8f28bd3':
  Fix unawaited coroutine error in tests. (#8072)
2020-10-19 18:24:39 +01:00
Andrew Morgan
1ab32bd9a7 Merge commit 'fbe930dad' into anoa/dinsic_release_1_21_x
* commit 'fbe930dad':
  Convert the roommember database to async/await. (#8070)
2020-10-19 18:24:35 +01:00
Andrew Morgan
78bcfa71db Merge commit '5ecc8b582' into anoa/dinsic_release_1_21_x
* commit '5ecc8b582':
  Convert devices database to async/await. (#8069)
2020-10-19 18:24:30 +01:00
Andrew Morgan
20bfb5390c Merge commit '5dd73d029' into anoa/dinsic_release_1_21_x
* commit '5dd73d029':
  Add type hints to handlers.message and events.builder (#8067)
2020-10-19 18:24:25 +01:00
Andrew Morgan
33d971bd03 Merge commit 'd68e10f30' into anoa/dinsic_release_1_21_x
* commit 'd68e10f30':
  Convert account data, device inbox, and censor events databases to async/await (#8063)
2020-10-19 18:24:11 +01:00
Andrew Morgan
d872d53c4d Merge commit 'a3a59bab7' into anoa/dinsic_release_1_21_x
* commit 'a3a59bab7':
  Convert appservice, group server, profile and more databases to async (#8066)
2020-10-19 18:23:58 +01:00
Andrew Morgan
13c1c20972 Merge commit '04faa0bfa' into anoa/dinsic_release_1_21_x
* commit '04faa0bfa':
  Convert tags and metrics databases to async/await (#8062)
2020-10-19 18:16:34 +01:00
Andrew Morgan
8857135bc6 Merge commit 'a0acdfa9e' into anoa/dinsic_release_1_21_x
* commit 'a0acdfa9e':
  Converts event_federation and registration databases to async/await (#8061)
2020-10-19 18:14:26 +01:00
Andrew Morgan
70c6f5065a Merge commit 'db131b6b2' into anoa/dinsic_release_1_21_x
* commit 'db131b6b2':
  Change the default log config to reduce disk I/O and storage (#8040)
  Implement login blocking based on SAML attributes (#8052)
  Add an assertion on prev_events in create_new_client_event (#8041)
  Typo
  Lint
  why mypy why
  Lint
  Incorporate review
  Incorporate review
  Fix PUT /pushrules to use the right rule IDs
  Back out the database hack and replace it with a temporary config setting
  Fix cache name
  Fix cache invalidation calls
  Lint
  Changelog
  Implement new experimental push rules with a database hack to enable them
2020-10-19 17:08:43 +01:00
Andrew Morgan
c5aaa80a96 Merge commit '7f837959e' into anoa/dinsic_release_1_21_x
* commit '7f837959e':
  Convert directory, e2e_room_keys, end_to_end_keys, monthly_active_users database to async (#8042)
  Convert additional database stores to async/await (#8045)
2020-10-19 17:06:53 +01:00
Andrew Morgan
9dd3b52f1b Merge commit '7620912d8' into anoa/dinsic_release_1_21_x
* commit '7620912d8':
  Add health check endpoint (#8048)
2020-10-19 17:06:32 +01:00
Andrew Morgan
d47db9e9e9 Merge commit '2ffd6783c' into anoa/dinsic_release_1_21_x
* commit '2ffd6783c':
  Revert #7736 (#8039)
2020-10-19 17:06:14 +01:00
Andrew Morgan
9e2cab71fe Merge commit 'fe6cfc80e' into anoa/dinsic_release_1_21_x
* commit 'fe6cfc80e':
  Convert some util functions to async (#8035)
2020-10-19 17:06:09 +01:00
Andrew Morgan
383a87e0e2 Merge commit 'd4a7829b1' into anoa/dinsic_release_1_21_x
* commit 'd4a7829b1':
  Convert synapse.api to async/await (#8031)
2020-10-19 14:59:45 +01:00
Andrew Morgan
9d09ab74bb Merge commit '66f24449d' into anoa/dinsic_release_1_21_x
* commit '66f24449d':
  Improve performance of the register endpoint (#8009)
2020-10-19 14:29:04 +01:00
Andrew Morgan
d174faacc7 Merge commit 'a7bdf98d0' into anoa/dinsic_release_1_21_x
* commit 'a7bdf98d0':
  Rename database classes to make some sense (#8033)
2020-10-16 18:21:05 +01:00
Andrew Morgan
04fef33237 Merge commit 'e19de43eb' into anoa/dinsic_release_1_21_x
* commit 'e19de43eb':
  Convert streams to async. (#8014)
2020-10-16 17:27:24 +01:00
Andrew Morgan
73381abc23 Merge commit '5d92a1428' into anoa/dinsic_release_1_21_x
* commit '5d92a1428':
  Prevent join->join membership transitions changing member count (#7977)
2020-10-16 17:21:08 +01:00
Andrew Morgan
3442b28a1b Merge commit '681250980' into anoa/dinsic_release_1_21_x
* commit '681250980':
  Implement handling of HTTP HEAD requests. (#7999)
2020-10-16 17:21:03 +01:00
Andrew Morgan
cb0ee5e1aa Merge commit '2a89ce8cd' into anoa/dinsic_release_1_21_x
* commit '2a89ce8cd':
  Convert the crypto module to async/await. (#8003)
2020-10-16 17:20:59 +01:00
Andrew Morgan
479fc9d9b5 Merge commit '394be6a0e' into anoa/dinsic_release_1_21_x
* commit '394be6a0e':
  Newsfile
  Add ratelimiting on joins
  Add docs for undoing room shutdowns (#7998)
2020-10-16 17:20:16 +01:00
Andrew Morgan
4ae35a3c7b Merge commit 'c978f6c45' into anoa/dinsic_release_1_21_x
* commit 'c978f6c45':
  Convert federation client to async/await. (#7975)
2020-10-16 17:08:04 +01:00
Andrew Morgan
6d02e38937 Merge commit '4cce8ef74' into anoa/dinsic_release_1_21_x
* commit '4cce8ef74':
  Convert appservice to async. (#7973)
2020-10-16 17:07:55 +01:00
Andrew Morgan
c078f9ee16 Merge commit 'b3a97d6da' into anoa/dinsic_release_1_21_x
* commit 'b3a97d6da':
  Convert some of the data store to async. (#7976)
2020-10-16 17:07:47 +01:00
Andrew Morgan
684991eff0 Merge commit '3950ae51e' into anoa/dinsic_release_1_21_x
* commit '3950ae51e':
  Ensure that remove_pusher is always async (#7981)
  Ensure the msg property of HttpResponseException is a string. (#7979)
  Remove from the event_relations table when purging historical events. (#7978)
  Add additional logging for SAML sessions. (#7971)
  Add MSC reference to changelog for #7736
  Re-implement unread counts (#7736)
  Various improvements to the docs (#7899)
  Convert storage layer to async/await. (#7963)
  Add an option to disable purge in delete room admin API (#7964)
  Move some log lines from default logger to sql/transaction loggers (#7952)
  Use the JSON module from the std library instead of simplejson. (#7936)
  Fix exit code for `check_line_terminators.sh` (#7970)
  Option to allow server admins to join complex rooms (#7902)
  Fix typo in metrics docs (#7966)
  Add script for finding files with unix line terminators (#7965)
  Convert the remaining media repo code to async / await. (#7947)
  Convert a synapse.events to async/await. (#7949)
  Convert groups and visibility code to async / await. (#7951)
  Convert push to async/await. (#7948)
2020-10-16 17:07:28 +01:00
Andrew Morgan
a2b8233a4e Remember mappings when we bind a 3pid using the internal sydent bind API (#66)
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-14 11:18:29 +01:00
Andrew Morgan
722e1c016a "Freeze" a room when the last admin of that room leaves (#59)
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-13 15:49:50 +01:00
Andrew Morgan
62c7b10ea5 Allow modules to create and send events into rooms (#8479)
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-10-12 13:24:15 +01:00
Andrew Morgan
8b234fb216 Swap method calls in RoomAccessTestCase.test_change_rules (#64)
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-18 11:37:21 +01:00
Mathieu Velten
b8d7ca9946 Make all rooms noisy by default (#60) 2020-09-18 11:35:41 +01:00
Andrew Morgan
3fe1c8485b Make AccessRules use the public rooms directory instead of checking a room's 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-18 11:30:36 +01:00
Andrew Morgan
319d07373a Override the power levels defaults, enforce mod requirement for invites, 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-11 15:47:09 +01:00
Andrew Morgan
3d1c941a6e RoomAccessRules cleanup (#62)
Various cleanups of the DINUM-specific `RoomAccessRules` module, including:

* Type hints
* Docstring cleanups
* Some code cleanups
2020-09-10 19:04:34 +01:00
Andrew Morgan
ff91a451b1 Add a config option for validating 'next_link' parameters against a domain 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-09 13:31:25 +01:00
Patrick Cloke
f594e434c3 Switch the JSON byte producer from a pull to a push producer. (#8116) 2020-08-19 08:07:57 -04:00
Patrick Cloke
d294f0e7e1 Remove the unused inlineCallbacks code-paths in the caching code (#8119) 2020-08-19 07:09:07 -04:00
Erik Johnston
76d21d14a0 Separate get_current_token into two. (#8113)
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-19 10:39:31 +01:00
Patrick Cloke
f40645e60b Convert events worker database to async/await. (#8071) 2020-08-18 16:20:49 -04:00
Andrew Morgan
5cf7c12995 Remove : from allowed client_secret chars (#8101)
Closes: https://github.com/matrix-org/synapse/issues/6766

Equivalent Sydent PR: https://github.com/matrix-org/sydent/pull/309

I believe it's now time to remove the extra allowed `:` from `client_secret` parameters.
2020-08-18 14:14:27 +01:00
Patrick Cloke
2f4d60a5ba Iteratively encode JSON responses to avoid blocking the reactor. (#8013) 2020-08-18 08:49:59 -04:00
Patrick Cloke
050e20e7ca Convert some of the general database methods to async (#8100) 2020-08-17 12:18:01 -04:00
Andrew Morgan
e04e465b4d Use the default templates when a custom template file cannot be found (#8037)
Fixes https://github.com/matrix-org/synapse/issues/6583
2020-08-17 17:05:00 +01:00
Patrick Cloke
ad6190c925 Convert stream database to async/await. (#8074) 2020-08-17 07:24:46 -04:00
Patrick Cloke
ac77cdb64e Add a shadow-banned flag to users. (#8092) 2020-08-14 12:37:59 -04:00
Patrick Cloke
dd8f28bd3f Fix unawaited coroutine error in tests. (#8072) 2020-08-13 07:11:39 -04:00
Patrick Cloke
fbe930dad2 Convert the roommember database to async/await. (#8070) 2020-08-12 12:14:34 -04:00