Operate · 12
Security and staff access
Access is explicit, auditable and revocable. Staff use individual accounts, sensitive surfaces require capabilities, and the production preset enables the headers and cookies expected on a TLS host.
Staff access
Staff accounts are individual users with a StaffProfile role. Curated roles apply Django model permissions; the dashboard middleware maps URL prefixes to capabilities. Superusers bypass module checks but still leave audit records.
| Control | Where |
|---|---|
| Staff account and role | /dashboard/team/ |
| Role permission presets | apps.accounts.models.STAFF_ROLES and sync_staff_roles |
| Module capability map | apps.dashboard.middleware.MODULE_PERMISSIONS |
| Audit entries | /dashboard/audit/ |
Authentication surfaces
Sign-in is at /account/login/; staff are routed to the console after login. Registration, password reset, social sign-in and account security all live under /account/. Password validators enforce length, common-password and numeric checks.
Google and Apple OAuth callbacks are /account/oauth/google/callback/ and /account/oauth/apple/callback/. Linking and unlinking a social identity is protected against removing the last usable sign-in method.
Two-factor authentication
Staff can enroll a TOTP authenticator from the account security page. Recovery codes are generated at enrollment; store them offline. Disabling 2FA requires the current credential. Login attempts and blocked IPs are visible in the staff security workbench.
Require 2FA for every staff account with access to orders, refunds, payouts, settings or the Django admin.
Rate limits and blocking
apps.security.middleware.SecurityMiddleware applies database-backed request windows to auth, cart, checkout, appointments, API and gift-card paths. The Nginx TLS site adds a coarse edge limit for /account/ and /api/. Set RATE_LIMITING_ENABLED=1 in production.
Login attempts are recorded; repeated failures can block an IP for a configured duration. The staff security workbench shows the blocklist and rate-limit configuration.
Maintenance mode and headers
The maintenance switch in Site Settings returns a branded 503 for public requests while allowing staff, account, static, health and admin paths. Production settings enable HSTS, SSL redirect, secure cookies, X-Content-Type-Options: nosniff, a strict referrer policy, cross-origin opener policy and X-Frame-Options: DENY.
Staff preview endpoints and the Studio ?preview=1 storefront are the only same-origin frame exceptions. The frame middleware sets frame-ancestors 'self' there and frame-ancestors 'none' everywhere else.
Incident checklist
- Suspend the affected staff account and rotate any exposed provider key.
- Review the audit log, login attempts, IP blocklist and webhook delivery log.
- Check the order, refund and affiliate payout history for unexpected changes.
- Restore from backup only after preserving the current database for investigation.
- Record the timeline and the corrective action in the audit trail or incident notes.