skymethod / minipub

Minimal ActivityPub implementation focused on commenting
https://minipub.dev
MIT License
58 stars 0 forks source link

Get Castopod working #1

Closed johnspurlock-skymethod closed 2 years ago

johnspurlock-skymethod commented 2 years ago

Castopod has their own custom fediverse support, assuming they've tested with incoming comments from Mastodon. Code appears to be in their Fediverse module.

First thing found when trying to send a federated comment over to a Castopod v1.0 beta server: you need to include the algorithm parameters in the http signature (which is optional in the spec), and make sure you send the signature parameters in the exact order Castopod expects in their regex.

Once you get past the signature checking, the federation call fails with a 500 response code with no body, so hard to tell what's going wrong.

Request from Minipub (this type of call works when sending to Mastodon & Pleroma):

POST https://beta.castopod.ovh/@castopod/inbox
date: Fri, 28 Jan 2022 19:16:20 GMT
signature: keyId="https://minipub.server/actors/c836a885674848f9bfc42742802b2703#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest",signature="<base64>"
digest: SHA-256=<base64>
content-type: application/activity+json

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "id": "https://minipub.server/actors/c836a885674848f9bfc42742802b2703/activities/e15f2ab701284269ac143d5d7e24c51b",
  "type": "Create",
  "actor": "https://minipub.server/actors/c836a885674848f9bfc42742802b2703",
  "object": {
    "id": "https://minipub.server/actors/c836a885674848f9bfc42742802b2703/objects/4ff3fe45dca04791b3c0203e9fa37912",
    "type": "Note",
    "published": "2022-01-25T17:21:01.278Z",
    "attributedTo": "https://minipub.server/actors/c836a885674848f9bfc42742802b2703",
    "inReplyTo": "https://beta.castopod.ovh/@castopod/posts/7ca3652b-ca62-4a35-8de9-6a73e0702127",
    "contentMap": {
      "en": "👍"
    },
    "to": [
      "https://www.w3.org/ns/activitystreams#Public"
    ],
    "cc": [
      "https://beta.castopod.ovh/@castopod"
    ]
  },
  "published": "2022-01-25T17:21:01.278Z"
}

Response from Castopod:

500 https://beta.castopod.ovh/@castopod/inbox
cache-control: no-store, max-age=0, no-cache
content-type: text/html; charset=UTF-8
date: Fri, 28 Jan 2022 19:16:21 GMT

(no body)

It would be great to get any server-side logging on this. If it's an unhandled exception, maybe it would show up in the log.

johnspurlock-skymethod commented 2 years ago

Still getting 500s after trying a few things I could think of:

Hmm, I would really love to see the backend logs for this, want to avoid setting up my own castopod just to test this.

Better errors responses from Castopod would of course be ideal

yassinedoghri commented 2 years ago

Working on it! Thanks for investigating 🙂

I fixed the issue regarding the http signature checks being too strict. I'm awaiting logs on my test instance to get to the bottom of the 500 errors.

Here's the WIP merge request: https://code.podlibre.org/podlibre/castopod-host/-/merge_requests/168/diffs

yassinedoghri commented 2 years ago

I've released Castopod v1.0.0-beta.6 with the fixes.

Thanks for all your work and feedback!

johnspurlock-skymethod commented 2 years ago

Alright, considering this closed with the latest Castopod beta - hopefully it gets installed far and wide. Thanks @yassinedoghri for the changes!