mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-01 05:06:02 -04:00
Make check_event_allowed
module API callback not fail open (accept events) when an exception is raised (#11033)
This commit is contained in:
parent
66bdca3e31
commit
69ab3dddbc
5 changed files with 24 additions and 17 deletions
|
@ -14,7 +14,7 @@
|
|||
import logging
|
||||
from typing import TYPE_CHECKING, Any, Awaitable, Callable, List, Optional, Tuple
|
||||
|
||||
from synapse.api.errors import SynapseError
|
||||
from synapse.api.errors import ModuleFailedException, SynapseError
|
||||
from synapse.events import EventBase
|
||||
from synapse.events.snapshot import EventContext
|
||||
from synapse.types import Requester, StateMap
|
||||
|
@ -233,9 +233,10 @@ class ThirdPartyEventRules:
|
|||
# This module callback needs a rework so that hacks such as
|
||||
# this one are not necessary.
|
||||
raise e
|
||||
except Exception as e:
|
||||
logger.warning("Failed to run module API callback %s: %s", callback, e)
|
||||
continue
|
||||
except Exception:
|
||||
raise ModuleFailedException(
|
||||
"Failed to run `check_event_allowed` module API callback"
|
||||
)
|
||||
|
||||
# Return if the event shouldn't be allowed or if the module came up with a
|
||||
# replacement dict for the event.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue