mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Discard PDUs from invalid origins due to #1753 in 0.18.[56]
This commit is contained in:
parent
2f5be2d8dc
commit
e10c527930
@ -23,6 +23,7 @@ from synapse.util.async import Linearizer
|
|||||||
from synapse.util.logutils import log_function
|
from synapse.util.logutils import log_function
|
||||||
from synapse.util.caches.response_cache import ResponseCache
|
from synapse.util.caches.response_cache import ResponseCache
|
||||||
from synapse.events import FrozenEvent
|
from synapse.events import FrozenEvent
|
||||||
|
from synapse.types import get_domain_from_id
|
||||||
import synapse.metrics
|
import synapse.metrics
|
||||||
|
|
||||||
from synapse.api.errors import AuthError, FederationError, SynapseError
|
from synapse.api.errors import AuthError, FederationError, SynapseError
|
||||||
@ -132,7 +133,7 @@ class FederationServer(FederationBase):
|
|||||||
|
|
||||||
if response:
|
if response:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"[%s] We've already responed to this request",
|
"[%s] We've already responded to this request",
|
||||||
transaction.transaction_id
|
transaction.transaction_id
|
||||||
)
|
)
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
@ -475,6 +476,27 @@ class FederationServer(FederationBase):
|
|||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
@log_function
|
@log_function
|
||||||
def _handle_new_pdu(self, origin, pdu, get_missing=True):
|
def _handle_new_pdu(self, origin, pdu, get_missing=True):
|
||||||
|
|
||||||
|
# check that it's actually being sent from a valid destination to
|
||||||
|
# workaround bug #1753 in 0.18.5 and 0.18.6
|
||||||
|
if origin != get_domain_from_id(pdu.event_id):
|
||||||
|
if not (
|
||||||
|
pdu.type == 'm.room.member' and
|
||||||
|
pdu.content and
|
||||||
|
pdu.content.get("membership", None) == 'join' and
|
||||||
|
self.hs.is_mine_id(pdu.state_key)
|
||||||
|
):
|
||||||
|
logger.info(
|
||||||
|
"Discarding PDU %s from invalid origin %s",
|
||||||
|
pdu.event_id, origin
|
||||||
|
)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
logger.info(
|
||||||
|
"Accepting join PDU %s from %s",
|
||||||
|
pdu.event_id, origin
|
||||||
|
)
|
||||||
|
|
||||||
# We reprocess pdus when we have seen them only as outliers
|
# We reprocess pdus when we have seen them only as outliers
|
||||||
existing = yield self._get_persisted_pdu(
|
existing = yield self._get_persisted_pdu(
|
||||||
origin, pdu.event_id, do_auth=False
|
origin, pdu.event_id, do_auth=False
|
||||||
|
Loading…
Reference in New Issue
Block a user