mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-26 16:41:21 +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 meta = require('../meta');
|
||||||
const activitypub = require('../activitypub');
|
const activitypub = require('../activitypub');
|
||||||
const analytics = require('../analytics');
|
const analytics = require('../analytics');
|
||||||
|
const helpers = require('./helpers');
|
||||||
|
|
||||||
const middleware = module.exports;
|
const middleware = module.exports;
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ middleware.verify = async function (req, res, next) {
|
|||||||
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
|
// Checks the validity of the incoming payload against the sender and rejects on failure
|
||||||
activitypub.helpers.log('[middleware/activitypub] Validating incoming payload...');
|
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.');
|
activitypub.helpers.log('[middleware/activitypub] Key ownership cross-check passed.');
|
||||||
|
|
||||||
next();
|
next();
|
||||||
};
|
});
|
||||||
|
|
||||||
middleware.resolveObjects = async function (req, res, next) {
|
middleware.resolveObjects = async function (req, res, next) {
|
||||||
const { type, object } = req.body;
|
const { type, object } = req.body;
|
||||||
|
|||||||
Reference in New Issue
Block a user