mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 01:26:16 +01:00
fix: closes #13405, catch errors in ap.verify
This commit is contained in:
@@ -232,6 +232,8 @@ ActivityPub.verify = async (req) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify the signature string via public key
|
||||||
|
try {
|
||||||
// Break the signature apart
|
// Break the signature apart
|
||||||
let { keyId, headers, signature, algorithm, created, expires } = req.headers.signature.split(',').reduce((memo, cur) => {
|
let { keyId, headers, signature, algorithm, created, expires } = req.headers.signature.split(',').reduce((memo, cur) => {
|
||||||
const split = cur.split('="');
|
const split = cur.split('="');
|
||||||
@@ -273,8 +275,6 @@ ActivityPub.verify = async (req) => {
|
|||||||
return memo;
|
return memo;
|
||||||
}, []).join('\n');
|
}, []).join('\n');
|
||||||
|
|
||||||
// Verify the signature string via public key
|
|
||||||
try {
|
|
||||||
// Retrieve public key from remote instance
|
// Retrieve public key from remote instance
|
||||||
ActivityPub.helpers.log(`[activitypub/verify] Retrieving pubkey for ${keyId}`);
|
ActivityPub.helpers.log(`[activitypub/verify] Retrieving pubkey for ${keyId}`);
|
||||||
const { publicKeyPem } = await ActivityPub.fetchPublicKey(keyId);
|
const { publicKeyPem } = await ActivityPub.fetchPublicKey(keyId);
|
||||||
|
|||||||
Reference in New Issue
Block a user