Jonathan de Jong
bf72d10dbf
Use inline type hints in various other places (in `synapse/`) ( #10380 )
2021-07-15 11:02:43 +01:00
Patrick Cloke
eb3beb8f12
Add type hints and comments to event auth code. ( #10393 )
2021-07-14 14:13:40 +01:00
Patrick Cloke
aaf7d1acb8
Correct type hints for synapse.event_auth. ( #10253 )
2021-06-30 07:08:42 -04:00
Sorunome
d936371b69
Implement knock feature ( #6739 )
...
This PR aims to implement the knock feature as proposed in https://github.com/matrix-org/matrix-doc/pull/2403
Signed-off-by: Sorunome mail@sorunome.de
Signed-off-by: Andrew Morgan andrewm@element.io
2021-06-09 19:39:51 +01:00
Richard van der Hoff
3ff2251754
Improved validation for received requests ( #9817 )
...
* Simplify `start_listening` callpath
* Correctly check the size of uploaded files
2021-04-23 19:20:44 +01:00
Patrick Cloke
e83627926f
Add type hints to auth and auth_blocking. ( #9876 )
2021-04-23 12:02:16 -04:00
Jonathan de Jong
495b214f4f
Fix (final) Bugbear violations ( #9838 )
2021-04-20 11:50:49 +01:00
Jonathan de Jong
4b965c862d
Remove redundant "coding: utf-8" lines ( #9786 )
...
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>`
2021-04-14 15:34:27 +01:00
Patrick Cloke
35c5ef2d24
Add an experimental room version to support restricted join rules. ( #9717 )
...
Per MSC3083.
2021-03-31 16:39:08 -04:00
Eric Eastwood
0a00b7ff14
Update black, and run auto formatting over the codebase ( #9381 )
...
- Update black version to the latest
- Run black auto formatting over the codebase
- Run autoformatting according to [`docs/code_style.md
`](80d6dc9783/docs/code_style.md
)
- Update `code_style.md` docs around installing black to use the correct version
2021-02-16 22:32:34 +00:00
Patrick Cloke
da11cc22be
Ensure that event.redacts is the proper type before handling it ( #8457 )
...
This fixes a bug when backfilling invalid events.
2020-10-05 10:24:17 -04:00
Patrick Cloke
f40645e60b
Convert events worker database to async/await. ( #8071 )
2020-08-18 16:20:49 -04:00
Erik Johnston
e29c44340b
Fix recursion error when fetching auth chain over federation ( #7817 )
...
When fetching the state of a room over federation we receive the event
IDs of the state and auth chain. We then fetch those events that we
don't already have.
However, we used a function that recursively fetched any missing auth
events for the fetched events, which can lead to a lot of recursion if
the server is missing most of the auth chain. This work is entirely
pointless because would have queued up the missing events in the auth
chain to be fetched already.
Let's just diable the recursion, since it only gets called from one
place anyway.
2020-07-10 18:15:35 +01:00
Patrick Cloke
5355421295
Add type hints to event_auth code. ( #7505 )
2020-05-15 11:19:43 -04:00
Patrick Cloke
fef3ff5cc4
Enforce MSC2209: auth rules for notifications in power level event ( #7502 )
...
In a new room version, the "notifications" key of power level events are
subject to restricted auth rules.
2020-05-14 12:38:17 -04:00
Patrick Cloke
06eb5cae08
Remove special auth and redaction rules for aliases events in experimental room ver. ( #7037 )
2020-03-09 08:58:25 -04:00
Richard van der Hoff
a1f307f7d1
fix bad variable ref
2020-01-28 14:55:22 +00:00
Richard van der Hoff
49d3bca37b
Implement updated auth rules from MSC2260
2020-01-28 14:20:10 +00:00
Richard van der Hoff
a8ce7aeb43
Pass room version object into event_auth.check and check_redaction ( #6788 )
...
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.
2020-01-28 14:18:29 +00:00
Erik Johnston
0f6e525be3
Fixup synapse.api to pass mypy ( #6733 )
2020-01-20 17:34:13 +00:00
Richard van der Hoff
6e8f8e14f2
Merge release-v1.7.1 into develop
2019-12-18 09:51:51 +00:00
Erik Johnston
5029422530
Fix bug where we added duplicate event IDs as auth_events ( #6560 )
2019-12-17 15:06:08 +00:00
Richard van der Hoff
6577f2d887
Sanity-check room ids in event auth ( #6530 )
...
When we do an event auth operation, check that all of the events involved are
in the right room.
2019-12-16 13:47:34 +00:00
Richard van der Hoff
971a0702b5
Sanity-check room ids in event auth ( #6530 )
...
When we do an event auth operation, check that all of the events involved are
in the right room.
2019-12-13 11:44:41 +00:00
Richard van der Hoff
424fd58237
Remove redundant code from event authorisation implementation. ( #6502 )
2019-12-10 15:09:45 +00:00
Andrew Morgan
54fef094b3
Remove usage of deprecated logger.warn method from codebase ( #6271 )
...
Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
2019-10-31 10:23:24 +00:00
Andrew Morgan
92e88a71d3
Cleanup extra quotes from IDEs ( #6236 )
2019-10-23 16:49:05 +01:00
Andrew Morgan
b09d443632
Cleanup event auth type initialisation ( #5975 )
...
Very small code cleanup.
2019-09-04 16:16:56 +01:00
Amber Brown
32e7c9e7f2
Run Black. ( #5482 )
2019-06-20 19:32:02 +10:00
Richard van der Hoff
54a87a7b08
Collect room-version variations into one place ( #4969 )
...
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.
2019-04-01 10:24:38 +01:00
Erik Johnston
67b82f1336
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/redactions_eiah
2019-01-29 22:58:38 +00:00
Erik Johnston
655ce037fd
check event format version not room version
2019-01-29 22:33:43 +00:00
Erik Johnston
47e2dd1994
Drop vdh support
2019-01-29 21:24:34 +00:00
Erik Johnston
770b823445
Only check event IDs domain signed event for V1 and V2
...
Since newer versions of events don't have the same format for event ID.
2019-01-29 16:15:00 +00:00
Erik Johnston
7709d2bd16
Implement rechecking of redactions
2019-01-29 11:56:20 +00:00
Erik Johnston
ae2a957dba
Pass through room version to event auth
2019-01-25 18:31:41 +00:00
Erik Johnston
bc80b3f454
Add helpers for getting prev and auth events ( #4139 )
...
* Add helpers for getting prev and auth events
This is in preparation for allowing the event format to change between
room versions.
2018-11-06 00:35:15 +11:00
Erik Johnston
6bd856caa2
User event.sender rather than alias event.user_id
2018-10-16 16:16:13 +01:00
Erik Johnston
52e6e815be
Sanitise error messages when user doesn't have permission to invite
2018-10-03 14:13:07 +01:00
Erik Johnston
69e857853f
Fix handling of rejected threepid invites
2018-10-03 11:57:30 +01:00
Richard van der Hoff
8afddf7afe
Fix error handling for missing auth_event
...
When we were authorizing an event, if there was no `m.room.create` in its
auth_events, we would raise a SynapseError with a cryptic message, which then
meant that we would bail out of processing any incoming events, rather than
storing a rejection for the faulty event and moving on.
We should treat the absent event the same as any other auth failure, by
raising an AuthError, so that the event is marked as rejected.
2018-09-26 14:40:16 +01:00
Richard van der Hoff
19a17068f1
Check m.room.create for sane room_versions
2018-08-06 16:11:24 +01:00
Amber Brown
49af402019
run isort
2018-07-09 16:09:20 +10:00
Erik Johnston
2c33b55738
Avoid relying on int vs None comparison
...
Python 3 doesn't support comparing None to ints
2018-07-02 11:40:32 +01:00
Erik Johnston
cbf82dddf1
Ensure that we define sender_domain
2018-07-02 11:37:57 +01:00
Richard van der Hoff
5c9afd6f80
Make default state_default 50
...
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
2018-06-14 12:38:09 +01:00
Richard van der Hoff
52423607bd
Clarify interface for event_auth
...
stop pretending that it returns a boolean, which just almost gave me a heart
attack.
2018-06-14 12:26:17 +01:00
Richard van der Hoff
557b686eac
Refactor get_send_level to take a power_levels event
...
it makes it easier for me to reason about
2018-06-14 11:26:27 +01:00
Amber Brown
c936a52a9e
Consistently use six's iteritems and wrap lazy keys/values in list() if they're not meant to be lazy ( #3307 )
2018-05-31 19:03:47 +10:00
Travis Ralston
eccfc8e928
Fix templating error with unban permission message
...
Fixes https://github.com/matrix-org/synapse/issues/2759
Signed-off-by: Travis Ralston <travpc@gmail.com>
2018-01-07 19:52:58 -07:00