Skip to content

Commit c9bfb64

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

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ private string fetchSourceUrl(string accessKey)
237237
}
238238
}
239239

240+
// Each guard below covers a case the final host-equals check does not:
241+
// - null/empty URL: skip a parse attempt and give a clear error.
242+
// - Uri.TryCreate failure: malformed URL surfaces our own exception instead of leaving parsed null.
243+
// - HTTPS check: allowlist matches host only; without this, http://browserstack.com would pass.
244+
// - null/empty host: parsed.Host can be empty for some URL forms; give a clear error before reaching the allowlist loop.
240245
private static string ValidateSourceUrl(string url)
241246
{
242247
if (string.IsNullOrEmpty(url))

0 commit comments

Comments
 (0)