commit 79ea0bf

default  ·  2023-03-03 23:26:50 +0000 UTC
parent 1254602
Reject MUTEd actor messages ASAP with a 403 status.
1 files changed,  +11, -0
+11, -0
 1@@ -1484,6 +1484,17 @@ int activitypub_post_handler(d_char *req, char *q_path,
 2         }
 3     }
 4 
 5+    /* if the message is from a muted actor, reject it right now */
 6+    if (!xs_is_null(v = xs_dict_get(msg, "actor")) && *v) {
 7+        if (is_muted(&snac, v)) {
 8+            srv_log(xs_fmt("rejected message from MUTEd actor %s", v));
 9+
10+            *body  = xs_str_new("rejected");
11+            *ctype = "text/plain";
12+            status = 403;
13+        }
14+    }
15+
16     if (valid_status(status)) {
17         enqueue_input(&snac, msg, req, 0);
18         *ctype = "application/activity+json";