summary refs log tree commit diff
path: root/synapse/events/validator.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix another jsonschema typecheck error (#11830)David Robertson2022-01-251-4/+2
| | | | | | | | | | | | | | | | | | | | | Similar to #11817. In `_create_power_level_validator` we - retrieve `validator`. This is a class implementing the `jsonschema.protocols.Validator` interface. In other words, `validator: Type[jsonschema.protocols.Validator]`. - we then create an second validator class by modifying the original `validator`. We return that class, which is also of type `Type[jsonschema.protocols.Validator]`. So the original annotation was incorrect: it claimed we were returning an instance of jsonSchema.Draft7Validator, not the class (or a subclass) itself. (Strictly speaking this is incorrect, because `POWER_LEVELS_SCHEMA` isn't pinned to a particular version of JSON Schema. But there are other complications with the type stubs if you try to fix this; I felt like the change herein was a decent compromise that better expresses intent). (I suspect/hope the typeshed project would welcome an effort to improve the jsonschema stubs. Let's see if I get some spare time.)
* Ignore the jsonschema type. (#11817)Patrick Cloke2022-01-251-1/+3
|
* Add remaining type hints to `synapse.events`. (#11098)Patrick Cloke2021-11-021-1/+1
|
* Add type hints to synapse.events.*. (#11066)Patrick Cloke2021-10-131-8/+10
| | | Except `synapse/events/__init__.py`, which will be done in a follow-up.
* Use direct references for some configuration variables (#10798)Patrick Cloke2021-09-131-1/+1
| | | | Instead of proxying through the magic getter of the RootConfig object. This should be more performant (and is more explicit).
* Validate new m.room.power_levels events (#10232)Aaron Raimist2021-08-261-2/+75
| | | | Signed-off-by: Aaron Raimist <aaron@raim.ist>
* 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>`
* Block clients from sending server ACLs that lock the local server out. (#8708)Erik Johnston2020-11-031-9/+18
| | | Fixes #4042
* Make sure a retention policy is a state event (#8527)Brendan Abolivier2020-10-141-0/+3
| | | | | * Make sure a retention policy is a state event * Changelog
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Allow capping a room's retention policy (#8104)Brendan Abolivier2020-08-241-56/+3
|
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-161-7/+5
|
* Strictly enforce canonicaljson requirements in a new room version (#7381)Patrick Cloke2020-05-141-0/+7
|
* Implement per-room message retention policiesBrendan Abolivier2019-11-041-3/+97
|
* Merge pull request #5805 from matrix-org/erikj/validate_stateErik Johnston2019-08-011-2/+9
|\ | | | | Validate well known state events are state events.
| * Validate well-known state events are state events.Erik Johnston2019-07-311-2/+9
| | | | | | | | | | Lets disallow sending things like memberships, topics etc as non-state events.
* | Fix spelling.Erik Johnston2019-08-011-1/+3
|/ | | | Co-Authored-By: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Don't allow clients to send tombstones that reference the same roomErik Johnston2019-07-311-0/+7
|
* Run Black. (#5482)Amber Brown2019-06-201-14/+7
|
* Do checks on aliases for incoming m.room.aliases events (#5128)Brendan Abolivier2019-05-081-2/+13
| | | | | Follow-up to #5124 Also added a bunch of checks to make sure everything (both the stuff added on #5124 and this PR) works as intended.
* Collect room-version variations into one place (#4969)Richard van der Hoff2019-04-011-1/+2
| | | | 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.
* Don't assert an event must have an event IDErik Johnston2019-01-291-2/+3
|
* Remove duplicate checksErik Johnston2019-01-291-14/+0
|
* Fix up error messagesErik Johnston2019-01-291-2/+2
|
* Fold validate into validate_newErik Johnston2019-01-291-16/+11
|
* Split up event validation between event and builderErik Johnston2019-01-281-20/+53
| | | | | | | | | The validator was being run on the EventBuilder objects, and so the validator only checked a subset of fields. With the upcoming EventBuilder refactor even fewer fields will be there to validate. To get around this we split the validation into those that can be run against an EventBuilder and those run against a fully fledged event.
* run isortAmber Brown2018-07-091-4/+4
|
* Replace some more comparisons with sixAdrian Tschira2018-05-191-2/+4
| | | | | | plus a bonus b"" string I missed last time Signed-off-by: Adrian Tschira <nota@notafile.com>
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Update copyright noticesMark Haines2015-01-061-1/+1
|
* Validate message, topic and name event contentsErik Johnston2014-12-121-0/+21
|
* Add some basic event validationErik Johnston2014-12-101-8/+21
|
* Add PEP8 newlinesErik Johnston2014-12-091-1/+1
|
* WIP for new way of managing events.Erik Johnston2014-12-031-0/+58