writefreely icon indicating copy to clipboard operation
writefreely copied to clipboard

Broken federation

Open blacklight opened this issue 5 months ago • 2 comments

Describe the bug

This is a bug that started to occur only lately. Federation used to work properly until at least a couple of months ago.

Now any content created recently on my instance doesn't get forwarded to the Fediverse (tested with Mastodon and Akkoma). Only old posts are visible.

Steps to reproduce (if necessary)

  1. Create an instance with active federation
  2. Subscribe to the account on your instance through Mastodon/Akkoma
  3. Create a new post on Writefreely
  4. Wait for the subscribed instance to call the /inbox endpoint

Relevant --debug logs:

2025/08/03 19:59:18 Rec'd! "POST /api/collections/fabio/inbox HTTP/1.0\r\nHost: manganiello.blog\r\nAccept-Encoding: gzip\r\nConnection: close\r\nContent-Length: 792\r\nContent-Type: application/activity+json\r\nDate: Sun, 03 Aug 2025 17:59:18 GMT\r\nDigest: SHA-256=Rsr7lZdw7F7XRym7Tn482sxLBbFa+hMsmb5nViuZd0w=\r\nSignature: keyId=\"https://mastodon.social/users/mark4#main-key\",algorithm=\"rsa-sha256\",headers=\"host date digest content-type (request-target)\",signature=\".....\"\r\nTraceparent: .....\r\nUser-Agent: Mastodon/4.5.0-nightly.2025-07-31 (http.rb/5.3.1; +https://mastodon.social/)\r\nX-Forwarded-For: 188.245.82.124, 10.0.0.1\r\nX-Forwarded-Ssl: on\r\nX-Real-Ip: 10.0.0.1\r\n\r\n{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\"],\"id\":\"https://mastodon.social/users/mark4#delete\",\"type\":\"Delete\",\"actor\":\"https://mastodon.social/users/mark4\",\"to\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"object\":\"https://mastodon.social/users/mark4\",\"signature\":{\"type\":\"RsaSignature2017\",\"creator\":\"https://mastodon.social/users/mark4#main-key\",\"created\":\"2025-08-03T17:57:47Z\",\"signatureValue\":\".....\"}}"
2025/08/03 19:59:18 "POST /api/collections/fabio/inbox" 200 401.02307ms "Mastodon/4.5.0-nightly.2025-07-31 (http.rb/5.3.1; +https://mastodon.social/)"
ERROR: 2025/08/03 19:59:18 activitypub.go:611: No `to` value!

Note that the error complains about no to value being present, but the request actually contains a to value.

Expected behavior

The new content gets relayed when the subscribed calls /inbox.

Application configuration

  • Single mode or Multi-user mode? Single
  • Database? mysql
  • Open registration? no
  • Federation enabled? yes

Version or last commit: 72fa575

blacklight avatar Aug 03 '25 18:08 blacklight

I have tried to comment this condition, since the value of to isn't used anyway in the coroutine https://github.com/writefreely/writefreely/blob/c249abdb10cfd5f4e63518f01f6ceeac84e7ac5e/activitypub.go#L609

Now I get:

ERROR: 2025/08/03 20:33:47 activitypub.go:729: Can't dump: unsupported protocol scheme ""
ERROR: 2025/08/03 20:33:47 activitypub.go:628: Unable to make activity POST: Post "": unsupported protocol scheme ""

Which seems to be the same issue as https://github.com/writefreely/writefreely/issues/1415

So it looks to me like something a bit deeper is broken with the way WF parses federation payloads?

blacklight avatar Aug 03 '25 18:08 blacklight

I have opened an MR that seems to fix this behaviour, plus adds better logging for ActivityPub in general.

It seems to also fix #1415 at least in my tests but it requires further testing.

Now federation works with my Mastodon profiles, but it still breaks with Pleroma/Akkoma - but at a first look this seems to be broken on Pleroma's side, so I'll probably submit a bug there.

blacklight avatar Aug 04 '25 00:08 blacklight