From f0aca56c8f0cbb8ffd1f47e712bd29cb6a982553 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sat, 17 Feb 2018 20:56:39 +0100 Subject: [PATCH] Don't retry for PublicKeyNotFound We only return `nil` when we know the person, but don't know the key or the key is invalid, so it doesn't make sense to retry in this case. When the person isn't known and can't be fetched we raise a DiscoveryError which will be retried. Also the errors were moved to the `Signable` module in the last release. closes #7717 --- Changelog.md | 1 + app/workers/receive_base.rb | 3 ++- spec/federation_callbacks_spec.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index e8a000b03..e96ed8bed 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ ## Bug fixes * Prevent duplicate mention notifications when the post is received twice [#7721](https://github.com/diaspora/diaspora/pull/7721) * Fixed a compatiblitiy issue with non-diaspora\* webfingers [#7718](https://github.com/diaspora/diaspora/pull/7718) +* Don't retry federation for accounts without a valid public key [#7717](https://github.com/diaspora/diaspora/pull/7717) ## Features * Add basic html5 audio/video embedding support [#6418](https://github.com/diaspora/diaspora/pull/6418) diff --git a/app/workers/receive_base.rb b/app/workers/receive_base.rb index 4654c28a9..b8330aa24 100644 --- a/app/workers/receive_base.rb +++ b/app/workers/receive_base.rb @@ -13,7 +13,8 @@ module Workers DiasporaFederation::Parsers::BaseParser::InvalidRootNode, DiasporaFederation::Entity::InvalidEntityName, DiasporaFederation::Entity::UnknownEntity, - DiasporaFederation::Entities::Relayable::SignatureVerificationFailed, + DiasporaFederation::Entities::Signable::PublicKeyNotFound, + DiasporaFederation::Entities::Signable::SignatureVerificationFailed, DiasporaFederation::Entities::Participation::ParentNotLocal, DiasporaFederation::Federation::Receiver::InvalidSender, DiasporaFederation::Federation::Receiver::NotPublic, diff --git a/spec/federation_callbacks_spec.rb b/spec/federation_callbacks_spec.rb index f67259666..9cc318bda 100644 --- a/spec/federation_callbacks_spec.rb +++ b/spec/federation_callbacks_spec.rb @@ -231,7 +231,7 @@ describe "diaspora federation callbacks" do expect(key.to_s).to eq(person.serialized_public_key) end - it "returns nil for an unknown person" do + it "forwards the DiscoveryError when the person can't be fetched" do diaspora_id = Fabricate.sequence(:diaspora_id) expect(Person).to receive(:find_or_fetch_by_identifier).with(diaspora_id) .and_raise(DiasporaFederation::Discovery::DiscoveryError)