diff options
author | Gabe Kangas <gabek@real-ity.com> | 2022-01-04 13:26:01 -0800 |
---|---|---|
committer | Gabe Kangas <gabek@real-ity.com> | 2022-01-06 23:02:48 -0800 |
commit | fc733a6e5709e622023aeb777493a4b243bd6677 (patch) | |
tree | 62b1d27dd426a07d65c970ab58d7a538897f5688 | |
parent | f7fe4b482f5fcef0f56b4afb58f311b8b86a2618 (diff) |
Clean up actor rejection due to being blocked
-rw-r--r-- | activitypub/inbox/worker.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/activitypub/inbox/worker.go b/activitypub/inbox/worker.go index 8445c3e13..609a0e932 100644 --- a/activitypub/inbox/worker.go +++ b/activitypub/inbox/worker.go @@ -24,7 +24,7 @@ func handle(request apmodels.InboxRequest) { log.Debugln("Error in attempting to verify request", err) return } else if !verified { - log.Errorln("Request failed verification") + log.Errorln("Request failed verification", err) return } @@ -75,14 +75,12 @@ func Verify(request *http.Request) (bool, error) { // Test to see if the actor is in the list of blocked federated domains. if isBlockedDomain(actor.ActorIri.Hostname()) { - return false, errors.New("actor is blocked") + return false, errors.New("domain is blocked") } // If actor is specifically blocked, then fail validation. - if blocked, err := isBlockedActor(actor.ActorIri); err != nil { + if blocked, err := isBlockedActor(actor.ActorIri); err != nil || blocked { return false, err - } else if blocked { - return true, nil } key := actor.W3IDSecurityV1PublicKey.Begin().Get().GetW3IDSecurityV1PublicKeyPem().Get() @@ -123,9 +121,7 @@ func isBlockedDomain(domain string) bool { func isBlockedActor(actorIRI *url.URL) (bool, error) { blockedactor, err := persistence.GetFollower(actorIRI.String()) - if err != nil { - return false, errors.Wrap(err, "error validating actor against blocked actors") - } + if blockedactor != nil && blockedactor.DisabledAt != nil { return true, errors.Wrap(err, "remote actor is blocked") } |