Align Follow tutorials with Fedify's origin-based security model - #979
Align Follow tutorials with Fedify's origin-based security model#979dahlia wants to merge 1 commit into
Follow tutorials with Fedify's origin-based security model#979Conversation
Use dispatcher-backed Follow IDs and local pending-request state so cross-origin Accept activities can be correlated without trusting embedded objects. Cover shared inbox delivery and peers that remint nested IDs, and keep framework examples and the generator template aligned. Assisted-by: Codex:gpt-5.6-sol Assisted-by: Claude Code:claude-opus-5
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow tutorials with Fedify's origin-based security model
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Fedify's
Followexamples were written before the origin-based security model from FEP-fe34 was introduced. Several tutorials therefore still treated an activity embedded by another origin as authoritative. The most visible failure occurred while handlingAccept(Follow): callingaccept.getObject()across the origin boundary caused Fedify to discard the inlineFollowand dereference its ID instead. Because the tutorial had assigned an arbitrary ID without an object dispatcher, that request reached an HTML application route and failed while being parsed as ActivityStreams JSON.Setting
crossOrigin: "trust"would hide the immediate error, but it would also teach readers to bypass the boundary that Fedify now uses to distinguish an authoritative object from an untrusted copy. That is especially undesirable in introductory material, where examples tend to become production code. The examples should make the secure path the natural path.The revised flow uses an activity ID as the reference carried by
Accept, rather than embedding the wholeFollow. For outbound requests, the tutorials record the request before sending it and use that local state to correlate the reply. docs/tutorial/microblog.md also gives each outgoingFollowa dispatcher-backed ID, so a remote server can dereference the authoritative activity at its origin, while the local inbox can verify the reply without making an HTTP request back to itself.The matching rules preserve interoperability without weakening the origin check. An exact match against the stored activity ID is preferred. A peer-minted ID may fall back to an authenticated remote actor only when the ID belongs to a remote origin and the pending request is unambiguous; a mismatched ID on the local origin is rejected. The same reasoning covers shared-inbox delivery, where no local recipient is available in the request context, and retries reuse the stored request identity instead of minting an ID that a later
Acceptcannot match.The simpler inbound examples now put
follow.idinAccept.object, and the outbound examples no longer callgetObject()merely to inspect a cross-origin inlineFollow. The related guidance in docs/manual/context.md, docs/manual/context-advanced.md, docs/manual/inbox.md, and docs/manual/migrate.md was updated for the same reason. The framework examples and .agents/skills/create-example-app-with-integration/example/src/federation.ts follow the same pattern so newly generated integrations do not reintroduce the unsafe example.