Skip to content

Node.js based forum software built for the modern web

fix: automatically reject unsigned POSTs to inbox

Julian Lama3e1a666b876
diff --git a/src/activitypub/index.js b/src/activitypub/index.js
index d738553bde..791472456e 100644
--- a/src/activitypub/index.js
+++ b/src/activitypub/index.js
@@ -138,6 +138,10 @@ ActivityPub.sign = async (uid, url, payload) => {
};
ActivityPub.verify = async (req) => {
+ if (!req.headers.hasOwnProperty('signature')) {
+ return false;
+ }
+
// Break the signature apart
const { keyId, headers, signature } = req.headers.signature.split(',').reduce((memo, cur) => {
const split = cur.split('="');
@@ -181,6 +185,7 @@ ActivityPub.get = async (uid, uri) => {
const headers = uid > 0 ? await ActivityPub.sign(uid, uri) : {};
winston.verbose(`[activitypub/get] ${uri}`);
+ console.log(headers);
const { response, body } = await request.get(uri, {
headers: {
...headers,