- Newest
- Most votes
- Most comments
Your logic is sound - avoiding "Blind Allowlisting" is a security best practice (Zero Trust principle). However, your implementation can be simplified to ensure you don't accidentally lower protection for all users.
1. The "Label-Override" Pattern (Recommended)
Instead of putting all rules in COUNT mode (which weakens protection for anonymous traffic), use Rule Group Overrides specifically for your trusted IPs.
- Rule 1 (Priority 10): Match your "Legit IP Set".
- Action:
Count - Add Label:
trusted-user
- Action:
- Rule 2 (Priority 20): AWS Managed Rule Groups (Core Rule Set, etc.).
- Action:
Block(Standard) - Scope-down Statement: Only run this rule if the request DOES NOT have the label
trusted-user.
- Action:
- Rule 3 (Priority 30): The same Managed Rule Groups, but with Action set to
Count.- Scope-down Statement: Only run this rule if the request HAS the label
trusted-user.
- Scope-down Statement: Only run this rule if the request HAS the label
Why this is cleaner:
- Security: Anonymous/untrusted traffic is still hard-blocked by default.
- Visibility: You still get logs and labels for your trusted users' triggers without breaking their session.
- Scalability: You don't need a final "Allow" rule that might accidentally bypass future security layers.
2. A Note on the Lambda Sync: Syncing DB IPs to WAF IP Sets works, but watch out for the WAF IP Set limit (typically 10k addresses). If your user base is larger, consider using Verified Access or injecting a Custom JWT/Cookie that the WAF can inspect. A signed token is often more reliable than a volatile IP address, especially for users on mobile networks or VPNs.
Conclusion: Not over-engineered, but focus on using Labels + Scope-down statements to keep your global security posture high while granting "immunity" to known IPs.
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 9 months ago

It's not particularly easy to add the managed rule groups twice as it can't be done in the console, plus it can push the WCU usage up. It sounds like the original use-case was not to block any traffic and focus on detection, in which case the proposed approach sounds good. If you wanted to block traffic hitting the managed rules - just add them once, and override them to count. Then add a custom rule looking for either specific managed rule group labels, or the label namespace AND NOT the legit-ip label, with a block action.