Skip to content

Commit 190da99

Browse files
committed
Harden inbox actor handling and Note dispatcher
Use the `isActor()` predicate from `@fedify/vocab` instead of `instanceof Person` when accepting an incoming Follow. Throwing on non-Person actors caused Fedify to treat the inbox delivery as failed and the remote server to retry indefinitely, even though `Service`, `Application`, `Group`, and `Organization` are all valid ActivityPub actors. Validate the path identifier inside the Note object dispatcher so the demo follows the same `IDENTIFIER` guard pattern already used by the actor, key-pairs, and followers dispatchers in this file. The current `postStore` shape makes the mismatch unreachable, but the explicit guard makes the invariant local instead of relying on how posts happen to be keyed. fedify-dev#676 Assisted-by: Claude Code:claude-opus-4-7
1 parent a88e611 commit 190da99

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎examples/nuxt/server/federation.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Endpoints,
1010
Follow,
1111
Image,
12+
isActor,
1213
Note,
1314
Person,
1415
PUBLIC_COLLECTION,
@@ -90,9 +91,7 @@ federation
9091
return;
9192
}
9293
const follower = await follow.getActor(context);
93-
if (!(follower instanceof Person) || follower.id == null) {
94-
throw new Error("follower is not a Person");
95-
}
94+
if (!isActor(follower) || follower.id == null) return;
9695
await context.sendActivity(
9796
{ identifier: result.identifier },
9897
follower,
@@ -125,6 +124,7 @@ federation.setObjectDispatcher(
125124
Note,
126125
"/users/{identifier}/posts/{id}",
127126
(ctx, values) => {
127+
if (values.identifier !== IDENTIFIER) return null;
128128
const id = ctx.getObjectUri(Note, values);
129129
const post = postStore.get(id);
130130
if (post == null) return null;

0 commit comments

Comments
 (0)