go-fed / activity

ActivityStreams & ActivityPub in golang, oh my!
BSD 3-Clause "New" or "Revised" License
703 stars 112 forks source link

Return error for bad parameters to New*Pubber #75

Closed ghost closed 5 years ago

ghost commented 5 years ago

I'm trying to create a document posted by James (port 8001) that will be received by Jess (port 8000).

I post the following to James' outbox.

{
    "@context":"https://www.w3.org/ns/activitystreams",
    "cc":"http://100.115.94.204:8000/activity/person/jess",
    "name":"ActivityPub",
    "to":"https://www.w3.org/ns/activitystreams#Public",
    "type":"Document",
    "url":"https://www.w3.org/TR/activitypub/"
}

This triggers C2S on James' server:

2018/08/09 11:01:26 Starting server...                                                                                  
2018/08/09 11:01:35 BEGIN SocialAPI GetSocialAPIVerifier
2018/08/09 11:01:35 END SocialAPI GetSocialAPIVerifier

2018/08/09 11:01:35 BEGIN SocialAPI ActorIRI
2018/08/09 11:01:35 END SocialAPI ActorIRI

The server wraps the object in a Create Activity for us, and sets the document:

2018/08/09 11:01:35 BEGIN New ID
2018/08/09 11:01:35 ID type Create
2018/08/09 11:01:35 END New ID

2018/08/09 11:01:35 BEGIN New ID
2018/08/09 11:01:35 ID type Document
2018/08/09 11:01:35 END New ID

2018/08/09 11:01:35 BEGIN About to set
2018/08/09 11:01:35 Setting: map[cc:http://100.115.94.204:8000/activity/person/jess attributedTo:http://100.115.92.204:8001/activity/person/james name:ActivityPub id:http://100.115.92.204:8001/document type:Document url:https://www.w3.org/TR/activitypub/ to:https://www.w3.org/ns/activitystreams#Public]
2018/08/09 11:01:35 SET document initiated
2018/08/09 11:01:35 END About to set

Callbacker is called:

2018/08/09 11:01:35 SocialCallbacker CREATE &{0x44202e7180}

James' outbox is set with the Create activity:

2018/08/09 11:01:35 BEGIN GetOutbox: /activity/person/james/outbox
2018/08/09 11:01:35 END GetOutbox: /activity/person/james/outbox

2018/08/09 11:01:35 BEGIN About to set
2018/08/09 11:01:35 Setting: map[actor:http://100.115.92.204:8001/activity/person/james object:map[to:https://www.w3.org/ns/activitystreams#Public cc:http://100.115.94.204:8000/activity/person/jess attributedTo:http://100.115.92.204:8001/activity/person/james name:ActivityPub id:http://100.115.92.204:8001/document type:Document url:https://www.w3.org/TR/activitypub/] id:http://100.115.92.204:8001/create type:Create to:https://www.w3.org/ns/activitystreams#Public cc:http://100.115.94.204:8000/activity/person/jess]
2018/08/09 11:01:35 SET create initiated
2018/08/09 11:01:35 END About to set

2018/08/09 11:01:35 BEGIN About to set
2018/08/09 11:01:35 Setting: map[orderedItems:http://100.115.92.204:8001/create id:http://100.115.92.204:8001/activity/person/james/outbox type:OrderedCollection]
2018/08/09 11:01:35 SET person (outbox) initiated
2018/08/09 11:01:35 END About to set

Then some more things happen:

2018/08/09 11:01:35 BEGIN FederateAPI NewSigner
2018/08/09 11:01:35 END FederateAPI NewSigner

2018/08/09 11:01:35 BEGIN FederateAPI PrivateKey
2018/08/09 11:01:35 END FederateAPI PrivateKey

All is well on the C2S side. James has a copy of the document on his server. However, Jess never received the document in her inbox.

James' server should look up Jess' ActivityStreams actor object, find her inbox endpoint, and POST his document to her inbox.

ghost commented 5 years ago

This turned out to be an implementation bug rather than a library bug. I had the deliverer interface wrongly configured. I forgot to set the variable maxDeliveryDepth which gave it a default value of 0. The line https://github.com/go-fed/activity/blob/be4644fbcaebd00895e7fff859c97ce7df3c66c0/pub/internal.go#L777 then ended up filtering out the CC'd actors as a result. Setting a value for maxDeliveryDepth fixes this issue for me.

Leaving the issue open for any warnings/errors that may want to be added to prevent others from facing this issue.

cjslep commented 5 years ago

I think in the next major version I will have the Pubber creation functions return an error in this case.

elmaria commented 5 years ago

@cjslep is this something you'd like any help with? :smiley:

cjslep commented 5 years ago

Hi @elmaria, I would be happy for the help!

I just created a dev branch, let's use it until v1 is ready to be merged to master.

elmaria commented 5 years ago

Great, thanks! I'll check it out when I get a chance :blush:

cjslep commented 5 years ago

Hi @elmaria if you are still interested in helping out, I apologize for the confusion but I now have a v1.0.0 branch I plan to use for all of the v1 development without bothering master.

If you're no longer interested, no worries!

elmaria commented 5 years ago

Hey!

Sorry I've been pretty busy recently so don't have the time, but I'm definitely still interested in the project so I'll stick with watching for now 😊

On Sat, Jan 26, 2019 at 9:45 PM Cory J Slep notifications@github.com wrote:

Hi @elmaria https://github.com/elmaria if you are still interested in helping out, I apologize for the confusion but I now have a v1.0.0 branch I plan to use for all of the v1 development without bothering master.

If you're no longer interested, no worries!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/go-fed/activity/issues/75#issuecomment-457868536, or mute the thread https://github.com/notifications/unsubscribe-auth/ArUvgMh9iNBuMKyC5C2bkih3OIvkQo21ks5vHMxegaJpZM4V2IhP .

cjslep commented 5 years ago

Note that in the latest port for v1, it won't be possible to misconfigure like what happened here. I don't think the constructors are likely to change at this point, so I am closing this issue.