Skip to content

feat(rules): support CIDR ranges in admin-ips - #108

Open
selfuryon wants to merge 3 commits into
attestantio:masterfrom
selfuryon:feat/cidr
Open

feat(rules): support CIDR ranges in admin-ips#108
selfuryon wants to merge 3 commits into
attestantio:masterfrom
selfuryon:feat/cidr

Conversation

@selfuryon

Copy link
Copy Markdown

Now admin-ips entries may now be individual IP addresses or CIDR ranges; a plain IP is treated as a CIDR covering that address alone. Invalid entries are now rejected at startup instead of silently never matching.

Voluntary exit authorization via server.rules.admin-ips previously
required an exact IP match, which is unusable for ephemeral workloads
(e.g. Kubernetes pods) whose addresses change on every reschedule.

Admin-ips entries may now be individual IP addresses or CIDR ranges;
a plain IP is treated as a CIDR covering that address alone. Invalid
entries are now rejected at startup instead of silently never
matching.

@AntiD2ta AntiD2ta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to see this progressing.

Apart from the other comments, could we add test cases (on both rules_tests.go and sign_test.go) for a (non-CIDR) IPv6 address?

Comment thread rules/standard/service.go Outdated
Comment thread rules/standard/adminips.go Outdated
Address review feedback on attestantio#108:

- Invalid admin-ips entries are now logged and skipped instead of
  failing New(), since a misconfigured entry can only narrow the set
  of addresses trusted for voluntary exits, never widen it, so it's
  not worth blocking Dirk's startup over.
- A CIDR entry with non-zero host bits (e.g. "10.1.2.3/24" instead of
  the network address "10.1.2.0/24") is now also treated as invalid
  and skipped, rather than net.ParseCIDR silently widening it to the
  whole network.
- Add test coverage for plain IPv6 addresses and for CIDR entries with
  non-zero host bits.
@selfuryon
selfuryon requested a review from AntiD2ta August 7, 2026 12:19
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.

2 participants