-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
[bugfix] Don't try to update suspended accounts #2348
Conversation
@@ -331,6 +336,11 @@ func (d *Dereferencer) enrichAccountSafely( | |||
account *gtsmodel.Account, | |||
apubAcc ap.Accountable, | |||
) (*gtsmodel.Account, ap.Accountable, error) { | |||
// Noop if account has been suspended. | |||
if !account.SuspendedAt.IsZero() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to check this here as accountIsUpToDate() is always called before entering enrichSafely() :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that, but the accountUpToDate call can still be overridden if refresh
is true, so this makes extra sure. Checking IsZero
is very cheap.
@@ -288,6 +288,13 @@ func (f *Federator) AuthenticatePostInbox(ctx context.Context, w http.ResponseWr | |||
return nil, false, err | |||
} | |||
|
|||
if !requestingAccount.SuspendedAt.IsZero() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was going to say we should probably move this to AuthenticateFederatedRequest() to make sure we do this check in all applicable locations, but then saw that function doesn't guarantee to always have the account model by that point ... what if we updated AuthenticateFederatedRequest() to handle the instance model creation if necessary, and fetching updated account model? that way we can just move this check in there, and it won't need to be added anywhere else.
just this current way of doing it makes me worry we're going to miss out locations where it's needed as it needs to add them in all the locations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do a refactor of that in a subsequent PR 👍
* [bugfix] Don't try to update suspended accounts * bail early if requesting account suspended
Description
This pull request fixes a bug where accounts that were suspended via the admin panel could become marked as unsuspended again on refresh of the account.
Bug only affected specifically-targeted accounts, not accounts that were blocked by a domain block action. All the account's relationships and posts and media and stuff were still deleted just fine by the side effects.
For good measure, add some early checks to bail fedi requests if a remote account was marked as suspended locally.
Checklist
Please put an x inside each checkbox to indicate that you've read and followed it:
[ ]
->[x]
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
go fmt ./...
andgolangci-lint run
.