DocsSecurity & CompliancePlatform Security

Platform Security

How AsPeekIt protects itself: user authentication (JWT, MFA, SSO), roles, the agent channel (per-agent keys, enrollment tokens, automatic mTLS), transport hardening in production, and how secrets are stored. For the vulnerability management pages (the "Security overview" in the sidebar), see Security Overview & Findings (/docs/security/findings).


Scope of This Page

This page describes the security of the AsPeekIt platform itself. The Security section of the dashboard sidebar (Security overview, CVE Database, Server Security, Container Images, Web Applications, Suppression Rules, Vulnerability Feeds) is about the vulnerabilities of your infrastructure and is documented in Security Overview & Findings (/docs/security/findings) and the pages linked from it.

User Authentication

Users sign in with a username and password (POST /api/v1/auth/token/) and receive a pair of JSON Web Tokens: a short-lived access token sent in the Authorization header of every API request, and a refresh token used to obtain a new access token.

  • Access token: valid for 1 hour
  • Refresh token: valid for 7 days; every refresh issues a new refresh token and blacklists the old one (rotation), so an old refresh token cannot be replayed
  • Logout (POST /api/v1/auth/logout/) blacklists the refresh token
  • Changing the password invalidates every access token issued before the change
  • Passwords are hashed with the Django default password hasher (PBKDF2-SHA256) and checked by the Django password validators (minimum length, common passwords, numeric-only, similarity to the user attributes)
  • Authentication endpoints are rate limited per client: login and SSO exchange 10/minute, MFA 5/minute, token refresh 120/minute, self-registration 5/hour (THROTTLE_AUTH_* settings)
  • Self-registration (POST /api/v1/auth/register/) is off by default (ALLOW_SELF_REGISTRATION=false): admins create users in User Management

Multi-Factor Authentication

Every user can enable TOTP multi-factor authentication in Settings (authenticator app plus single-use backup codes). With MFA enabled, the login asks for a TOTP or backup code after the password; disabling MFA requires the password and a valid code. Enabling and disabling MFA are recorded in the audit log (auth.mfa_enabled, auth.mfa_disabled).

Note: ADMIN_REQUIRE_MFA refuses Django admin logins for staff users who have not enabled MFA. It is on by default in production settings and off in development.

Single Sign-On (OIDC)

AsPeekIt supports SSO through an OIDC token exchange (POST /api/v1/auth/oidc/exchange/): the frontend sends the ID token issued by the identity provider, and the backend verifies its signature against the provider JWKS and checks the issuer and audience before issuing AsPeekIt tokens. A provider is enabled only when its settings are present.

  • Azure AD (Microsoft Entra ID): AZURE_AD_CLIENT_ID and AZURE_AD_TENANT_ID. The tenant must be a single tenant: the multi-tenant aliases common, organizations and consumers are not accepted
  • Google: GOOGLE_CLIENT_ID, optionally GOOGLE_HOSTED_DOMAIN to accept only one Workspace domain; the e-mail must be verified
  • Okta: OKTA_CLIENT_ID and OKTA_ISSUER (OKTA_JWKS_URI optional)
  • Role mapping (Azure AD and Okta): members of OIDC_ADMIN_GROUP (default IDP-Admin) become admin, members of OIDC_STAFF_GROUP (default IDP-Staff) become manager, everyone else viewer. The role is recomputed at every SSO login, except that the last active admin is never demoted
  • Google sends no groups: the roles of Google users are managed in AsPeekIt
  • The first SSO login creates the user (audit event user.created with source oidc)

Roles and API Tokens

Every user has one of three roles: viewer (read-only), manager (also triages findings and changes assets, discovery zones, agents and relays) and admin (also users, the audit log, API tokens and the vulnerability feeds). The dashboard hides the pages a role cannot use, and the API enforces the same rules (403). Integrations authenticate with API tokens created by an admin, with explicit scopes and an expiry of at most API_TOKEN_MAX_DAYS (default 365); see API Tokens (/docs/api/api-tokens) and User Roles (/docs/teams/roles).

Agent Channel

