Error 500 when receving Accept or Create from a custom ActivityPub server
In order to test some things about ActivityPub, I developed a custom server (in Python). I know very well that it is quite "experimental" (meaning: broken). Nevertheless, I'm surprised at errors 500 that Pleroma return. If my activities are broken, I would prefer Pleroma to return a 4xx error.
Here is an example: I follow an user from Pleroma, so Pleroma sends me a Follow activity, I reply with Accept and the Accept triggers 500. Here is the Accept:
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://ap.bortzmeyer.fr/actors/foobar#accepts/follows/",
"type": "Accept",
"actor": "https://ap.bortzmeyer.fr/actors/foobar",
"object": {
"id": "https://pleroma.bortzmeyer.fr/activities/8c4da12f-bcef-4c07-b911-1b6a94361d63",
"type": "Follow",
"actor": "https://pleroma.bortzmeyer.fr/users/stephane"
}
}
It is signed '('Date': 'Sun, 23 Jun 2019 13:58:51 GMT', 'Signature': 'keyId="https://ap.bortzmeyer.fr/actors/foobar#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest",signature="iPGDwlJLcWaacqCLhbtptlfY8uCXABBemUTWcKacukmI+H6YZ2VHf32pY/kGCRayicg6HeP5T5TtX0OVWIyXzoMmE9Ya42dzF0Do5IOCLF3DHdfGhPnMsmMj57XVVGp+Xrr/aqPUMdeX09/yaH0WzjbdPCnLW5zWHY2y8e2/rEfaXJQH43ckKj8FsK8CDdQDt4PUlp6/IXtfKmEJtU+CHRGzOitPZXdlh+xFV/b13s9A5cja0XBAte41KcbmyvgnbyBQkeJkyAE3/hisujM7MYLHj3ghbO9ld5+tP1yPVZFOqCTrNFgIF7V/eqvi7m6jVH6yrgd6efjNSXlOyWwJyA=="', 'Digest': 'SHA-256=86le0kO5eX5A2dPfd2o+6bX9COve0FelBacqZ3D0mU4=', 'User-Agent': 'Tonola/0.0')'
You can get the actor from https://ap.bortzmeyer.fr/actors/foobar if you want to check.
Here is the stack trace on the Pleroma side:
18:54:07.944 request_id=FaqaF9KKtcc2Gez4AJMx [info] POST /inbox
18:54:07.944 request_id=FaqaF9KKtcc2Gez4AJMx [debug] Processing with Pleroma.Web.ActivityPub.ActivityPubC
ontroller.inbox/2
Parameters: %{}
Pipelines: [:activitypub]
18:54:07.944 request_id=FaqaF9KKtcc2Gez4AJMx [debug] Checking sig for
18:54:07.945 request_id=FaqaF9KKtcc2Gez4AJMx [error] Internal server error: %ArgumentError{message: "argu
ment error"}
18:54:07.945 request_id=FaqaF9KKtcc2Gez4AJMx [info] Sent 500 in 776µs
18:54:07.945 request_id=FaqaF9KKtcc2Gez4AJMx [info] Converted error :badarg to 500 response
18:54:07.972 [error] #PID<0.1983.0> running Pleroma.Web.Endpoint (connection #PID<0.1982.0>, stream id 1)
terminated
Server: pleroma.bortzmeyer.fr:80 (http)
Request: POST /inbox
** (exit) an exception was raised:
** (ArgumentError) argument error
(stdlib) :binary.match("keyId=\"https://ap.bortzmeyer.fr/actors/camille#main-key\",algorithm=\"rs
a-sha256\",headers=\"(request-target) host date digest\",signature=\"qoWhJqzwsX3HEP3jb4py2d04yMPcjBqjHhRf
P2VUaOXnowkkNY1N5+jOGyAJuu7HnvtCU6Yy0a5ZfwTaEK4rJvk4CAEufmdvvT95thLZSivish55BeEdigkoTkDee+0Tao3vPfstF4cWx
tBUweIZ4Z20Q2JekRM6OhuLAJUW/N5frk5MSTCI1STZdvsjpG9MlNoI3NEsUiZQOGgYo1aCa1y9znCaKvhzx/rcRewT/UsQlZhNKRM2eO
PYbj4nkxdSNH5EE8YqRa3yMofm8OAT2rAOd9t+7FYiYsqIhF/gRK+/zqNZTKO6QLx4uTBUZOz1NbdC0z9Jl4ouhaiOi5EzJQ==\"", ni
l)
(elixir) lib/string.ex:2128: String.contains?/2
(pleroma) lib/pleroma/plugs/http_signature.ex:24: Pleroma.Web.Plugs.HTTPSignaturePlug.call/2
(pleroma) Pleroma.Web.Router.activitypub/2
(pleroma) lib/pleroma/web/router.ex:5: Pleroma.Web.Router.__pipe_through19__/1
(phoenix) lib/phoenix/router.ex:275: Phoenix.Router.__call__/2
(pleroma) lib/pleroma/web/endpoint.ex:5: Pleroma.Web.Endpoint.plug_builder_call/2
(pleroma) lib/pleroma/web/endpoint.ex:5: Pleroma.Web.Endpoint.call/2
The 'Check sig for' at the beginning indicates no user is known but I cannot understand why.
Note that following in the other direction (my custom server following a Pleroma account) works fine.
Mastodon has no problem with this Accept. My custom server can interact just fine with Mastodon.