snarfed / bridgy-fed

πŸŒ‰ A bridge between decentralized social network protocols
https://fed.brid.gy
Creative Commons Zero v1.0 Universal
574 stars 30 forks source link

Web => AP: wrong actor and author ids in outgoing AS2 activities #700

Closed snarfed closed 11 months ago

snarfed commented 11 months ago

Looks like this regressed recently, not sure why yet. Thanks for reporting @starrwulfe! Eg https://starrwulfe.xyz/2023/10/27/00/05/32030/ turned into this AS2:

{
  "id": "https://fed.brid.gy/r/https://starrwulfe.xyz/2023/10/27/00/05/32030/#bridgy-fed-create",
  "actor": "https://starrwulfe.xyz/2023/10/13/11/39/403/",
  "published": "2023-10-27T04:05:26.515058+00:00",
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "object": {
    "published": "2023-10-27T00:05:19-04:00",
    "updated": "2023-10-27T00:05:19-04:00",
    "content": "<p>Here\u2019s a test reply.</p>\n<p>This better work or else I gotta beg @snarfed.org@snarfed.org for help.</p>",
    "url": "https://fed.brid.gy/r/https://starrwulfe.xyz/2023/10/27/00/05/32030/",
    "id": "https://fed.brid.gy/r/https://starrwulfe.xyz/2023/10/27/00/05/32030/",
    "type": "Note",
    "attributedTo": "https://starrwulfe.xyz/author/starrwulfe/",
    "inReplyTo": "https://friendica.opensocial.space/objects/8ffdf77c-5065-3b27-9512-cd7842048008",
    "cc": [
      "https://friendica.opensocial.space/profile/starrwulfe",
      "https://www.w3.org/ns/activitystreams#Public",
      "https://friendica.opensocial.space/followers/starrwulfe"
    ],
    "contentMap": {
      "en": "<p>Here\u2019s a test reply.</p>\n<p>This better work or else I gotta beg @snarfed.org@snarfed.org for help.</p>"
    },
    "tag": [{
        "type": "Mention",
        "href": "https://friendica.opensocial.space/profile/starrwulfe"
      }],
    "to": ["https://www.w3.org/ns/activitystreams#Public"]
  },
  "to": ["https://www.w3.org/ns/activitystreams#Public"]
}

I originally thought b7e890b4bb79db64ca05877bc72f27aa516d08c0 was the culprit, but I rolled that back and tried again and got the same result above.

Interestingly other recent posts on https://fed.brid.gy/web/starrwulfe.xyz seem to be converted and delivered fine, eg https://starrwulfe.xyz/2023/10/26/21/55/n-rodgers-chic-npr-tiny-desk/ turned into the activity below, with the correct actor and object.attributedTo (log):

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "id": "https://fed.brid.gy/r/https://starrwulfe.xyz/2023/10/26/21/55/n-rodgers-chic-npr-tiny-desk/#bridgy-fed-create",
  "actor": "https://fed.brid.gy/starrwulfe.xyz",
  "published": "2023-10-27T01:57:16.297266+00:00",
  "object": {
    "type": "Note",
    "id": "https://fed.brid.gy/r/https://starrwulfe.xyz/2023/10/26/21/55/n-rodgers-chic-npr-tiny-desk/",
    "published": "2023-10-26T21:55:36-04:00",
    "updated": "2023-10-26T21:57:01-04:00",
    "content": "...",
    "url": "https://fed.brid.gy/r/https://starrwulfe.xyz/2023/10/26/21/55/n-rodgers-chic-npr-tiny-desk/",
    "attributedTo": "https://fed.brid.gy/starrwulfe.xyz",
    "tag": [{
        "type": "Hashtag",
        "name": "#micro",
        "href": "https://fed.brid.gy/hashtag/micro"
      },
      {
        "type": "Hashtag",
        "name": "#seen",
        "href": "https://fed.brid.gy/hashtag/seen"
      }],
    "contentMap": { "en": "..." },
    "to": ["https://www.w3.org/ns/activitystreams#Public"]
  },
  "to": ["https://www.w3.org/ns/activitystreams#Public"]
}
snarfed commented 11 months ago

