Node.js based forum software built for the modern web
fix: catch exceptions in assertPayload, closes #13611
Barış Soner Uşaklı9bdf24f08be5
diff --git a/src/middleware/activitypub.js b/src/middleware/activitypub.jsindex f1e78a1cd6..4504f83d44 100644--- a/src/middleware/activitypub.js+++ b/src/middleware/activitypub.js@@ -4,6 +4,7 @@ const db = require('../database');const meta = require('../meta');const activitypub = require('../activitypub');const analytics = require('../analytics');+const helpers = require('./helpers');const middleware = module.exports;@@ -59,7 +60,7 @@ middleware.verify = async function (req, res, next) {next();};-middleware.assertPayload = async function (req, res, next) {+middleware.assertPayload = helpers.try(async function (req, res, next) {// Checks the validity of the incoming payload against the sender and rejects on failureactivitypub.helpers.log('[middleware/activitypub] Validating incoming payload...');@@ -131,7 +132,7 @@ middleware.assertPayload = async function (req, res, next) {activitypub.helpers.log('[middleware/activitypub] Key ownership cross-check passed.');next();-};+});middleware.resolveObjects = async function (req, res, next) {const { type, object } = req.body;