mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-10 17:42:52 +01:00
fix: catch exceptions in assertPayload, closes #13611
This commit is contained in:
@@ -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 failure
|
||||
activitypub.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;
|
||||
|
||||
Reference in New Issue
Block a user