Merge pull request #670 from galaxor/1137-bad_rsa_keys
1137 bad rsa keys
This commit is contained in:
commit
0cd3878bb8
2 changed files with 21 additions and 1 deletions
|
|
@ -25,7 +25,14 @@ module Job
|
||||||
people.each do |person|
|
people.each do |person|
|
||||||
|
|
||||||
url = person.receive_url
|
url = person.receive_url
|
||||||
xml = salmon.xml_for(person)
|
begin
|
||||||
|
xml = salmon.xml_for(person)
|
||||||
|
rescue OpenSSL::PKey::RSAError => e
|
||||||
|
Rails.logger.info(:event => :invalid_rsa_key, :identifier => person.diaspora_handle)
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
Rails.logger.info("event=http_multi_send sender_id=#{user_id} recipient_id=#{person.id} url=#{url} xml='#{xml}'")
|
||||||
|
|
||||||
request = Request.new(url, OPTS.merge(:params => {:xml => CGI::escape(xml)}))
|
request = Request.new(url, OPTS.merge(:params => {:xml => CGI::escape(xml)}))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,17 @@ describe Job::HttpMulti do
|
||||||
person.reload
|
person.reload
|
||||||
person.url.should == "https://remote.net/"
|
person.url.should == "https://remote.net/"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'only sends to users with valid RSA keys' do
|
||||||
|
person = @people[0]
|
||||||
|
person.serialized_public_key = "-----BEGIN RSA PUBLIC KEY-----\nPsych!\n-----END RSA PUBLIC KEY-----"
|
||||||
|
person.save
|
||||||
|
|
||||||
|
@hydra.stub(:post, @people[0].receive_url).and_return(@response)
|
||||||
|
@hydra.stub(:post, @people[1].receive_url).and_return(@response)
|
||||||
|
Typhoeus::Hydra.stub!(:new).and_return(@hydra)
|
||||||
|
|
||||||
|
@hydra.should_receive(:queue).once
|
||||||
|
Job::HttpMulti.perform(bob.id, @post_xml, [@people[0].id, @people[1].id])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue