Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for reversible suspensions through ActivityPub #14989

Merged
merged 1 commit into from
Nov 7, 2020

Conversation

Gargron
Copy link
Member

@Gargron Gargron commented Oct 17, 2020

Follow-up to #14726

  • Change reversibly suspended accounts to return empty data instead of HTTP 410 (while those that cannot be restored will still return HTTP 410)
  • Change Webfinger resolution to queue full account deletion when it encounters a HTTP 410 error for an account that's still in the database

Suspension is expressed through boolean suspended attribute on the actor, and changes are distributed using the standard Update activity. This means that handling suspended accounts works pretty much the same if you receive the event live or encounter the suspended account in the wild. Accounts that were suspended locally cannot be unsuspended remotely. On the other hand, we no longer ignore Update, Undo, Reject, and Delete events for accounts that were suspended.

@Gargron Gargron force-pushed the feature-suspensions-federation branch 2 times, most recently from 9568cae to 0a8a1d1 Compare October 18, 2020 00:11
@Gargron Gargron changed the title Add federation support for reversible account suspensions Add support for reversible suspensions through ActivityPub Oct 18, 2020
@Gargron Gargron added the activitypub Protocol-related changes, federation label Oct 18, 2020
@Gargron Gargron marked this pull request as ready for review October 18, 2020 00:12
@Gargron Gargron force-pushed the feature-suspensions-federation branch 2 times, most recently from db01b5d to 8d39c88 Compare October 18, 2020 03:49
@ClearlyClaire ClearlyClaire self-requested a review October 18, 2020 15:58
@Gargron Gargron force-pushed the feature-suspensions-federation branch from 8d39c88 to c204e8c Compare October 19, 2020 02:04
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to do a second review pass, but here are a few inline comments (most of them minor) for now.

More generally, I'm a bit worried about the suspension_origin enum making the logic a bit more complicated and error-prone (but I also understand it's useful for not having to change how suspended accounts are looked up/checked).

Another thing I'm a bit worried about is the two instances not agreeing on the suspension status of some user, which could result in yet another occurrence of “ghost followers”.

app/controllers/concerns/account_owned_concern.rb Outdated Show resolved Hide resolved
Comment on lines +225 to +229
def suspended_permanently?
suspended? && deletion_request.nil?
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly worried this logic could fall apart if at some point we (or an admin) end up deciding to cancel some deletion requests without unsuspending the user, but otherwise it seems fine.

Comment on lines +153 to 159
def moved?
!object.suspended? && object.moved?
end

def also_known_as?
!object.also_known_as.empty?
!object.suspended? && !object.also_known_as.empty?
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if these could cause subtle issues in Move handling or whatnot... but it's unlikely.

app/services/activitypub/process_collection_service.rb Outdated Show resolved Hide resolved
@Gargron Gargron force-pushed the feature-suspensions-federation branch 4 times, most recently from e578ba8 to 34ab90c Compare November 6, 2020 03:31
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do another review pass later today, but it seems mostly good. So far, my only worry is about returning 410 for temporary suspensions, as that might trigger deletion in some implementations.

app/controllers/concerns/account_controller_concern.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the inline comments:

  • DeleteAccountService#purge_profile! needs to set suspension origin
  • BlockDomainService#suspend_accounts! and BlockDomainService#process_retroactive_updates! need to (un)set suspension origin
  • ActivityPub::ProcessAccountService#create_account needs to set suspension origin on auto_block

Also, I think we could/should federate silencing information as well, this would make some things less hackish. This definitely can be in another PR though.

@@ -42,7 +42,7 @@ def challenge_passed?
end

def destroy_account!
current_account.suspend!
current_account.suspend!(origin: :local)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm thinking about that, a self-deletion being displayed as a suspension might be misleading and problematic. Though that's a permanent suspension so I guess it should be fine, just returning 410 with a generic “Gone” page.

app/services/resolve_account_service.rb Show resolved Hide resolved
app/controllers/concerns/account_controller_concern.rb Outdated Show resolved Hide resolved
app/controllers/concerns/account_owned_concern.rb Outdated Show resolved Hide resolved
app/services/activitypub/process_collection_service.rb Outdated Show resolved Hide resolved
@Gargron Gargron force-pushed the feature-suspensions-federation branch 6 times, most recently from f9f2fe2 to bbf5724 Compare November 7, 2020 03:43
@Gargron
Copy link
Member Author

Gargron commented Nov 7, 2020

I have removed the "suspended" profile design from the PR. Temporarily suspended profiles return HTTP 403.

@Gargron Gargron force-pushed the feature-suspensions-federation branch 2 times, most recently from ade8152 to f892b42 Compare November 7, 2020 04:12
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic behind which response to return in case of suspension is a bit hard to follow but I don't really have a better idea on how to implement it right now.

Also, I'm not sure why you removed the special page about the account being suspended, it does seem helpful to me. In any case that can be added back in another PR.

I'd like to see some actual testing of the feature (I might do that later), but overall, the PR looks good to me.

@Gargron Gargron force-pushed the feature-suspensions-federation branch from f892b42 to 2da95f9 Compare November 7, 2020 23:00
@Gargron Gargron merged commit 3134691 into master Nov 7, 2020
@Gargron Gargron deleted the feature-suspensions-federation branch November 7, 2020 23:28
umonaca pushed a commit to umonaca/mastodon that referenced this pull request Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
activitypub Protocol-related changes, federation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants