Skip to content

Commit bba2554

Browse files
rounak610claude
andcommitted
Add comment explaining each guard in _validate_source_url
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3f3e0b2 commit bba2554

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

browserstack/local_binary.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class LocalBinary:
1616
ALLOWED_DOWNLOAD_HOSTS = ("browserstack.com",)
1717
ALLOWED_DOWNLOAD_HOST_SUFFIXES = (".browserstack.com",)
1818

19+
# Each guard below covers a case the final host-match check does not:
20+
# - urlparse takes (url or "") so a None or empty URL becomes empty; downstream guards then catch it.
21+
# - HTTPS check: allowlist matches host only; without this, http://browserstack.com would pass.
22+
# - empty host: hostname is None/empty for missing URL or URLs like https:///foo; surface a clear error.
1923
@staticmethod
2024
def _validate_source_url(url):
2125
parsed = urlparse(url or "")

0 commit comments

Comments
 (0)