From a8f82050c85dac01614940d710c7762371272ead Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Sat, 24 Dec 2022 11:58:49 -0500 Subject: [PATCH] activitypub: perform resolver block check on objects as well --- packages/backend/src/remote/activitypub/resolver.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/remote/activitypub/resolver.ts b/packages/backend/src/remote/activitypub/resolver.ts index 94b8a6503..178ea12ea 100644 --- a/packages/backend/src/remote/activitypub/resolver.ts +++ b/packages/backend/src/remote/activitypub/resolver.ts @@ -45,12 +45,18 @@ export class Resolver { } } - public async resolve(value: string | IObject, allowRedirect = false): Promise { + public async resolve(value?: string | IObject | null, allowRedirect = false): Promise { if (value == null) { throw new Error('resolvee is null (or undefined)'); } if (typeof value !== 'string') { + if (typeof value.id !== 'undefined') { + const host = extractDbHost(getApId(value)); + if (await shouldBlockInstance(host)) { + throw new Error('instance is blocked'); + } + } return value; } @@ -75,7 +81,7 @@ export class Resolver { } if (await shouldBlockInstance(host)) { - throw new Error('Instance is blocked'); + throw new Error('instance is blocked'); } if (!this.user) {