File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ module FetchDownloadSourceUrl
1111 ALLOWED_DOWNLOAD_HOSTS = [ 'browserstack.com' ] . freeze
1212 ALLOWED_DOWNLOAD_HOST_SUFFIXES = [ '.browserstack.com' ] . freeze
1313
14+ # Each guard below covers a case the final host-equals check does not:
15+ # - nil/empty URL: URI.parse(nil) raises TypeError before the rescue can catch it.
16+ # - URI::InvalidURIError: convert raw Ruby error into BrowserStack::LocalException for the public contract.
17+ # - HTTPS check: allowlist matches host only; without this, http://browserstack.com would pass.
18+ # - nil/empty host: uri.host is nil for URIs like https:///foo, which would crash on downcase.
1419 def self . validate_source_url ( url )
1520 if url . nil? || url . to_s . empty?
1621 raise BrowserStack ::LocalException . new ( 'Refusing binary download: empty source URL' )
You can’t perform that action at this time.
0 commit comments