HomeMusing Studio

fix(activitypub): Improved robustness of the logic that handles the protocol
bf1b616873dbUnpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

fix(activitypub): Improved robustness of the logic that handles the protocol

This commit improves protocol handling and error resilience for incoming
and outgoing ActivityPub payloads.

  • Refactored inbox handling to robustly parse and log incoming activity payloads, including raw body capture and detailed debug logging.
  • Ensured all response paths send a valid empty JSON response instead of propagating errors or triggering crashes, especially for unhandled activities.
  • Improved callback logic to reliably mark responses as handled (responseWritten) and prevent duplicate responses.
  • Added outgoing activity logging (logOutgoingActivity) for better visibility into federated payload structure.
  • Ensured proper error handling and logging for outgoing POST requests, including checks for empty target URLs.
  • Avoid 500 errors due to empty response objects.
  • Improved protocol stability for federating posts, including accurate labeling and debug output for both Create and Update activities.
  • Added deduplication and normalization logic for attachments and outgoing object structure to maximize compatibility with other implementations.
  • Enhanced maintainability by consolidating debug and error logs for easier troubleshooting.

These changes aim to ensure:

  • Maximum compatibility with remote ActivityPub implementations (Akkoma/Pleroma, Mastodon, etc.).
  • Improved diagnostics and easier protocol debugging.
  • Reduced risk of protocol-induced crashes or silent failures on either side.

Fixes: #1436, #1415

Details

Provenance
Fabio Manganiello <fabio@manganiello.tech>Authored on Aug 4 2025, 12:15 AM
Parents
rWF72fa575fee4c: Merge pull request #1372 from writefreely/fix-context-security
Branches
Unknown
Tags
Unknown
References
refs/pull/1437/head

Event Timeline