Skip to content

Add ipv4_prefix and ipv6_prefix options for subnet-based rate limiting#97

Open
jpds wants to merge 2 commits intomholt:masterfrom
jpds:feat/network-prefix-rate-limiting
Open

Add ipv4_prefix and ipv6_prefix options for subnet-based rate limiting#97
jpds wants to merge 2 commits intomholt:masterfrom
jpds:feat/network-prefix-rate-limiting

Conversation

@jpds
Copy link

@jpds jpds commented Mar 12, 2026

Adds per-zone configuration to group rate limit keys by network prefix, allowing IPv6 addresses within the same subnet (e.g. /64) to share a single rate limit bucket. This prevents abuse from clients cycling through random addresses within an IPv6 prefix.

Each address family has its own setting (ipv4_prefix, ipv6_prefix) so they can be configured independently. When unset (0), addresses are treated individually as before — no change in default behavior.

Fixes: #23

@jpds jpds force-pushed the feat/network-prefix-rate-limiting branch from 158bb98 to 6bfe4ec Compare March 12, 2026 12:56
jpds and others added 2 commits March 12, 2026 13:37
Adds per-zone configuration to group rate limit keys by network prefix,
allowing IPv6 addresses within the same subnet (e.g. /64) to share a
single rate limit bucket. This prevents abuse from clients cycling
through random addresses within an IPv6 prefix.

Each address family has its own setting (ipv4_prefix, ipv6_prefix) so
they can be configured independently. When unset (0), addresses are
treated individually as before — no change in default behavior.

Closes mholt#23

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jpds jpds force-pushed the feat/network-prefix-rate-limiting branch from 6bfe4ec to 5160a82 Compare March 12, 2026 13:37
@kahara
Copy link

kahara commented Mar 12, 2026

Thinking if the IPv6 case and the idea of blocking /64s holds water because ISPs commonly provide, as they should, a /56 or even a /48. So a /64 would likely be a single machine, or at least it should be. And the owner of such a network could easily get an address with a different /64 prefix.

@jpds
Copy link
Author

jpds commented Mar 12, 2026

@kahara It's entirely up to the user to configure whatever ipv6_prefix they want to rate-limit with.

(I've also almost never had a /64 with a single machine).

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.

Limit by IPv6 network range

2 participants