Skip to content

Node.js based forum software built for the modern web

fix: pass unmodified request body into receiptError (and inbox._reject)

Julian Lam28d9f91a1c8e
diff --git a/src/controllers/activitypub/index.js b/src/controllers/activitypub/index.js
index cc387b1bef..6d5ea42db7 100644
--- a/src/controllers/activitypub/index.js
+++ b/src/controllers/activitypub/index.js
@@ -332,14 +332,15 @@ Controller.postInbox = async (req, res) => {
return res.sendStatus(200);
}
+ const originalBody = structuredClone(req.body);
try {
await activitypub.inbox[method](req);
await activitypub.analytics.receipt(req.body);
await helpers.formatApiResponse(202, res);
} catch (e) {
- activitypub.analytics.receiptError(req.body, e);
- if (req.body?.type && req.body?.object && req.body?.actor) {
- activitypub.inbox._reject(req.body.type, req.body.object, req.body.actor);
+ activitypub.analytics.receiptError(originalBody, e);
+ if (originalBody?.type && originalBody?.object && originalBody?.actor) {
+ activitypub.inbox._reject(originalBody.type, originalBody.object, originalBody.actor);
} else {
helpers.formatApiResponse(500, res, e).catch(err => winston.error(err.stack));
}