mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-11 22:54:19 -05:00
Soft-fail spammy events received over federation (#10263)
This commit is contained in:
parent
3d370efc6d
commit
a0ed0f363e
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)
|
||||
|
||||
if result:
|
||||
logger.warning(
|
||||
"Event contains spam, redacting %s: %s",
|
||||
pdu.event_id,
|
||||
pdu.get_pdu_json(),
|
||||
)
|
||||
return prune_event(pdu)
|
||||
logger.warning("Event contains spam, soft-failing %s", pdu.event_id)
|
||||
# we redact (to save disk space) as well as soft-failing (to stop
|
||||
# using the event in prev_events).
|
||||
redacted_event = prune_event(pdu)
|
||||
redacted_event.internal_metadata.soft_failed = True
|
||||
return redacted_event
|
||||
|
||||
return pdu
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user