diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2023-09-26 11:57:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-26 11:57:50 -0400 |
commit | f84da3c32ec74cf054e2fd6d10618aa4997cffaa (patch) | |
tree | 4c6dba941c45d8bd95049c9d24bd43e3c840a0ce /synapse/events/validator.py | |
parent | Implement MSC4028: push all encrypted events. (#16361) (diff) | |
download | synapse-f84da3c32ec74cf054e2fd6d10618aa4997cffaa.tar.xz |
Add a cache around server ACL checking (#16360)
* Pre-compiles the server ACLs onto an object per room and invalidates them when new events come in. * Converts the server ACL checking into Rust.
Diffstat (limited to 'synapse/events/validator.py')
-rw-r--r-- | synapse/events/validator.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/events/validator.py b/synapse/events/validator.py index a637fadfab..83d9fb5813 100644 --- a/synapse/events/validator.py +++ b/synapse/events/validator.py @@ -39,9 +39,9 @@ from synapse.events.utils import ( CANONICALJSON_MIN_INT, validate_canonicaljson, ) -from synapse.federation.federation_server import server_matches_acl_event from synapse.http.servlet import validate_json_object from synapse.rest.models import RequestBodyModel +from synapse.storage.controllers.state import server_acl_evaluator_from_event from synapse.types import EventID, JsonDict, RoomID, StrCollection, UserID @@ -106,7 +106,10 @@ class EventValidator: self._validate_retention(event) elif event.type == EventTypes.ServerACL: - if not server_matches_acl_event(config.server.server_name, event): + server_acl_evaluator = server_acl_evaluator_from_event(event) + if not server_acl_evaluator.server_matches_acl_event( + config.server.server_name + ): raise SynapseError( 400, "Can't create an ACL event that denies the local server" ) |