{% extends "admin/dbs/wiki/_layout.html" %} {% block wiki %}
This panel can download and overwrite the whole database, so only superusers reach it and every request through it is scored.
Time of day, how fast requests are arriving, how risky the attempted action is, session age, whether the network prefix and browser are ones this account has used before, and — when enabled — distance from a known location and implied travel speed. Changes to users, groups, permissions and passwords count as high-risk actions. An address DBS cannot read counts as a new network.
An IsolationForest, shipped pre-trained on a synthetic corpus so it works from the first request, joined by a forest fitted to your own history once there is enough of it. The personal forest is refit in the background from your newest requests, so a burst of requests never waits for it. Nothing is ever pickled or unpickled: models are refit from stored feature rows.
The forest needs scikit-learn, which pip install "django-dbs[guard]"
installs. Without it the guard scores with its rules alone, and both
python manage.py check and python manage.py dbs upgrade say so.
For an account's first sessions (the policy's learning period) the model is muted, because everything about a new account looks unusual. The rules and both thresholds still apply.
A warning flags the session. A flagged session can still read, but every change in the admin and every download or export ends it, and it must sign in again.
A session with no activity in the admin for the policy's idle timeout is ended on its next request. Set the timeout to 0 to turn this off.
X-Forwarded-For is read only when DBS_TRUST_FORWARDED_FOR = True and
the request arrives from a network in DBS_TRUSTED_PROXIES, for example
["10.0.0.0/24"]. DBS walks the header from the right and takes the first address
that is not one of your proxies.
A locked-out account is cleared from a shell, which always beats the detector:
python manage.py dbs security unlock alice
Requests from DBS_TRUSTED_NETWORKS are scored and recorded but never enforced
against, and DBS_ANOMALY_ENFORCE = False turns enforcement off entirely.