forked from MirrorHub/synapse
Soft-fail spammy events received over federation (#10263)
This commit is contained in:
parent
3d370efc6d
commit
a0ed0f363e
2 changed files with 7 additions and 6 deletions
1
changelog.d/10263.feature
Normal file
1
changelog.d/10263.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Mark events received over federation which fail a spam check as "soft-failed".
|
|
@ -89,12 +89,12 @@ class FederationBase:
|
||||||
result = await self.spam_checker.check_event_for_spam(pdu)
|
result = await self.spam_checker.check_event_for_spam(pdu)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
logger.warning(
|
logger.warning("Event contains spam, soft-failing %s", pdu.event_id)
|
||||||
"Event contains spam, redacting %s: %s",
|
# we redact (to save disk space) as well as soft-failing (to stop
|
||||||
pdu.event_id,
|
# using the event in prev_events).
|
||||||
pdu.get_pdu_json(),
|
redacted_event = prune_event(pdu)
|
||||||
)
|
redacted_event.internal_metadata.soft_failed = True
|
||||||
return prune_event(pdu)
|
return redacted_event
|
||||||
|
|
||||||
return pdu
|
return pdu
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue