From a608ac847b36dd72634f21502be42e785add8b65 Mon Sep 17 00:00:00 2001 From: Jess Porter Date: Mon, 23 May 2022 17:36:21 +0100 Subject: add SpamChecker callback for silently dropping inbound federated events (#12744) Signed-off-by: jesopo --- docs/modules/spam_checker_callbacks.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'docs/modules') diff --git a/docs/modules/spam_checker_callbacks.md b/docs/modules/spam_checker_callbacks.md index 472d957180..27c5a0ed5c 100644 --- a/docs/modules/spam_checker_callbacks.md +++ b/docs/modules/spam_checker_callbacks.md @@ -249,6 +249,24 @@ callback returns `False`, Synapse falls through to the next one. The value of th callback that does not return `False` will be used. If this happens, Synapse will not call any of the subsequent implementations of this callback. +### `should_drop_federated_event` + +_First introduced in Synapse v1.60.0_ + +```python +async def should_drop_federated_event(event: "synapse.events.EventBase") -> bool +``` + +Called when checking whether a remote server can federate an event with us. **Returning +`True` from this function will silently drop a federated event and split-brain our view +of a room's DAG, and thus you shouldn't use this callback unless you know what you are +doing.** + +If multiple modules implement this callback, they will be considered in order. If a +callback returns `False`, Synapse falls through to the next one. The value of the first +callback that does not return `False` will be used. If this happens, Synapse will not call +any of the subsequent implementations of this callback. + ## Example The example below is a module that implements the spam checker callback -- cgit 1.5.1