IP Address Filtering Service
Design a globally distributed service that manages versioned network rules and evaluates source IP addresses with low latency, deterministic precedence, and auditable rollouts.
Problem statement
For this exercise, assume authenticated administrators manage organization-scoped IPv4 and IPv6 CIDR rules used by an edge authorization service before protected applications handle a request.
A rule has an allow or deny action, an explicit priority, an optional expiry, and audit metadata; one configured default action applies when no rule matches. Overlapping rules resolve by longest CIDR prefix, then explicit priority within that prefix, then stable rule ID.
Each decision must evaluate exactly one immutable published rule-set version and return the matched rule and version. Rules, snapshots, keys, caches, metrics, and audit data remain isolated by organization. Design rule management, validation, publication, global distribution, edge lookup, and audit.
Support emergency denies without mixing versions across a decision. Identity authorization, payload inspection, signature-based firewall features, rate limiting, VPN assignment, and threat-intelligence generation are outside scope.
What to build
- Let authorized administrators create, update, delete, validate, and inspect versioned IPv4 and IPv6 CIDR allow or deny rules with priority and optional expiry.
- Evaluate a source IP against one immutable published rule-set version and return the action, matched rule, and version, or the configured default action.
- Atomically publish validated immutable snapshots and distribute them globally without exposing a mixed or partially applied version to a decision.
- Retain an auditable history of rule mutations, publications, propagation health, and sampled or policy-selected decisions for investigation.
At scale
- Maintain up to 10 million active rules and accept up to 1,000 rule mutations per second during bulk policy changes.
- Serve up to 1 million globally distributed lookups per second with a 2 ms p99 edge evaluation budget after local request parsing.
- Make an emergency deny enforceable across healthy edge locations within 10 seconds while every individual decision remains bound to one complete snapshot version.
- Retain rule, publication, and required decision-audit history for 90 days with organization isolation and reproducible version lookup.