Skip to content

fix: stop one source from filling the directory or aiming players' pings elsewhere - #15

Merged
vdmkenny merged 2 commits into
mainfrom
fix/full-tables-refuse-everyone
Nov 22, 2026
Merged

vdmkenny merged 2 commits into
mainfrom
fix/full-tables-refuse-everyone

Conversation

@vdmkenny

@vdmkenny vdmkenny commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

A review of 0.3.1 found several ways for one party to make an instance refuse everyone, or to misuse its listings. This fixes them.

Full tables

  • Rate table. One request from each of 512 IPv6 /64s filled it, and every new visitor got 503 for a minute, browsers included. When the table is full, the source whose minute started first now makes room.
  • Challenge table. The 8 challenges per source were counted by full IPv6 address, so two /64s could take all 128 slots and no host could register. When the table is full, the challenge that has waited longest now makes room.
  • Listing table. When all 256 slots are taken, the source with the most listings gives up the one that expires first to a source that would still have fewer afterwards. A table of hosts with one listing each stays as it is and answers 503.
  • A source is an IPv4 address or an IPv6 /64 for every quota: requests, pending challenges and listings.

Listed addresses

A listing could name any public address, and players' games ping every listed address. A host that publishes from a public address may now name another one only if the operator allows its key with the new --address-host. Naming its own address is always allowed, and --allow-private-publishers works as before.

This changes behaviour for existing hosts. A host on a public address that sets address to a different one gets 403 until the operator adds its key.

Smaller points

  • Without --trust-proxy, one source address holds at most a quarter of the connections, so eight idle connections from one address no longer keep everyone out.
  • 192.0.0.0/16 is no longer refused whole. Only 192.0.0.0/24 and 192.0.2.0/24 are.
  • Signatures are checked before the registry's lock is taken. Proof.verified returns a Verified, and the registry only takes that.
  • The image's default command is now --bind 127.0.0.1:8080 --trust-proxy, as the README's example has it. A container started with a published port and no arguments is no longer reachable. It needs host networking and a proxy, or its own --bind.

Checks

Unit tests (five new), check-directory.py with new cases for named addresses, and a local instance:

  • 512 requests from 512 /64s all got 200, and a new source could still browse.
  • 140 challenges from two /64s: 16 accepted, 124 refused with 429, and an unrelated host still got its challenge.
  • With 8 idle connections open from one address, a request from another address got 200.

check-relay.py was not run locally, because Docker is not available on this machine. CI runs it.

Closes #13
Closes #14

A flood of requests from many IPv6 /64s filled the rate table, and every new
visitor then got 503. Unused challenges from two /64s filled the challenge
table, and no host could register. Count IPv6 sources by /64 for every quota,
and let the oldest entry make room when either table is full.
…aces fairly

A listing could name any public address, and players' games ping every listed
address. A host on a public address now needs the operator's --address-host to
name another one. A full listing table takes from the source with the most
listings. One source holds at most a quarter of the connections when no proxy
is in front. 192.0.0.0/16 is no longer refused whole, signatures are checked
before the registry's lock, and the image's default command matches the README.
@vdmkenny vdmkenny changed the title fix: keep full rate and challenge tables from refusing everyone fix: stop one source from filling the directory or aiming players' pings elsewhere Nov 22, 2026
@vdmkenny
vdmkenny merged commit d4a18dd into main Nov 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Smaller points from a review of 0.3.1 A listing can point players' pings at an address that isn't the publisher's

1 participant