Repository navigation
Let Group members update stored Group posts - #3938
faisalahammad wants to merge 3 commits into
Conversation
Some Group implementations, like Mobilizon, let a member send the Update for an object attributed to the Group. The shared inbox only looked up followers of the activity actor, so local followers of the Group got no recipients and the activity was dropped. - Trust a same-host attributedTo, like Mastodon does, but only when it is a cached remote actor of type Group. - Add its followers when the activity is public, or when it is addressed to the Group's own followers collection. - Check at most five attributedTo entries. Fixes Automattic#3883
pfefferle
left a comment
There was a problem hiding this comment.
Thanks @faisalahammad for picking this up!
I am not sure the inbox recipients are the right place for this. A few things I noticed:
Remote_Posts::add()only accepts a Create if theactormatchesattributedTo, andRemote_Posts::update()checks the actor against the stored owner. So the activities this lets through the inbox will be rejected later anyway, at least for the reader. The tests only check the recipient list, not that something is stored.- Same host as the only check is quite open. Any account on a Lemmy, PeerTube or Mobilizon instance could send a post attributed to a Group on that instance to all WordPress followers of that Group. Normally the Group announces the content, so it can moderate it. Here nothing checks that the actor is a member.
- A Delete often only has the object URI or a
TombstonewithoutattributedTo, so I think Delete is not covered, but #3883 is mainly about Update and Delete. get_attributed_groups()runs for every incoming activity, before the public check, with up to 5 queries plus parsing the actor JSON.
My idea would be to keep it smaller: only Update and Delete, only for objects we already stored, and only if the stored owner is a Group on the same host as the actor. That check would live in the handler (or Remote_Posts), not in the recipient lookup. New content from a Group would still come through the Announce of the Group.
/cc @Menrath, is "same host" enough for Mobilizon, or do you think we need a membership check?
… recipients Move the Group handling out of the inbox recipient lookup, as suggested in review. Remote_Posts::update() now also accepts an Update from an actor on the same host when the stored owner of the post is a Group. New content from a Group still comes in through the Group's Announce, and Deletes of stored posts are already checked against the origin with a tombstone lookup.
|
Thanks @pfefferle, good points. I changed it to your idea in c993366.
I kept "same host" as the only check for now, and wait for @Menrath on the membership question. I also updated the PR description. |
I don't know myself how Mobilizon Group architecture works. I tried to dig into that a while ago and gave up. But I guess
I think this argument does not fit for Server-to-Server federation. We have to trust an remote origin anyway. If anyone could just freely make their Server send malicious Server-to-Server content, it is a clear bug on their side? |
Fixes #3883
Proposed changes:
Updatefor a Group's object from a member of the Group, not from the Group itself.Remote_Posts::update()only accepted anUpdatefrom the actor that owns the stored post, so these edits were rejected and the reader kept the old version.Remote_Posts::update()now also accepts theUpdatewhen the stored owner of the post is a cached remote actor of typeGroupand the actor is on the same host as that Group.Announce, so the Group can still moderate it.get_local_recipients(); that approach was removed after review.Delete::maybe_delete_post()checks for a tombstone at the origin before it removes a stored post, so it does not depend on who sent theDelete.Other information:
The Group check only runs when the actor is not the stored owner, so normal updates have no extra cost. A Person's post can still only be updated by that Person, even from the same host.
Testing instructions:
activitypub_create_posts).Updateis rejected withactivitypub_update_forbiddenand the stored event keeps the old title and content. After: the stored event shows the new title and content.Updatefor that stored event from an account on another server. It must still be rejected.Updatefrom a Mastodon account for a stored post of another Person on the same server. It must still be rejected.npm run env-test -- --filter Test_Remote_PostsChangelog entry
Changelog Entry Details
Significance
Type
Message
Edits that a member of a group you follow makes to the group's posts, like a Mobilizon event, now show up in your reader.