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

Commit a0ed0f3

Browse files
authored
Soft-fail spammy events received over federation (#10263)
1 parent 3d370ef commit a0ed0f3

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

changelog.d/10263.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Mark events received over federation which fail a spam check as "soft-failed".

synapse/federation/federation_base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ async def _check_sigs_and_hash(
8989
result = await self.spam_checker.check_event_for_spam(pdu)
9090

9191
if result:
92-
logger.warning(
93-
"Event contains spam, redacting %s: %s",
94-
pdu.event_id,
95-
pdu.get_pdu_json(),
96-
)
97-
return prune_event(pdu)
92+
logger.warning("Event contains spam, soft-failing %s", pdu.event_id)
93+
# we redact (to save disk space) as well as soft-failing (to stop
94+
# using the event in prev_events).
95+
redacted_event = prune_event(pdu)
96+
redacted_event.internal_metadata.soft_failed = True
97+
return redacted_event
9898

9999
return pdu
100100

0 commit comments

Comments
 (0)