summaryrefslogtreecommitdiff
path: root/src/remote
diff options
context:
space:
mode:
authornullobsi <me@nullob.si>2021-09-17 23:45:02 -0700
committerGitHub <noreply@github.com>2021-09-18 15:45:02 +0900
commitd5702f9d51b0d29cfc6fdb464f31ab41ff4fd2cd (patch)
tree68551aed585499e47b54b5f613f280ecd7924ea5 /src/remote
parentfix(client): タイムラインでリストとかなかったの修正 (diff)
downloadsharkey-d5702f9d51b0d29cfc6fdb464f31ab41ff4fd2cd.tar.gz
sharkey-d5702f9d51b0d29cfc6fdb464f31ab41ff4fd2cd.tar.bz2
sharkey-d5702f9d51b0d29cfc6fdb464f31ab41ff4fd2cd.zip
add resolver check for blocked instance (#7777)
* add resolver check for blocked instance * lint * Update note.ts
Diffstat (limited to 'src/remote')
-rw-r--r--src/remote/activitypub/resolver.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/remote/activitypub/resolver.ts b/src/remote/activitypub/resolver.ts
index 32f3d9ef26..f392a65e3a 100644
--- a/src/remote/activitypub/resolver.ts
+++ b/src/remote/activitypub/resolver.ts
@@ -4,6 +4,8 @@ import { ILocalUser } from '@/models/entities/user';
import { getInstanceActor } from '@/services/instance-actor';
import { signedGet } from './request';
import { IObject, isCollectionOrOrderedCollection, ICollection, IOrderedCollection } from './type';
+import { fetchMeta } from '@/misc/fetch-meta';
+import { extractDbHost } from '@/misc/convert-host';
export default class Resolver {
private history: Set<string>;
@@ -44,6 +46,12 @@ export default class Resolver {
this.history.add(value);
+ const meta = await fetchMeta();
+ const host = extractDbHost(value);
+ if (meta.blockedHosts.includes(host)) {
+ throw new Error('Instance is blocked');
+ }
+
if (config.signToActivityPubGet && !this.user) {
this.user = await getInstanceActor();
}