From 3d2af2ef63e0b79b0b4fe5398928291df9cb8c24 Mon Sep 17 00:00:00 2001 From: grunfink Date: Wed, 13 May 2026 09:50:53 +0200 Subject: Version 2.92 RELEASED. --- snac.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'snac.h') diff --git a/snac.h b/snac.h index 9f6e534..0dab19e 100644 --- a/snac.h +++ b/snac.h @@ -1,7 +1,7 @@ /* snac - A simple, minimalistic ActivityPub instance */ /* copyright (c) 2022 - 2026 grunfink et al. / MIT license */ -#define VERSION "2.92-dev" +#define VERSION "2.92" #define USER_AGENT "snac/" VERSION -- cgit From 478672a2fe9e0dec9f5a643e04efbca49bcdd195 Mon Sep 17 00:00:00 2001 From: grunfink Date: Fri, 22 May 2026 17:15:02 +0200 Subject: Bumped version. --- snac.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'snac.h') diff --git a/snac.h b/snac.h index 0dab19e..f1fadad 100644 --- a/snac.h +++ b/snac.h @@ -1,7 +1,7 @@ /* snac - A simple, minimalistic ActivityPub instance */ /* copyright (c) 2022 - 2026 grunfink et al. / MIT license */ -#define VERSION "2.92" +#define VERSION "2.93-dev" #define USER_AGENT "snac/" VERSION -- cgit From be894b379e72126a28c1aeaa79d4c5eab787638a Mon Sep 17 00:00:00 2001 From: grunfink Date: Wed, 24 Jun 2026 08:45:27 +0200 Subject: Added an new keyId check. --- activitypub.c | 10 +++++++++- http.c | 5 ++++- snac.h | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'snac.h') diff --git a/activitypub.c b/activitypub.c index 1357b6e..845d92f 100644 --- a/activitypub.c +++ b/activitypub.c @@ -2686,14 +2686,22 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req) /* check the signature */ xs *sig_err = NULL; + xs *key_id = NULL; - if (!check_signature(req, &sig_err)) { + if (!check_signature(req, &sig_err, &key_id)) { srv_log(xs_fmt("bad signature %s (%s)", actor, sig_err)); srv_archive_error("check_signature", sig_err, req, msg); return -1; } + if (strcmp(actor, key_id) != 0) { + srv_log(xs_fmt("mismatched actor '%s' and key '%s'", actor, key_id)); + + srv_archive_error("mismatched_actor_and_key", "bad keyId", req, msg); + return -1; + } + /* if no user is set, no further checks can be done; propagate */ if (snac == NULL) return 2; diff --git a/http.c b/http.c index 125d346..95cc489 100644 --- a/http.c +++ b/http.c @@ -123,7 +123,7 @@ xs_dict *http_signed_request(snac *snac, const char *method, const char *url, } -int check_signature(const xs_dict *req, xs_str **err) +int check_signature(const xs_dict *req, xs_str **err, xs_str **key_id) /* check the signature */ { const char *sig_hdr = xs_dict_get(req, "signature"); @@ -182,6 +182,9 @@ int check_signature(const xs_dict *req, xs_str **err) if ((p = strchr(keyId, '#')) != NULL) *p = '\0'; + /* copy the keyId */ + *key_id = xs_dup(keyId); + xs *actor = NULL; int status; diff --git a/snac.h b/snac.h index f1fadad..b61cc6c 100644 --- a/snac.h +++ b/snac.h @@ -348,7 +348,7 @@ xs_dict *http_signed_request(snac *snac, const char *method, const char *url, const char *body, int b_size, int *status, xs_str **payload, int *p_size, int timeout); -int check_signature(const xs_dict *req, xs_str **err); +int check_signature(const xs_dict *req, xs_str **err, xs_str **key_id); srv_state *srv_state_op(xs_str **fname, int op); void httpd(void); -- cgit From 795355acb496a8a8f015a80edf48f38786894f86 Mon Sep 17 00:00:00 2001 From: grunfink Date: Fri, 26 Jun 2026 09:39:03 +0200 Subject: Version 2.93 RELEASED. --- snac.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'snac.h') diff --git a/snac.h b/snac.h index b61cc6c..69180ae 100644 --- a/snac.h +++ b/snac.h @@ -1,7 +1,7 @@ /* snac - A simple, minimalistic ActivityPub instance */ /* copyright (c) 2022 - 2026 grunfink et al. / MIT license */ -#define VERSION "2.93-dev" +#define VERSION "2.93" #define USER_AGENT "snac/" VERSION -- cgit