summary refs log tree commit diff
path: root/synapse/api/auth.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-22Fix missing null character check on guest_access room stateAndrew Morgan1-0/+2
When updating room_stats_state, we try to check for null bytes slipping in to the content for state events. It turns out we had added guest_access as a field to room_stats_state without including it in the null byte check. Lo and behold, a null byte in a m.room.guest_access event then breaks room_stats_state updates. This PR adds the check for guest_access. A further PR will improve this function so that this hopefully does not happen again in future.
2020-09-22Fixed a bug with reactivating users with the admin API (#8362)Dirk Klimpel3-1/+16
Fixes: #8359 Trying to reactivate a user with the admin API (`PUT /_synapse/admin/v2/users/<user_name>`) causes an internal server error. Seems to be a regression in #8033.
2020-09-22Admin API for reported events (#8217)Dirk Klimpel6-0/+697
Add an admin API to read entries of table `event_reports`. API: `GET /_synapse/admin/v1/event_reports`
2020-09-22Fix wording of deprecation notice in changelog v1.20.0 github/release-v1.20.0 release-v1.20.0Andrew Morgan1-5/+4
2020-09-22Deprecation warning for synapse admin api being accessible under /_matrixAndrew Morgan1-1/+13
2020-09-221.20.0Andrew Morgan3-3/+13
2020-09-22Create function to check for long names in devices (#8364)Dionysis Grigoropoulos4-7/+38
* Create a new function to verify that the length of a device name is under a certain threshold. * Refactor old code and tests to use said function. * Verify device name length during registration of device * Add a test for the above Signed-off-by: Dionysis Grigoropoulos <dgrig@erethon.com>
2020-09-21Add a comment re #1691Richard van der Hoff1-1/+5
2020-09-18Fix a bad merge from release-v1.20.0. (#8354)Patrick Cloke2-1/+2
2020-09-18Don't push if an user account has expired (#58)Mathieu Velten4-5/+40
2020-09-18Add a note about including the changes from 1.19.3. v1.20.0rc5Patrick Cloke1-0/+2
2020-09-18Tweak wording in the changelog.Patrick Cloke1-2/+2
2020-09-181.20.0rc5Patrick Cloke6-5/+23
2020-09-18Admin API for querying rooms where a user is a member (#8306)Dirk Klimpel5-2/+160
Add a new admin API `GET /_synapse/admin/v1/users/<user_id>/joined_rooms` to list all rooms where a user is a member.
2020-09-181.19.3 v1.19.3 github/release-v1.19.3 release-v1.19.3Andrew Morgan4-2/+16
2020-09-18Catch-up after Federation Outage (bonus): Catch-up on Synapse Startup (#8322)reivilibre10-5/+218
Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> * Fix _set_destination_retry_timings This came about because the code assumed that retry_interval could not be NULL — which has been challenged by catch-up.
2020-09-18Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke133-281/+272
This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
2020-09-18Allow appservice users to /login (#8320)Will Hunt3-11/+173
Add ability for ASes to /login using the `uk.half-shot.msc2778.login.application_service` login `type`. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2020-09-18Use _check_sigs_and_hash_and_fetch to validate backfill requests (#8350)Andrew Morgan2-5/+4
This is a bit of a hack, as `_check_sigs_and_hash_and_fetch` is intended for attempting to pull an event from the database/(re)pull it from the server that originally sent the event if checking the signature of the event fails. During backfill we *know* that we won't have the event in our database, however it is still useful to be able to query the original sending server as the server we're backfilling from may be acting maliciously. The main benefit and reason for this change however is that `_check_sigs_and_hash_and_fetch` will drop an event during backfill if it cannot be successfully validated, whereas the current code will simply fail the backfill request - resulting in the client's /messages request silently being dropped. This is a quick patch to fix backfilling rooms that contain malformed events. A better implementation in planned in future.
2020-09-18Intelligently select extremities used in backfill. (#8349)Erik Johnston4-20/+67
Instead of just using the most recent extremities let's pick the ones that will give us results that the pagination request cares about, i.e. pick extremities only if they have a smaller depth than the pagination token. This is useful when we fail to backfill an extremity, as we no longer get stuck requesting that same extremity repeatedly.
2020-09-18Update test logging to be able to accept braces (#8335)Jonathan de Jong2-2/+2
2020-09-18Add flags to /versions about whether new rooms are encrypted by default. (#8343)Patrick Cloke2-0/+20
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-18Fix ratelimiting for federation `/send` requests. (#8342)Erik Johnston4-17/+54
c.f. #8295 for rationale
2020-09-17Move lint dependencies to extras_require (#8330)Jonathan de Jong4-12/+10
Lint dependencies can now be installed with pip install -e ".[lint]" This should help keep the version in sync between tox and documentation.
2020-09-17blacklist MSC2753 sytests until it's implemented in synapse (#8285)Matthew Hodgson2-0/+9
Dendrite's implementing MSC2753 over at https://github.com/matrix-org/dendrite/pull/1370 to prove the implementation for MSC purposes, and so sytest has sprouted tests for it over at https://github.com/matrix-org/sytest/pull/944. But we don't want them to run on synapse until synapse implements it.
2020-09-17Remove obsolete __future__ imports (#8337)Jonathan de Jong19-40/+2
2020-09-17Use admin_patterns for all admin APIs. (#8331)Patrick Cloke7-26/+20
This reduces duplication of the admin prefix in regular expressions.
2020-09-17Fix a potential bug of UnboundLocalError (#8329)Jonathan de Jong2-5/+9
Replaced with less buggier control flow
2020-09-16Switch metaclass initialization to python 3-compatible syntax (#8326)Jonathan de Jong8-26/+16
2020-09-16