This is an automated email from the ASF dual-hosted git repository.
sebbASF 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 512075b5 Only for use with ASF hosts
512075b5 is described below
commit 512075b58e259e0aa6f069fda6ab7502ee9e0477
Author: Sebb <[email protected]>
AuthorDate: Thu Aug 13 14:54:28 2026 +0100
Only for use with ASF hosts
---
lib/whimsy/cache.rb | 5 ++++-
tools/site-scan.rb | 9 +++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/whimsy/cache.rb b/lib/whimsy/cache.rb
index ab5a3eed..6c5b6d99 100644
--- a/lib/whimsy/cache.rb
+++ b/lib/whimsy/cache.rb
@@ -2,6 +2,7 @@ require 'fileutils'
require 'digest'
require 'net/http'
require 'wunderbar'
+require_relative '../../tools/asf-site-check'
# Simple cache for HTTP(S) text files
class Cache
@@ -129,7 +130,9 @@ class Cache
raise IOError.new("Too many redirects (#{depth}) detected at #{uri}")
end
uri = URI.parse(uri)
- Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do
|http|
+ host = uri.host
+ raise ArgumentError.new("Not an ASF host: #{host}") unless
ASFDOMAIN.asfhost?(host)
+ Net::HTTP.start(host, uri.port, use_ssl: uri.scheme == 'https') do |http|
request = Net::HTTP::Get.new(uri.request_uri)
options.each do |k,v|
request[k] = v
diff --git a/tools/site-scan.rb b/tools/site-scan.rb
index 499ccd32..8983e77f 100755
--- a/tools/site-scan.rb
+++ b/tools/site-scan.rb
@@ -94,15 +94,20 @@ def parse(id, site, name, podling=false)
data[:uri] = site
data[:errors] = []
uri = URI.parse(site)
+ host = uri.host
+ unless ASFDOMAIN.asfhost?(host)
+ data[:errors] << "Not an ASF host: #{host}"
+ return data
+ end
begin
- Socket.getaddrinfo(uri.host, uri.scheme)
+ Socket.getaddrinfo(host, uri.scheme)
rescue SocketError => se
data[:errors] << se.message
return data
end
begin
uri, response, status, csp = $cache.get(site.to_s)
- rescue IOError => ioe
+ rescue IOError, ArgumentError => ioe
data[:errors] << ioe.message
return data
end