Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Soft-fail spammy events received over federation (#10263)
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh authored Jun 29, 2021
1 parent 3d370ef commit a0ed0f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/10263.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mark events received over federation which fail a spam check as "soft-failed".
12 changes: 6 additions & 6 deletions synapse/federation/federation_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ async def _check_sigs_and_hash(
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

Expand Down

0 comments on commit a0ed0f3

Please sign in to comment.