summary refs log tree commit diff
path: root/tests/test_event_auth.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Move some event auth checks out to a different method (#13065)Richard van der Hoff2022-06-151-54/+113
| | | | | | | | | | | | | | * Add auth events to events used in tests * Move some event auth checks out to a different method Some of the event auth checks apply to an event's auth_events, rather than the state at the event - which means they can play no part in state resolution. Move them out to a separate method. * Rename check_auth_rules_for_event Now it only checks the state-dependent auth rules, it needs a better name.
* Remove `room_version` param from `check_auth_rules_for_event`Richard van der Hoff2022-06-121-41/+2
| | | | | | | Instead, use the `room_version` property of the event we're checking. The `room_version` was originally added as a parameter somewhere around #4482, but really it's been redundant since #6875 added a `room_version` field to `EventBase`.
* EventAuthTestCase: build events for the right room versionRichard van der Hoff2022-06-121-119/+205
| | | | | | In practice, when we run the auth rules, all of the events have the right room version. Let's stop building Room V1 events for these tests and use the right version.
* Check *all* auth events for room id and rejection (#11009)Richard van der Hoff2021-10-181-48/+90
| | | | | | | | | | | This fixes a bug where we would accept an event whose `auth_events` include rejected events, if the rejected event was shadowed by another `auth_event` with same `(type, state_key)`. The approach is to pass a list of auth events into `check_auth_rules_for_event` instead of a dict, which of course means updating the call sites. This is an extension of #10956.
* Strip "join_authorised_via_users_server" from join events which do not need ↵Patrick Cloke2021-09-301-4/+5
| | | | | | | it. (#10933) This fixes a "Event not signed by authorising server" error when transition room member from join -> join, e.g. when updating a display name or avatar URL for restricted rooms.
* Split `event_auth.check` into two parts (#10940)Richard van der Hoff2021-09-291-72/+36
| | | | | | | | | | | | | Broadly, the existing `event_auth.check` function has two parts: * a validation section: checks that the event isn't too big, that it has the rught signatures, etc. This bit is independent of the rest of the state in the room, and so need only be done once for each event. * an auth section: ensures that the event is allowed, given the rest of the state in the room. This gets done multiple times, against various sets of room state, because it forms part of the state res algorithm. Currently, this is implemented with `do_sig_check` and `do_size_check` parameters, but I think that makes everything hard to follow. Instead, we split the function in two and call each part separately where it is needed.
* Support MSC3289: Room version 8 (#10449)Patrick Cloke2021-08-091-9/+9
| | | This adds support for MSC3289: room version 8. This is room version 7 + MSC3083.
* Update the MSC3083 support to verify if joins are from an authorized server. ↵Patrick Cloke2021-07-261-13/+85
| | | | (#10254)
* Add type hints and comments to event auth code. (#10393)Patrick Cloke2021-07-141-10/+13
|
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Add an experimental room version to support restricted join rules. (#9717)Patrick Cloke2021-03-311-3/+243
| | | Per MSC3083.
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-5/+20
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Implement room version 6 (MSC2240). (#7506)Patrick Cloke2020-05-151-11/+5
|
* Enforce MSC2209: auth rules for notifications in power level event (#7502)Patrick Cloke2020-05-141-0/+33
| | | | In a new room version, the "notifications" key of power level events are subject to restricted auth rules.
* Remove special auth and redaction rules for aliases events in experimental ↵Patrick Cloke2020-03-091-1/+92
| | | | room ver. (#7037)
* Add a `make_event_from_dict` method (#6858)Richard van der Hoff2020-02-071-5/+5
| | | | | | | ... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
* Pass room version object into event_auth.check and check_redaction (#6788)Richard van der Hoff2020-01-281-7/+4
| | | | | | | These are easier to work with than the strings and we normally have one around. This fixes `FederationHander._persist_auth_tree` which was passing a RoomVersion object into event_auth.check instead of a string.
* Run Black on the tests again (#5170)Amber Brown2019-05-101-2/+6
|
* Collect room-version variations into one place (#4969)Richard van der Hoff2019-04-011-5/+5
| | | | Collect all the things that make room-versions different to one another into one place, so that it's easier to define new room versions.
* Pass through room version to event authErik Johnston2019-01-251-2/+11
|
* Run black.black2018-08-101-53/+45
|
* run isortAmber Brown2018-07-091-1/+2
|
* remove spurious debugRichard van der Hoff2018-06-141-2/+0
|
* Make default state_default 50Richard van der Hoff2018-06-141-0/+153
Make it so that, before there is a power-levels event in the room, you need a power level of at least 50 to send state. Partially addresses https://github.com/matrix-org/matrix-doc/issues/1192