fix(connection): require trustedHosts entries in canonical authority form

A dangling colon (harness.internal:) or zero-padded port parses cleanly while
WHATWG silently rewrites it, turning an intended exact-port grant into an
any-port grant. Replace the character blacklist with a round-trip check: an
entry must read back from parsing exactly as written (case aside), refusing
the whole rewrite class at load.
This commit is contained in:
creatixchu
2026-07-28 16:49:52 +08:00
parent 34518cb012
commit 7ff8da56df
7 changed files with 35 additions and 24 deletions

View File

@@ -283,7 +283,7 @@ export interface ConnectionConfig {
* browser request whose Host is neither loopback nor listed here, so a
* non-loopback (`0.0.0.0`) deployment must declare the names it is reached
* by (the dsh CLI derives the machine's LAN IP literals itself). An entry
* that is not a bare authority fails the plugin load.
* that is not a bare, canonical authority fails the plugin load.
*/
trustedHosts?: string[]
}