mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
test: fixed improper signed_string reconstruction in .verify()
This commit is contained in:
@@ -136,7 +136,7 @@ ActivityPub.verify = async (req) => {
|
||||
// Re-construct signature string
|
||||
const 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]}`);
|
||||
}
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user