-
Notifications
You must be signed in to change notification settings - Fork 0
Whitelisting
A edited this page Aug 19, 2026
·
2 revisions
Two whitelist layers:
- WhitelistedIP — IP bypass
- WhitelistedUser — user bypass
- Bypasses security middleware checks for that IP
- Bypasses django-axes lockout (via DynamicAxesHandler)
- Supports
is_activetoggle
Use for office IPs, monitoring probes, CI, etc.
Created in admin against a Django user.
exemption_type |
Middleware effect |
|---|---|
all |
Skip IP + country + user-agent checks |
ip_block |
Skip IP blocking only |
geo_block |
Skip country blocking only |
rate_limit |
Skip rate-limit event logging only |
Also supports:
is_active-
expires_at(optional expiration)
Any active WhitelistedUser row bypasses axes lockout, regardless of exemption_type.
- Break-glass admin account →
WhitelistedUser(exemption_type="all") - Corporate egress IP →
WhitelistedIP - Travelling staff needing geo exceptions →
geo_blockorallwith expiry
from django.contrib.auth import get_user_model
from nai_security.models import WhitelistedUser, WhitelistedIP
user = get_user_model().objects.get(username="admin")
WhitelistedUser.objects.update_or_create(
user=user,
defaults={"exemption_type": "all", "is_active": True},
)
WhitelistedIP.objects.update_or_create(
ip_address="203.0.113.10",
defaults={"is_active": True, "description": "Office network"},
)