Repository navigation
feat: IP ranges codegen script and trie-backed service range lookups - #11
Merged
Merged
Conversation
Extract hardcoded cloud deny ranges and domain suffixes into JSON config
files (domains_{aws,azure,gcp}.json), generate Rust constants via build.rs,
and replace static slices in cloud modules with include! of generated code.
Add scripts/generate_ip_ranges.py that fetches IANA special-purpose
registries and cloud provider service IP ranges (AWS, Azure, GCP) with
SHA-256 audit logging, CIDR validation, and csp_metadata cross-checks.
Add ServiceRangeTable backed by prefix-trie for O(log n) longest-prefix-match
lookups on cloud service IP ranges, gated behind the std feature. Integrate
with PolicyBuilder via optional with_service_ranges() for allow-listing.
Fix ip_ranges.json: remove ::ffff:0:0/96 (would block all IPv4 via mapped
addresses), add missing IANA ranges (127.0.0.0/8 loopback, 224.0.0.0/4
multicast, fc00::/7 unique-local, ff00::/8 IPv6 multicast), clean up
malformed RFC references.
Add monthly CI workflow (.github/workflows/update-ip-ranges.yml) that
fetches upstream sources and opens a PR on changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config/domains_{aws,azure,gcp}.json, generate Rust constants viabuild.rs, and replace static slices in cloud modules withinclude!of generated code.scripts/generate_ip_ranges.py(stdlib-only) that fetches IANA special-purpose registries and AWS/Azure/GCP service IP ranges with SHA-256 audit logging, CIDR validation, duplicate detection, andcsp_metadatacross-checks. Supports--iana-only,--validate-only, and--dry-runmodes.ServiceRangeTablebacked byprefix-triefor O(log n) longest-prefix-match lookups on ~9,000+ cloud service prefixes, gated behind thestdfeature. Includesload_from_file(),load_all(),lookup(),is_service_ip(), andmerge(). Integrated withPolicyBuildervia optionalwith_service_ranges().ip_ranges.json: remove::ffff:0:0/96(would block all IPv4 via mapped addresses), add missing IANA ranges (127.0.0.0/8,224.0.0.0/4,fc00::/7,ff00::/8), clean up malformed RFC references..github/workflows/update-ip-ranges.yml) withcargo testvalidation gate, concurrency limits, and automatic PR creation.Test plan
python scripts/generate_ip_ranges.py --validate-onlypassescargo test --workspace --all-featurespasses (88 tests)cargo clippy --workspace --all-targets --all-features -- -D warningscleancargo fmt --all -- --checkcleanzizmor -p .zero findings-raceflagwasm32-wasip1