Drop deletes from actors that don't exist anymore
ci/woodpecker/pr/lint-sw Pipeline was successful Details
ci/woodpecker/pr/lint-backend Pipeline was successful Details
ci/woodpecker/pr/lint-client Pipeline was successful Details
ci/woodpecker/pr/build Pipeline was successful Details
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful Details
ci/woodpecker/pr/test Pipeline was successful Details

Mastodon sends delete activities for every single note of an actor after
they are deleted, even though it usually sends a delete activity for the
actor itself from the start. These messages fail processing since we
can't verify the signature anymore (we have deleted the actor together
with their notes and keys with the delete activity for the actor itself,
and it's obviously not possible to look it up anymore), and stick around
in the inbox queue for all of the retries, which can take quite a while.
But since we can't have anything from actors that we can't
resolve, we can safely ignore the deletion request from them.

Changelog: Fixed
This commit is contained in:
Ignas Kiela 2023-09-14 19:04:18 +03:00
parent 0cb4529ed0
commit 2ba387a5ac
1 changed files with 9 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instanc
import { Instances } from '@/models/index.js';
import { apRequestChart, federationChart, instanceChart } from '@/services/chart/index.js';
import { extractPunyHost } from '@/misc/convert-host.js';
import { getApId } from '@/remote/activitypub/type.js';
import { getApId, isDelete } from '@/remote/activitypub/type.js';
import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js';
import { Resolver } from '@/remote/activitypub/resolver.js';
import { LdSignature } from '@/remote/activitypub/misc/ld-signature.js';
@ -28,7 +28,14 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
delete info['@context'];
logger.debug(JSON.stringify(info, null, 2));
//#endregion
if (isDelete(activity)) {
try {
await resolver.resolve(getApId(activity.actor))
} catch (error) {
logger.info("Dropped deletion request from actor that no longer exists")
return 'ok';
}
}
const validated = await verifyHttpSignature(signature, resolver, getApId(activity.actor));
let authUser = validated.authUser;