From e44544d22e729fa6ce6f906693fea20d6ce57c80 Mon Sep 17 00:00:00 2001 From: kaniini Date: Mon, 3 Dec 2018 20:26:46 +0000 Subject: [PATCH] relay: add additional assertion proving that a message is never relayed back to it's origin --- relay/actor.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/relay/actor.py b/relay/actor.py index 15c136b..eb5c869 100644 --- a/relay/actor.py +++ b/relay/actor.py @@ -161,8 +161,10 @@ def distill_inboxes(actor, object_id): inbox = get_actor_inbox(actor) targets = [target for target in DATABASE.get('relay-list', []) if target != inbox] targets = [target for target in targets if urlsplit(target).hostname != origin_hostname] + hostnames = [urlsplit(target).hostname for target in targets] assert inbox not in targets + assert origin_hostname not in hostnames return targets @@ -186,10 +188,6 @@ async def handle_relay(actor, data, request): logging.debug('>> already relayed %r as %r', object_id, CACHE[object_id]) return - # don't relay mastodon announces -- causes LRP fake direction issues - if data['type'] == 'Announce' and len(data.get('cc', [])) > 0: - return - activity_id = "https://{}/activities/{}".format(request.host, uuid.uuid4()) message = {