feat: wire on_unknown_activity to actually dispatch unknown inbound activities #22
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
ApObjectHandler::on_unknown_activityexists on the trait with a default no-op, but the inbox handler never calls it. Unknown activity types are silently accepted (200 response) but the consumer's implementation is never invoked.The root cause:
activitypub_federation'sActivityDataconsumes the request body during signature verification. When deserialization of the knownInboxActivitiesenum fails, the raw body is gone — we can't re-parse it to extract the type and forward toon_unknown_activity.Possible approaches
Clone the body via middleware — buffer the request body before
ActivityDataconsumes it. Pass a clone toActivityDatafor signature verification, keep the original for fallback parsing on deserialization failure.Reimplement the inbox pipeline — bypass
receive_activityentirely. Deserialize the raw body ourselves, try the known enum, fall back toon_unknown_activity, then use the federation library's lower-level signature verification primitives.Upstream PR — make
ActivityData.bodypublic or add an accessor, so we can read the body afterreceive_activityfails.Current behavior
Unknown types get HTTP 200 (good — prevents remote retries) but the consumer is never notified. The trait method is documented with this limitation.