File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ module.exports.isUndefined = value => (value === undefined || value === null ||
55const ALLOWED_DOWNLOAD_HOSTS = [ 'browserstack.com' ] ;
66const ALLOWED_DOWNLOAD_HOST_SUFFIXES = [ '.browserstack.com' ] ;
77
8+ // Each guard below covers a case the final host-equals check does not:
9+ // - empty/non-string URL: new url.URL(null) throws TypeError; explicit guard returns a clean message.
10+ // - URL constructor catch: convert TypeError on malformed input into our own Error.
11+ // - HTTPS check: allowlist matches host only; without this, http://browserstack.com would pass.
12+ // - null/empty hostname: URL constructor accepts forms like https:///foo where hostname is empty; give a clear error.
813module . exports . validateSourceUrl = function ( sourceUrl ) {
914 if ( ! sourceUrl || typeof sourceUrl !== 'string' ) {
1015 throw new Error ( 'Refusing binary download: empty source URL' ) ;
You can’t perform that action at this time.
0 commit comments