Agents authenticate every request with the X-Agent-ID and X-API-Key headers, never with user credentials, and can additionally present a client certificate issued by the platform (mutual TLS). See Agent Enrollment & mTLS (/docs/agent/enrollment) for the full procedure.

  • API keys start with idpk_; AsPeekIt stores only their SHA-256 hash and an 8-character prefix. The plaintext key is shown once, at creation. A key can have an expiry date and is revoked from the Agents page (revoked keys are kept, inactive)
  • Zone keys are shared by the agents of an agent-based discovery zone; a dedicated key authenticates a single agent. By default a zone key cannot register a new agent (AGENT_ALLOW_ENV_KEY_ENROLLMENT=false): new agents enroll with an expiring enrollment token (at most AGENT_ENROLLMENT_TOKEN_MAX_HOURS, default 720) and receive a key of their own
  • Automatic mTLS: the platform runs its own CA. The agent generates its private key locally (it never leaves the host), sends a certificate signing request and receives a client certificate valid AGENT_CERT_VALIDITY_DAYS (default 90), renewed automatically when less than a third of its lifetime is left. The certificate is used on the dedicated mTLS endpoint AGENT_MTLS_URL; AGENT_REQUIRE_MTLS makes it mandatory
  • An admin can reset the certificate of an agent (Reset certificate on the agent card) when its key is lost or compromised; issued and reset certificates are recorded in the audit log (agent_cert.issued, agent_cert.reset)
  • The only command an agent accepts from the platform is an on-demand scan (Scan now): it never executes arbitrary commands
  • Relays authenticate with their own keys, also stored as SHA-256 hashes

Transport Security

In production TLS terminates at the reverse proxy in front of AsPeekIt (Traefik in the bundled deployment), and the production settings harden the HTTP layer.

  • HTTP requests are redirected to HTTPS (SECURE_SSL_REDIRECT, on by default in production)
  • HSTS for one year, including subdomains and preload
  • Session and CSRF cookies are sent only over HTTPS; X-Frame-Options DENY; X-Content-Type-Options nosniff
  • CORS is an explicit allow-list of origins (CORS_ALLOWED_ORIGINS), never "allow all"; DJANGO_ALLOWED_HOSTS must be set
  • The backend refuses to start in production with a missing, default or weak DJANGO_SECRET_KEY (fewer than 50 characters)
  • Agents verify the server certificate; a private CA can be trusted with tls_ca_file (IDP_TLS_CA_FILE). tls_skip_verify disables the check and logs a warning at every start

Warning: Never expose AsPeekIt over plain HTTP in production: the agent API keys and user tokens travel in request headers.

Secrets at Rest

How each kind of secret is stored:

  • Agent API keys, relay keys, enrollment tokens and API tokens: SHA-256 hash only, plaintext shown once
  • User passwords: salted PBKDF2-SHA256 hash (Django default)
  • Notification channel URLs and secrets (Slack, Teams, webhooks): encrypted with Fernet using NOTIFICATION_CHANNEL_ENCRYPTION_KEY (derived from DJANGO_SECRET_KEY when unset, so rotating the secret key then breaks the stored channels)
  • Private key of the agent CA: encrypted with Fernet using AGENT_CA_ENCRYPTION_KEY
  • Discovery zone credentials (connection_config): stored as JSON in the database and never returned by the API: every value whose key looks secret is replaced by ***MASKED*** (see Credential Management, /docs/security/credentials). Protect the database and its backups accordingly
  • The audit log never stores secrets: sensitive keys are written as [redacted] (see Audit Logging, /docs/security/audit-logging)

Least Privilege for Discovery

Discovery collectors read metadata from the target APIs; give each zone a dedicated, read-only identity. By default the backend never uses its own ambient credentials (in-cluster service account, GCP application default credentials, a local kubeconfig): zones must carry their own (DISCOVERY_ALLOW_SERVER_CREDENTIALS=false).

  • Kubernetes: a ClusterRole with get, list and watch only
  • Azure: the Reader role on the subscription
  • GCP: the Viewer role on the project
  • VMware: a read-only role on the vCenter objects to discover
  • SNMP: read-only communities or SNMPv3 credentials

Note: Every security-relevant administrative action (logins, users and roles, keys, tokens, certificates, policies, channels) is recorded in the append-only audit log, visible to admins under Platform → Audit Log.