-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Will do a refactor of that in a subsequent PR 👍 |
||
// Account was marked as suspended by a | ||
// local admin action. Stop request early. | ||
w.WriteHeader(http.StatusForbidden) | ||
return ctx, false, nil | ||
} | ||
|
||
// We have everything we need now, set the requesting | ||
// and receiving accounts on the context for later use. | ||
ctx = gtscontext.SetRequestingAccount(ctx, requestingAccount) | ||
|
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. CheckingIsZero
is very cheap.