diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b0577fe32b..e8a07b416c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - Enhance: リモートノートクリーニングジョブの削除対象検索処理のパフォーマンス改善 - Fix: センシティブメディア自動検出周りの依存関係・ファイルの解決に失敗する問題を修正 - Fix: フォロワー限定投稿を指名投稿で引用した際に、引用した投稿の公開範囲が意図せず変更される問題を修正 +- Fix: `actor` を持たないInboxアクティビティを受信した際に `getApId()` が `TypeError` を投げて配送ジョブがクラッシュする問題を修正 ## 2026.5.4 diff --git a/packages/backend/src/core/activitypub/type.ts b/packages/backend/src/core/activitypub/type.ts index 72732b01dfe..be867156275 100644 --- a/packages/backend/src/core/activitypub/type.ts +++ b/packages/backend/src/core/activitypub/type.ts @@ -58,8 +58,8 @@ export function getOneApId(value: ApObject): string { */ export function getApId(value: string | IObject): string { if (typeof value === 'string') return value; - if (typeof value.id === 'string') return value.id; - throw new Error('cannot detemine id'); + if (value != null && typeof value.id === 'string') return value.id; + throw new Error('cannot determine id'); } /** diff --git a/packages/backend/src/queue/processors/InboxProcessorService.ts b/packages/backend/src/queue/processors/InboxProcessorService.ts index b7557ddb6f9..7c2d3c22cfe 100644 --- a/packages/backend/src/queue/processors/InboxProcessorService.ts +++ b/packages/backend/src/queue/processors/InboxProcessorService.ts @@ -73,6 +73,12 @@ export class InboxProcessorService implements OnApplicationShutdown { this.logger.debug(JSON.stringify(info, null, 2)); //#endregion + // Activities without an actor are invalid; skip them cleanly instead of + // throwing a TypeError deep inside getApId(activity.actor). + if (activity.actor == null) { + throw new Bull.UnrecoverableError('skip: activity has no actor'); + } + const host = this.utilityService.toPuny(new URL(signature.keyId).hostname); if (!this.utilityService.isFederationAllowedHost(host)) {