# Data handling

What Phantom keeps, where, for how long, how it is protected, and how
access is recorded. Use it to answer a client's data questions or to
check Phantom against your own requirements.

## Where data lives

Everything stays on the machine that runs Phantom; nothing is
sent to Phantom's authors. Data leaves only when you send it: an export,
a webhook, a model provider you configured, or a bug bounty platform you
connected.

| Data | `run.py` | Docker Compose |
|---|---|---|
| Database (vaults, traffic, findings, notes, reports, audit) | SQLite file in the data folder | `pgdata` volume (PostgreSQL) |
| Vault files, plugins | `~/.phantom/files`, `~/.phantom/plugins` | `files`, `plugins` volumes |
| Interception CA | `~/.ph-proxy` | `ca` volume |
| Configuration key | key file next to the database | `keys` volume, or `PHANTOM_CONFIG_KEY` |

**Residency** is the machine in front of you: Phantom is not deployed to
a server.

## Retention

| Data | Kept |
|---|---|
| Captured traffic | by the retention policy (count, body size, age per vault; annotated requests kept); Proxy › Settings |
| Scans | by the scan retention setting |
| Audit trail | newest 20,000 rows and the last 90 days, removed in whole sealed blocks |
| Webhook deliveries | newest 200 per webhook |
| Notifications | read 30 days, unread 90 |
| Everything else | until you delete it; deleting a vault deletes its data |

## Encryption

- **In transit:** the interface and API listen on loopback; webhooks to other
  machines must use https; model providers and platforms are reached over
  https unless you configure a local one.
- **Secrets at rest:** provider keys, platform tokens, webhook secrets and
  session profile values are encrypted with the configuration key
  (Fernet). Keep a copy of the key: without it they cannot be read.
- **Everything else at rest** is stored as written. Encrypt the disk or
  volume (for example LUKS, BitLocker, an encrypted cloud volume) when a
  client requires encryption at rest.

## Access logging

- Every agent, model provider and development-mode operation, and every
  change to tokens and connections, is in the
  [audit trail](./audit.md), sealed so changes can be detected, with
  export.
- Active testing decisions (allowed and refused scans, sends and attacks)
  are recorded with the actor and the policy version (engagement rules).
- Findings keep a history of who changed status, severity, scoring,
  deadlines and risk acceptances.
- Credentials are masked in what agents read, in exports by default, and
  in webhook payloads.
