From 2cbb61be7500cee154b63ecdd80b000a136c3957 Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Tue, 25 Oct 2011 11:41:52 -0700 Subject: [PATCH] make federation errors much louder so we can better debug issues temporarialy --- lib/postzord/receiver/private.rb | 6 +++--- spec/integration/attack_vectors_spec.rb | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/postzord/receiver/private.rb b/lib/postzord/receiver/private.rb index 4741b0ef5..ff66874f8 100644 --- a/lib/postzord/receiver/private.rb +++ b/lib/postzord/receiver/private.rb @@ -72,12 +72,12 @@ class Postzord::Receiver::Private < Postzord::Receiver end def validate_object - return false if contact_required_unless_request - return false if relayable_without_parent? + raise "Contact required unless request" if contact_required_unless_request + raise "Relayable object, but no parent object found" if relayable_without_parent? assign_sender_handle_if_request - return false if author_does_not_match_xml_author? + raise "Author does not match XML author" if author_does_not_match_xml_author? @object end diff --git a/spec/integration/attack_vectors_spec.rb b/spec/integration/attack_vectors_spec.rb index d65567e29..3c72fba0a 100644 --- a/spec/integration/attack_vectors_spec.rb +++ b/spec/integration/attack_vectors_spec.rb @@ -23,7 +23,7 @@ describe "attack vectors" do zord = Postzord::Receiver::Private.new(bob, :salmon_xml => salmon_xml) expect { zord.perform! - }.should raise_error /not a valid object/ + }.should raise_error /Contact required unless request/ bob.visible_shareables(Post).include?(post_from_non_contact).should be_false Post.count.should == post_count @@ -40,7 +40,7 @@ describe "attack vectors" do zord = Postzord::Receiver::Private.new(bob, :salmon_xml => salmon_xml) expect { zord.perform! - }.should raise_error /not a valid object/ + }.should raise_error /Contact required unless request/ alice.reload.visible_shareables(Post).should_not include(StatusMessage.find(original_message.id)) end @@ -98,7 +98,7 @@ describe "attack vectors" do zord = Postzord::Receiver::Private.new(bob, :salmon_xml => salmon_xml) expect { zord.perform! - }.should raise_error /not a valid object/ + }.should raise_error /Author does not match XML author/ eve.reload.profile.first_name.should == first_name end @@ -165,7 +165,7 @@ describe "attack vectors" do zord = Postzord::Receiver::Private.new(bob, :salmon_xml => salmon_xml) expect { zord.perform! - }.should raise_error /not a valid object/ + }.should raise_error /Author does not match XML author/ bob.reload.visible_shareables(Post).count.should == 1 end @@ -197,7 +197,7 @@ describe "attack vectors" do zord = Postzord::Receiver::Private.new(bob, :salmon_xml => salmon_xml) expect { zord.perform! - }.should raise_error /not a valid object/ + }.should raise_error /Author does not match XML author/ bob.reload.contacts.count.should == 2 end