-
Notifications
You must be signed in to change notification settings - Fork 16
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 additional checks for banned instances + various code improvements along the way #1258
Conversation
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.
The most important thing is the check in findActorOrCreate
src/Service/ActivityPubManager.php
Outdated
// Check if the instance is banned | ||
if ($this->settingsManager->isBannedInstance($actorUrl)) { | ||
return null; | ||
} |
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.
This check should be pushed down to the line just before $actor = $this->apHttpClient->getActorObject($actorUrl);
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.
Are you sure? This might still do dispatchUpdateActor.
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.
dispatch update actor checks for banned instances as well so this is not an issue i think
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.
Yes indeed, it checks it:
mbin/src/Service/ActivityPubManager.php
Line 231 in c62b450
if ($this->settingsManager->isBannedInstance($actorUrl)) { |
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.
Well it does the check before actually dispatching the update:
mbin/src/Service/ActivityPubManager.php
Lines 233 to 237 in 0868a7f
public function dispatchUpdateActor(string $actorUrl) | |
{ | |
if ($this->settingsManager->isBannedInstance($actorUrl)) { | |
return; | |
} |
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 pushed the isBannedInstance check down to line 176 now.
The question now is whether you really want to return users or magazines from a banned instance..?
src/Service/ActivityPubManager.php
Outdated
// Check if the instance is banned | ||
if ($this->settingsManager->isBannedInstance($actorUrl)) { | ||
return null; | ||
} |
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.
dispatch update actor checks for banned instances as well so this is not an issue i think
910330e
to
9b02e5c
Compare
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.
See comment left on previous thread
I am really not a fan of a new contributor approving changes on highly important code. Nothing against @garrettw , but you are a new contributor. If I have remarks in the future I will check the 'request changes option ' if I have such comments to prevent this, but please be careful with everything activity pub related |
No offense taken. |
The code changes are easy, the implications of the changes however are not. |
I guess I can see how that’s true for a couple of the files involved. |
Happy new year! |
Even after the previous PR: #1254. I still see some requests failing and being make to banned instances. This is a follow-up PR.
LikeHandler
,activityPubManager
andUpdateActorHandler
that is calling methods directly or indirectly methods from ActivityPubManager.php (methods like:findActorOrCreate
orupdateActor
for example).getCollectinCacheKey
method as well, just likegetActorCacheKey
updateUser
to logRequestException`activityPubManager
variable consistent through all out the inbox, outbox activitypub files as well as services and messenger handler files. This will make grepping easier. And give me less headache.Fixes 25th: #1175 (comment)