Skip to content

Commit

Permalink
test: fixed improper signed_string reconstruction in .verify()
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Aug 9, 2023
1 parent e2bb293 commit 6a5b0fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/activitypub/index.js
Expand Up @@ -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]}`);
}
Expand Down
2 changes: 2 additions & 0 deletions test/activitypub.js
Expand Up @@ -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: ...
Expand Down

0 comments on commit 6a5b0fa

Please sign in to comment.