Skip to content

Commit 12f73d3

Browse files
[APS-19008] fix IPv6-loopback allowlist entry (::1 -> [::1])
new URL('http://[::1]:x').hostname returns the bracketed form, so the bare '::1' entry never matched (dead). Use '[::1]' so IPv6 localhost is actually allowed for local dev, consistent with 'localhost'/'127.0.0.1'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 999a0b5 commit 12f73d3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎bin/helpers/securityValidation.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const path = require('path');
1818
// production, staging (bsstag.com) and local development. Anything else is
1919
// treated as attacker-controlled and rejected.
2020
const ALLOWED_HOST_SUFFIXES = ['.browserstack.com', '.bsstag.com'];
21-
const ALLOWED_EXACT_HOSTS = ['browserstack.com', 'bsstag.com', 'localhost', '127.0.0.1', '::1'];
21+
// Note: URL parsing yields '[::1]' (bracketed) as the hostname for IPv6 loopback.
22+
const ALLOWED_EXACT_HOSTS = ['browserstack.com', 'bsstag.com', 'localhost', '127.0.0.1', '[::1]'];
2223

2324
/**
2425
* Returns true if the given URL points at a BrowserStack (prod/staging) host or

0 commit comments

Comments
 (0)