This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 3c7e144 open-uri causes unsafe operation error
3c7e144 is described below
commit 3c7e1441b278ea86e9d0116eff5d45f6fd640590
Author: Sebb <[email protected]>
AuthorDate: Fri Aug 2 20:50:50 2019 +0100
open-uri causes unsafe operation error
Also need to increase max size somewhat
---
.../workbench/views/actions/check-signature.json.rb | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/www/secretary/workbench/views/actions/check-signature.json.rb
b/www/secretary/workbench/views/actions/check-signature.json.rb
index f3ad27d..f914df7 100644
--- a/www/secretary/workbench/views/actions/check-signature.json.rb
+++ b/www/secretary/workbench/views/actions/check-signature.json.rb
@@ -10,9 +10,19 @@ ENV['GNUPGHOME'] = GNUPGHOME if GNUPGHOME
# Removed keys.openpgp.org as it does not return data such as email unless
user specifically allows this
KEYSERVERS = %w{sks-keyservers.net keyserver.ubuntu.com}
# N.B. ensure the keyserver URI is known below
-MAX_KEY_SIZE = 5000 # don't import if the ascii keyfile is larger than this
+MAX_KEY_SIZE = 20700 # don't import if the ascii keyfile is larger than this
message = Mailbox.find(@message)
+require 'net/http'
+def getURI(uri)
+ uri = URI.parse(uri)
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do
|https|
+ request = Net::HTTP::Get.new(uri.request_uri)
+ response = https.request(request)
+ return response.body
+ end
+end
+
begin
# fetch attachment and signature
attachment = message.find(URI.decode(@attachment)).as_file # This is derived
from a URI
@@ -54,7 +64,6 @@ begin
# end
# end
- require 'open-uri'
KEYSERVERS.each do |server|
found = false
if server == 'keys.openpgp.org'
@@ -75,7 +84,7 @@ begin
begin
tmpfile = File.join(dir, keyid)
File.open(tmpfile,"w") do |f|
- f.puts(URI(uri).read)
+ f.puts(getURI(uri))
end
size = File.size(tmpfile)
Wunderbar.warn "File: #{tmpfile} Size: #{size}"