The plot thickens: I tried a reply just now and it worked fine, https://snarfed.org/2023-10-27_reply-heres-a-test-reply-this-better-wor-%ef%bd%93%ef%bd%94%ef%bd%81%ef%bd%92%ef%bd%92%ef%bd%97%ef%bd%95%ef%bd%8c%ef%bd%86%ef%bd%85-federated => https://friendica.opensocial.space/display/8ffdf77c-1365-3b39-1f26-cec333244032

@StarrWulfe btw, it looks like you're using both the WordPress ActivityPub plugin and Bridgy Fed with your site. For example, your original test reply on https://friendica.opensocial.space/display/8ffdf77c-1365-3b39-1f26-cec333244032 is from the plugin. You're probably going to have a bad time if you mix both of those together on the same site. Eg your site currently redirects its webfinger to Bridgy Fed, which means the plugin probably won't work very well in some ways.

@pfefferle I guess we should probably figure out some general recommendations. Maybe just "don't do that" ? 😁

StarrWulfe commented 11 months ago

Thanks for looking into this for me @snarfed! πŸ™‡

(webmention as a summoning device... who knew? πŸ˜‰)

πŸ“‘πŸ”€: 🌟🐺 https://starrwulfe.xyz/t/8tq

pfefferle commented 11 months ago

@snarfed you mean in case someone tries both? Is there an easy way that I can detect that someone is using fed.brid.gy?

StarrWulfe commented 11 months ago

@snarfed @pfefferle I had it running pretty decently with both for a good week or so before these issues started happening. Basically I had it set up where @starrwufe was going through the AP plugin on the site and @starruwlfe.net was going through BridgyFed. This would be my preferred setup of possible since there's no easy way of doing "wildcard" accounts in ActivityPub the way you can with either regular URLs or even email.

Perhaps this was an anomaly of sorts where now enough DNS caching in the network has happened to start creating some kind of "feedback loop" effect that now cancels things out?

Is there a way where I could "have my cake (@starrwulfe being served by the AP plugin on the site) and eat it too? (@starrwulfe.xyz being served by Bridgyfed)" or is there another method to do this?

snarfed commented 11 months ago

@pfefferle the clearest way is probably to check if WebFinger (.well-known/webfinger) is redirecting to fed.brid.gy or not.

snarfed commented 11 months ago

@StarrWulfe one critical part right now is WebFinger, whatever serves that does it for the entire domain, and we don't yet have a way to "share" it between multiple providers. We could build that!...but I doubt it would be high priority.

StarrWulfe commented 11 months ago

@snarfed -- I see. For some reason I was thinking webfinger could refer to both at once and let the software do the sorting. In this case, is there way to change the BridgyFed site? I'm thinking of creating a micro.starrwulfe.com that will strictly be for the back and forth replies that happen.

I currently have a Tumblr blog that has webmentions being piped to Bridgy -- will that work? Unless @pfefferle can help me with how to do some of the commenting stuff in his plugin and make it work easily...πŸ™‡πŸΎβ€β™‚οΈ

snarfed commented 11 months ago

Bridgy Fed will definitely work on micro.starrwulfe.com! It will be a different identity though, @micro.starrwulfe.com.

The key point is that WebFinger requests for all fediverse identities on a given host, eg @*@starrwulfe.xyz, have to be handled by the same single server, ie piece of software.

(Tumblr + Bridgy classic is unrelated, it'll still work fine!)

snarfed commented 11 months ago

Chalking this up to Bridgy Fed / plugin interaction, tentatively closing. @StarrWulfe feel free to reopen if anything else still seems wrong on our end!

StarrWulfe commented 11 months ago

Nope-- rectified it on my end with a workflow adjustment ✌️

@pfefferle make sure to note this in the Wordpress ActivityPub plug-in instructions so others don't make this mistake.