Skip to content

feat: per-region + direction CIDR feeds#6

Merged
bhavink merged 2 commits into
mainfrom
feat/per-region-direction-feeds
Jun 1, 2026
Merged

feat: per-region + direction CIDR feeds#6
bhavink merged 2 commits into
mainfrom
feat/per-region-direction-feeds

Conversation

@bhavink

@bhavink bhavink commented May 11, 2026

Copy link
Copy Markdown
Owner

Closes #5.

Summary

  • Per-region loop in update_outputs.py now emits three variants per region — combined (existing), -inbound, -outbound. The ≥1-CIDR guard applies to each variant independently, so regions that only carry one direction (e.g. aws-eu-north-1, several Azure China/USGov regions) emit just the variant they have.
  • 156 new direction-scoped TXT files in docs/output/, all covered by the existing SHA256SUMS manifest (verified locally with sha256sum -c).
  • 6 new tests in test_update_outputs.py for emission, per-direction content isolation, the ≥1-CIDR guard, and SHA256SUMS coverage. Full suite: 45/45 passing.
  • Docs updated: README.md (Features + Implementation Notes), docs/firewall-automation-guide.md (URL pattern table + concrete use cases), terraform/README.md ("does NOT do" note now points consumers at the published split feeds), and the generated docs/index.html / docs/output/index.html nav copy.

Why

The current <cloud>-<region>.txt files force consumers into a both-directions allowlist even when the target only accepts one direction. Two concrete cases:

  • Azure Storage Account network rules — cap is 400 IPs per account; outbound-only ~halves the footprint.
  • AWS KMS key policiesaws:SourceIp size-constrained; only outbound CP IPs reach KMS.

Direction-scoped feeds let those consumers tighten the allowlist without forking the repo or post-processing the combined file.

Test plan

  • python3 -m pytest -v — 45/45 pass locally
  • python3 update_outputs.py — generates expected files
  • cd docs/output && sha256sum -c SHA256SUMS — all OK including new files
  • Spot-check: aws-us-east-1-inbound.txt contains only inbound CIDRs; aws-us-east-1-outbound.txt contains only outbound; combined aws-us-east-1.txt is the deduplicated union (unchanged)
  • Guard verified: aws-eu-north-1-outbound.txt exists, aws-eu-north-1-inbound.txt does not (region has no inbound CIDRs)
  • docs/output/index.html lists every new file; existing files unchanged
  • CI to re-run tests and verify SHA256SUMS step

Backward compatibility

  • All existing files retained (<cloud>.txt, <cloud>-<inbound|outbound>.txt, <cloud>-<region>.txt, all.txt, etc.).
  • No changes to file format (one CIDR per line, sorted, deduplicated).
  • Terraform module behavior unchanged (it still builds <cloud>-<region>.txt URLs; direction filtering remains an explicit source_files opt-in for now, per the updated note in terraform/README.md).

bhavink added 2 commits May 11, 2026 09:56
- update_outputs.py: per-region loop now emits three variants per region —
  combined (existing), `-inbound`, and `-outbound`. ≥1-CIDR guard applies
  to each variant independently, so regions with one direction (e.g.
  aws-eu-north-1 has only outbound) emit only the variant they have.
- 156 new direction-scoped TXT files in docs/output/, all covered by the
  existing SHA256SUMS manifest.
- test_update_outputs.py: 6 new tests covering emission, contents
  isolation per direction, the ≥1-CIDR guard for empty directions, and
  SHA256SUMS coverage. 18/18 passing in this file, 45/45 across the repo.
- Docs updated: README (Features + Implementation Notes),
  docs/firewall-automation-guide.md (URL pattern table with concrete
  Azure Storage Account / AWS KMS use cases), terraform/README.md
  ("does NOT do" section now points consumers at the published split
  feeds via source_files), and the generated docs/index.html and
  docs/output/index.html nav copy.

Motivation: combined per-region files force consumers into a both-
directions allowlist even when the target only accepts one direction —
Azure Storage Account network rules cap at 400 IPs per account and AWS
KMS aws:SourceIp policies are size-constrained. Direction-scoped feeds
let those consumers cut their footprint roughly in half.
Regenerate docs/output/ on latest weekly data (4 weeks of upstream
chore updates: 2026-05-11, 2026-05-18, 2026-05-25, 2026-06-01).
Direction-scoped feeds preserved; SHA256SUMS verified; 45/45 tests pass.
@bhavink bhavink merged commit c7b8d38 into main Jun 1, 2026
1 check passed
@bhavink bhavink deleted the feat/per-region-direction-feeds branch June 1, 2026 15:00
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.

Publish per-region + per-direction TXT feeds (e.g. aws-us-east-1-outbound.txt)

1 participant