DocsSecurity & ComplianceData Encryption & Privacy

Data Encryption & Privacy

Where AsPeekIt keeps its data, what is encrypted or hashed at rest, how data travels between the components, and how long inactive assets, audit events and other history are kept.


Where Data Lives

The production deployment (docker-compose.prod.yml) runs four data stores next to the backend. None of them publishes a port: they are reachable only on the internal Docker network, and the only public entry point is the reverse proxy (Traefik), which terminates TLS.

  • PostgreSQL: the system of record (assets, findings, zones, agents, users, audit log, settings)
  • Elasticsearch: the asset search index (asset metadata such as name, type, zone, owner, tags; it holds no credentials or keys). Rebuilt from PostgreSQL when needed
  • Neo4j: the dependency graph used by the topology views
  • Redis: Celery task queue and cache
  • trivy_cache volume: the Trivy vulnerability database of the trivy-server service

Note: AsPeekIt does not configure TLS between the backend and these stores: in the bundled deployment they share a private network with it. With an external PostgreSQL, add sslmode=require (or verify-full) to DATABASE_URL to encrypt that connection, and use disk or volume encryption of your platform for encryption at rest.

Encrypted or Hashed Secrets

Secrets that AsPeekIt must use again are encrypted with Fernet (AES-128-CBC with HMAC-SHA256); secrets it only has to verify are stored as hashes.

  • Notification channel URLs and secrets (Slack, Microsoft Teams, webhooks): Fernet with NOTIFICATION_CHANNEL_ENCRYPTION_KEY. When unset, the key is derived from DJANGO_SECRET_KEY, so rotating the secret key makes the stored channels unreadable: set a dedicated key in production
  • Private key of the agent CA (automatic mTLS): Fernet with AGENT_CA_ENCRYPTION_KEY
  • Agent API keys, relay keys, enrollment tokens and API tokens: SHA-256 hash plus an 8-character prefix for identification. The plaintext is shown once, at creation, and cannot be recovered: a lost key is replaced by a new one
  • MFA backup codes: stored hashed and usable once
  • User passwords: salted PBKDF2-SHA256 (Django default hasher)

Discovery Zone Credentials

The credentials of a discovery zone (connection_config) are stored as JSON in PostgreSQL. They are not encrypted by the application, but the API never returns them: every value whose key looks secret (password, secret, token, key, credentials_json, kubeconfig, community, cert, …, also inside nested objects and lists) is replaced by ***MASKED***, and a PEM private key is masked whatever its key. Sending ***MASKED*** back on update keeps the stored value. See Credential Management (/docs/security/credentials).

Warning: Because zone credentials are readable by anyone with access to the database or its backups, protect PostgreSQL dumps like a secrets store and give each zone a read-only identity.

Data in Transit

Every external connection goes through the reverse proxy over HTTPS; the production settings redirect HTTP to HTTPS and send HSTS (see Platform Security, /docs/security/overview).

  • Browser to AsPeekIt: HTTPS for the REST API and the dashboard, WSS for real-time updates
  • Agents to AsPeekIt: HTTPS with the X-Agent-ID and X-API-Key headers (never in the URL); with automatic mTLS the agent also presents a client certificate on the dedicated endpoint AGENT_MTLS_URL
  • Agents verify the server certificate. A private CA is trusted with tls_ca_file in agent.yaml (or IDP_TLS_CA_FILE); tls_skip_verify turns the check off and logs a warning
  • Agent Trivy clients reach the trivy-server through the same host, at /twirp/, with the mandatory TRIVY_SERVER_TOKEN (see Container Image Scanning, /docs/security/image-scanning)
  • Outgoing calls to feeds and to monitoring sources (Prometheus, Zabbix, Tempo, vSphere) use the URLs you configure, checked before use: only http and https, cloud metadata and link-local endpoints always blocked, private ranges allowed unless DISCOVERY_ALLOW_PRIVATE_TARGETS=false

Inactive Assets and Retention

Assets are not deleted when a discovery no longer sees them: their own source marks them inactive (is_active = false), unless another source still sees them (assets merged across zones stay active). Deleting an asset from the API is also a soft delete. An inactive asset that is discovered again becomes active again.

  • Discovered assets inactive and neither seen nor modified for ASSET_PURGE_RETENTION_DAYS (default 30, never less than ASSET_PURGE_MIN_RETENTION_DAYS, 7) are deleted permanently by the daily purge-stale-assets task, together with their dependencies and their entries in Neo4j and Elasticsearch
  • Manually created assets are never purged
  • A partial network scan never deactivates anything
  • Discovered dependencies not seen for DEPENDENCY_STALE_DAYS (default 7) become inactive and are purged after ASSET_PURGE_RETENTION_DAYS
  • Discovery jobs are kept DISCOVERY_JOB_RETENTION_DAYS (default 90), agent scans AGENT_SCAN_RETENTION_DAYS (default 30) and audit events AUDIT_RETENTION_DAYS (default 730); 0 keeps them forever