From 073a2d962ad1acdfc2b6f179fc2fecdf92b9e9e8 Mon Sep 17 00:00:00 2001 From: default Date: Sat, 2 Sep 2023 08:41:29 +0200 Subject: [PATCH] Discard output messages to blocked instances. --- activitypub.c | 5 +++++ data.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/activitypub.c b/activitypub.c index 90ad874..9427bf5 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1875,6 +1875,11 @@ void process_queue_item(xs_dict *q_item) return; } + if (is_instance_blocked(inbox)) { + srv_debug(0, xs_fmt("discarded output message to blocked instance %s", inbox)); + return; + } + /* deliver */ status = send_to_inbox_raw(keyid, seckey, inbox, msg, &payload, &p_size, retries == 0 ? 3 : 8); diff --git a/data.c b/data.c index fb6d81f..889d484 100644 --- a/data.c +++ b/data.c @@ -1759,8 +1759,11 @@ void inbox_add_by_actor(const xs_dict *actor) char *v; if (!xs_is_null(v = xs_dict_get(actor, "endpoints")) && - !xs_is_null(v = xs_dict_get(v, "sharedInbox"))) - inbox_add(v); + !xs_is_null(v = xs_dict_get(v, "sharedInbox"))) { + /* only collect this inbox if its instance is not blocked */ + if (!is_instance_blocked(v)) + inbox_add(v); + } }