mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-01 02:52:49 +08:00
The PoC relay carried its own copy of the restricted-address check and had drifted well behind src/security/open-target-policy.ts: it missed multicast, 192.0.0.0/24 and the other special-use ranges, 198.18.0.0/15, the TEST-NET blocks, fec0::/10, ff00::/8 and 2001:db8::/32. A relay started without allowPrivate would therefore forward to addresses the gateway refuses, and nothing exercised the guard, so the gap could not be noticed. The relay must stay a plain .mjs file that the README documents copying to a remote host without a build step, so it cannot import the TypeScript policy. The predicate is mirrored instead and pinned by a parity test that fails the moment the two classifications disagree. The parity test lives beside the PoC rather than under src/: .dockerignore excludes scripts/acceleration-poc from the Docker build context while the Dockerfile runs `tsc` over src/**, so a copy in src/ would resolve locally and still break the image build with TS2307. - mirror isRestrictedAddress() exactly, including fail-closed handling of any input that is not a literal public address - add scripts/acceleration-poc/target-guard-parity.test.mjs comparing both implementations across private, loopback, link-local, carrier-grade NAT, special-use, IPv6 and IPv4-mapped cases - assert the guard in the PoC smoke run: a relay without allowPrivate must reject loopback, private and IPv4-mapped targets while still serving a public one, and the run now fails with the offending target instead of passing silently Verified: tsc clean; `npm run build` and `npm run web:build` succeed with scripts/acceleration-poc moved aside to reproduce the Docker build context; the parity test fails when either side drifts; the smoke run reports ssrf_guard_ok and ACCELERATION_POC_OK after the fix, and fails with a LEAK line per unblocked target once the guard is weakened; the IPv6 smoke run still reports IPV6_ACCELERATION_POC_OK.