summary refs log tree commit diff
path: root/synapse/state/v1.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Move some event auth checks out to a different method (#13065)Richard van der Hoff2022-06-151-2/+2
| | | | | | | | | | | | | | * 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-3/+1
| | | | | | | 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`.
* Add type hints to `synapse/storage/databases/main/events_worker.py` (#11411)Sean Quah2021-11-261-1/+2
| | | | Also refactor the stream ID trackers/generators a bit and try to document them better.
* Check *all* auth events for room id and rejection (#11009)Richard van der Hoff2021-10-181-2/+2
| | | | | | | | | | | 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.
* `disallow-untyped-defs` for `synapse.state` (#11004)David Robertson2021-10-061-2/+2
| | | | | * `disallow-untyped-defs` for `synapse.state` Much smaller than I was expecting!
* Split `event_auth.check` into two parts (#10940)Richard van der Hoff2021-09-291-6/+2
| | | | | | | | | | | | | 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.
* Update the MSC3083 support to verify if joins are from an authorized server. ↵Patrick Cloke2021-07-261-11/+29
| | | | (#10254)
* Use inline type hints in various other places (in `synapse/`) (#10380)Jonathan de Jong2021-07-151-1/+1
|
* 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>`
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-3/+11
| | | | | | | - 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
* Fix typos and spelling errors. (#8639)Patrick Cloke2020-10-231-1/+1
|
* Define StateMap as immutable and add a MutableStateMap type. (#8183)Patrick Cloke2020-08-281-5/+5
|
* Add type hints for state. (#8140)Patrick Cloke2020-08-241-28/+59
|
* Convert state resolution to async/await (#7942)Patrick Cloke2020-07-241-9/+6
|
* Replace iteritems/itervalues/iterkeys with native versions. (#7692)Patrick Cloke2020-06-151-14/+12
|
* Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)Patrick Cloke2020-02-211-5/+5
| | | | Ensure good comprehension hygiene using flake8-comprehensions.
* Pass room version object into event_auth.check and check_redaction (#6788)Richard van der Hoff2020-01-281-2/+2
| | | | | | | 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.
* Add StateMap type alias (#6715)Erik Johnston2020-01-161-2/+3
|
* sanity-checking for events used in state res (#6531)Richard van der Hoff2019-12-131-5/+29
| | | | | | | When we perform state resolution, check that all of the events involved are in the right room.
* Replace returnValue with return (#5736)Amber Brown2019-07-231-5/+3
|
* Run Black. (#5482)Amber Brown2019-06-201-37/+19
|
* Collect room-version variations into one place (#4969)Richard van der Hoff2019-04-011-3/+8
| | | | 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-3/+11
|
* Workaround for non-ascii event ids (#4241)Richard van der Hoff2018-12-031-1/+3
| | | | | | It turns out that we accept events with non-ascii IDs, which would later cause an explosion during state res. Fixes #4226
* Rename resolve_events_with_factoryErik Johnston2018-10-241-1/+1
|
* Logging improvementsRichard van der Hoff2018-09-261-2/+12
| | | | Some logging tweaks to help with debugging incoming federation transactions
* Remove unnecessary resolve_events_with_state_mapErik Johnston2018-08-221-28/+0
| | | | | We only ever used the synchronous resolve_events_with_state_map in one place, which is trivial to replace with the async version.
* Refactor state moduleErik Johnston2018-08-091-0/+321
We split out the actual state resolution algorithm to prepare for having multiple versions.