-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Reject events which have lots of prev_events #3118
Conversation
... this should protect us from being dossed by people making silly events (deliberately or otherwise)
72e3c47
to
1f4b498
Compare
Does this mean we won't be able to back paginate through Matrix HQ, now that that has a silly event? |
yes. |
well, wait. There are certainly events in HQ which fail a signature test, so there must be more to it than this. /me goes back to testing |
Ok so as per #3121, yes broken signatures do break backfill fairly comprehensively. Rather than make this too much worse, we're going to tolerate the big events for backfill, but not for pushed transactions and fix this properly another day. |
synapse/handlers/federation.py
Outdated
logger.warn("Rejecting event %s which has %i auth_events", | ||
ev.event_id, len(ev.auth_events)) | ||
raise SynapseError( | ||
"ERROR", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spurious "ERROR"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently. Now fixed.
Changes in synapse v0.28.0-rc1 (2018-04-26) =========================================== Bug Fixes: * Fix quarantine media admin API and search reindex (PR #3130) * Fix media admin APIs (PR #3134) Changes in synapse v0.28.0-rc1 (2018-04-24) =========================================== Minor performance improvement to federation sending and bug fixes. (Note: This release does not include state resolutions discussed in matrix live) Features: * Add metrics for event processing lag (PR #3090) * Add metrics for ResponseCache (PR #3092) Changes: * Synapse on PyPy (PR #2760) Thanks to @Valodim! * move handling of auto_join_rooms to RegisterHandler (PR #2996) Thanks to @krombel! * Improve handling of SRV records for federation connections (PR #3016) Thanks to @silkeh! * Document the behaviour of ResponseCache (PR #3059) * Preparation for py3 (PR #3061, #3073, #3074, #3075, #3103, #3104, #3106, #3107, #3109, #3110) Thanks to @NotAFile! * update prometheus dashboard to use new metric names (PR #3069) Thanks to @krombel! * use python3-compatible prints (PR #3074) Thanks to @NotAFile! * Send federation events concurrently (PR #3078) * Limit concurrent event sends for a room (PR #3079) * Improve R30 stat definition (PR #3086) * Send events to ASes concurrently (PR #3088) * Refactor ResponseCache usage (PR #3093) * Clarify that SRV may not point to a CNAME (PR #3100) Thanks to @silkeh! * Use str(e) instead of e.message (PR #3103) Thanks to @NotAFile! * Use six.itervalues in some places (PR #3106) Thanks to @NotAFile! * Refactor store.have_events (PR #3117) Bug Fixes: * Return 401 for invalid access_token on logout (PR #2938) Thanks to @dklug! * Return a 404 rather than a 500 on rejoining empty rooms (PR #3080) * fix federation_domain_whitelist (PR #3099) * Avoid creating events with huge numbers of prev_events (PR #3113) * Reject events which have lots of prev_events (PR #3118)
This PR adds some sanity-checking to events received over federation, via a pushed transaction,
or pulled via backfill.Events that have "too many" prev_events will essentially be ignored, in the same way as events that fail their signature test. This is less than elegant, as it means we keep trying to refetch the invalid event. It might be better to record the fact that we have seen the event and rejected it, in the same way that we do for events which fail their auth checks. However, that sounds non-trivial, and it's a problem that already exists for events with an invalid signature, so I'm declaring the problem orthogonal for now.As per #3118 (comment), now accepts the event when it gets backfilled. #3124 tracks the second half.