Node.js based forum software built for the modern web
test: fixed improper signed_string reconstruction in `.verify()`
Julian Lamcc0d18869a74
diff --git a/src/activitypub/index.js b/src/activitypub/index.jsindex 95f1e98024..a986cb2335 100644--- a/src/activitypub/index.js+++ b/src/activitypub/index.js@@ -136,7 +136,7 @@ ActivityPub.verify = async (req) => {// Re-construct signature stringconst signed_string = headers.split(' ').reduce((memo, cur) => {if (cur === '(request-target)') {- memo.push(`${cur}: ${String(req.method).toLowerCase()} ${req.path}`);+ memo.push(`${cur}: ${String(req.method).toLowerCase()} ${req.baseUrl}${req.path}`);} else if (req.headers.hasOwnProperty(cur)) {memo.push(`${cur}: ${req.headers[cur]}`);}diff --git a/test/activitypub.js b/test/activitypub.jsindex d56a57395b..d59fe1cbc1 100644--- a/test/activitypub.js+++ b/test/activitypub.js@@ -261,9 +261,11 @@ describe('ActivityPub integration', () => {describe('.verify()', () => {let uid;let username;+ const baseUrl = nconf.get('relative_path');const mockReqBase = {method: 'GET',// path: ...+ baseUrl,headers: {// host: ...// date: ...