Limit the tracker per address and harden its plain HTTP path
Per address and minute: connects and forwarded signaling, so reconnecting doesn't reset a client's allowance. X-Forwarded-For only counts from PROXIES, checked with net.BlockList, with one warning when an uncovered peer sends it. Plain requests get timeouts and a closing 404, silent connections go after 30 s and all queues together share a budget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ae1e3bef9b
commit
b102e55495
5 files changed
+340
-34
No files matched your search
@@ -15,20 +15,6 @@ From a security review, none of them urgent.
|
||||
of a tracker the user chose, but cheap: cap `event.data.length` before parsing, cap the log, drop
|
||||
failure reasons after acceptance or log one.
|
||||
|
||||
- The tracker relays anything: `isSdp` only checks for a string, so it passes any payload up to
|
||||
`MAX_FORWARDED` between two peers of a swarm, usable as a small message relay. The SDP is sealed,
|
||||
the tracker can't check it's SDP. Checking for base64 of a plausible length only shapes what it
|
||||
relays, any data can be base64. What limits the relay is a quota: bytes forwarded per IP over
|
||||
time, and a per-IP connection rate, not only `MAX_PER_IP` concurrent ones, so reconnecting doesn't
|
||||
reset it. Or decide this is accepted and say so in `tracker.mjs`.
|
||||
|
||||
- The tracker's plain HTTP path isn't counted: `MAX_CONNECTIONS` and `MAX_PER_IP` only apply to
|
||||
upgrades, a non-upgrade request gets a 404 with Node's default timeouts. Don't count on Caddy for
|
||||
it, its defaults may not cut slow clients short either. Setting `headersTimeout`,
|
||||
`requestTimeout`, `keepAliveTimeout` and `maxHeadersCount`, and closing the socket after the 404,
|
||||
costs little. Queues can reach `MAX_QUEUED` × `MAX_CONNECTIONS` = 32 MiB against `mem_limit: 96m`,
|
||||
maybe a global byte budget.
|
||||
|
||||
- Framing: no `frame-ancestors`, so another page can frame HellCon and overlay the security check's
|
||||
buttons. Gains little: a framed HellCon starts empty like any other, nothing is kept, so it has no
|
||||
file or offer the user didn't pick or paste inside it, and the address bar shows the framing site.
|
||||
|
||||
Reference in new issue
Block a user