# Vaults and scope

A vault is the research context everything else in Phantom belongs to:
one bug bounty program, one client engagement or one lab. This guide
explains how to create a vault, write scope rules that the backend can
enforce, and manage the targets you test inside it.

## Vaults

Create a vault on the **Vaults** page, or with `POST /api/v1/vaults`.

| Field | Notes |
|---|---|
| `name` | Required |
| `platform` | `hackerone`, `bugcrowd`, `intigriti`, `yeswehack` or `custom` (default). A label for your own organisation; Phantom never contacts the platform. |
| `target_domain` | The program's main domain |
| `program_url` | Optional link to the program or engagement brief |
| `scope_rules` | `{"in": [...], "out": [...]}`, up to 500 patterns each |

The active vault is the context of the whole interface. The proxy
captures into it, and History, Repeater, Intruder, notes, findings and
reports all show that vault's objects. Each vault reports its number of
targets, findings by severity, active scans and last activity.

Every vault is a tile in the column on the left edge of the window: its
initials, a dot in its platform's colour, and a pulse while a scan runs
in it. Click a tile to switch to that vault. Beside the column, the
channel list shows the active vault's modules in two groups: **Research**
(Overview, Proxy, Targets, Scans, Assets) and **Document** (Findings,
Notes, Files, Reports). The torii at the top of the column opens
**Home**, the modules every vault shares: Programs, Signatures, Skills,
Payloads and the agent. Switching between Home and a vault returns to
the page you had open on that side. The proxy's state sits at the foot
of the channel list; click it to start capture into the active vault,
stop it, or move it here. Right-click a tile (or Shift+F10) to switch
to the vault, open its overview, copy its domain, open its program page
or attach it to the agent conversation; "+" under the tiles creates a
vault.

Right-click a vault in the list (or Shift+F10) to switch to it, rename it
in place (F2), copy its domain, open its program page, attach it to the
agent conversation, or delete it after a confirmation in the row.

Deleting a vault deletes everything it owns: targets, scans, findings,
captured traffic, notes, annotations, payload collections of the vault,
Repeater tabs, comparisons, assets and reports. Global payload
collections are shared by every vault and are not affected.

Vaults are isolated from each other. An id of another vault answers
exactly like an id that does not exist, in REST, in MCP and in note or
report references.

### Appearance

Each vault is a tile in the vault column on the left: its picture, or
its initials on its colour, or on a neutral tile. Choose a colour and
upload a photo when you create the vault, or later with **Change
appearance** in the tile's menu. A photo is cropped square and scaled
down before it is sent; Phantom accepts PNG, JPEG, WebP and GIF up to
256 KB and recognises the type from the file itself. A vault created
from a program takes the program's picture when the platform gives one,
and **Use the program's picture** takes it again later; Phantom
downloads it once over HTTPS and serves it itself, so the interface
never loads anything from the platform. A pulsing dot on a tile means
a scan is running in that vault.

## Scope rules

Scope decides what Phantom will send traffic to. Each rule is one of:

| Pattern | Matches |
|---|---|
| `api.example.com` | That host only |
| `*.example.com` | Every name below `example.com`, not `example.com` itself (list the apex separately) |
| `10.0.0.5`, `::1` | That IP address |
| `10.0.0.0/24`, `2001:db8::/32` | Every address in the range |

A host is in scope when an in-rule matches and no out-rule does:
exclusions always win. Matching ignores case, a trailing dot and IPv6
brackets, and compares internationalised names in their punycode form, so
an exclusion cannot be bypassed by spelling a host differently.

Patterns that would match more than you wrote are refused when the vault
is saved, with a 422 that names the index of the pattern. For example
`*example.com` is refused because it would also match `evilexample.com`.
Patterns are stored in canonical form.

### Scope entries

The **Scope** card keeps every line of a program's scope as an entry,
exactly as written, with what Phantom understands of it:

| Kind | Example | Authorises |
|---|---|---|
| host, wildcard, IP, range | as in the table above | The hosts or addresses it matches |
| URL | `https://app.example.com/api/` | Only requests under that scheme, host, port and path prefix (`/api/x`, not `/apix`) |
| app | `com.example.app` | No traffic; kept for the record and eligibility |
| other | `Any asset owned by Example` | No traffic |

Each entry is an inclusion or an exclusion and carries its **bounty
eligibility** (eligible, not eligible, unknown), where it came from, the
program's own wording, and optional **first and last days**. An entry
outside its days is kept but does not apply; the scope in effect is
recomputed whenever entries change and when a day starts or ends one,
which is announced as `scope.expired`. Every change to the scope in
effect bumps the vault's policy version (see Engagement rules).

Leave the kind on **Detect** to read it from the value; choose it to
record an app id that looks like a host name. URLs are normalized the way
servers route them (case of scheme and host, default ports, dot
segments, repeated slashes), so a prefix cannot be sidestepped by
spelling. A bare host is never admitted by a URL entry alone: requests
are checked with their full URL.

When a vault excludes IP addresses or ranges, every request Phantom
sends also checks what the name resolves to at that moment: a host in
scope that resolves into an excluded network is refused.

Agents read every entry (`scope_entries`) and may narrow a scope: add
exclusions (`scope_exclude`) and remove inclusions
(`scope_entry_remove`). Adding an inclusion, lifting an exclusion or
editing an entry is yours.

| Method | Route | Does |
|---|---|---|
| GET | `/vaults/{id}/scope/entries` | Every entry, with whether it applies today |
| POST | `/vaults/{id}/scope/entries` | Add `{value, kind?, effect, eligibility, note, starts_on, ends_on}` |
| PATCH | `/vaults/{id}/scope/entries/{entry_id}` | Change an entry (user only) |
| DELETE | `/vaults/{id}/scope/entries/{entry_id}` | Remove an entry |

The vault's `scope_rules` stay the scope in effect (`in`, `out`, and
`in_urls`, `out_urls` for URL entries); saving them replaces the
host-pattern entries and keeps URL, app and other entries.

### Where scope is enforced

Scope is checked by the backend, for every client:

- when a target is created,
- when a scan starts (the start URL must be in scope),
- on every request a scan engine sends,
- on replay and Repeater sends, and on Intruder attacks,
- on every agent call that sends traffic.

Captured traffic is not blocked by scope, because you browse the
application yourself. Instead every flow is flagged `in_scope`, History
can highlight or filter on it, Intercept can be limited to in-scope hosts,
and capture filters can skip out-of-scope traffic entirely
([Capture and retention](./proxy/capture.md)).

### Editing scope from traffic

Every message view has a selection menu. Select a URL or host in a
request or response, and the menu offers to add that host to the active
vault's scope, remove it when it is already listed, or exclude it.

Vaults saved by older versions may hold patterns that are no longer
accepted. They stay conservative: an invalid in-rule matches nothing, so
scope can only shrink, and an invalid out-rule keeps its old wildcard
match, so exclusions are never dropped.

## Targets

A target is something inside the vault you intend to test: a web
application, an API, a mobile backend, a network range. Targets are
created on the **Targets** page or with
`POST /api/v1/vaults/{vault_id}/targets`, and the identifier must be in
scope. The same host cannot be added twice to one vault.

| Field | Notes |
|---|---|
| `identifier` | URL, host or address, normalised to its host for the scope check |
| `target_type` | `web` (default), `api`, `mobile`, `network`, `cloud` or `other` |
| `status` | `active` (default), `archived`, `blacklisted` or `vulnerable` |
| `description` | Free text |

Targets are what [scans](./scans.md) run against and what
[findings](./findings.md) are recorded on. They can carry tags, a
bookmark and a note like any other research object
([Annotations](./annotations.md)), and they feed the vault's
[assets](./assets.md).

## Engagement rules

Scope says where testing may go; the **Engagement rules** card on the
vault page says when and how much. Rules are saved together and each
save bumps the vault's policy version:

- **Active testing** on or off. Off refuses every scan, attack, Repeater
  send and replay; capture and inspection go on.
- **Daily request budget**: requests Phantom originates per day in the
  engagement's time zone, counted one by one (every scan request,
  redirect hop and attack request; a Repeater send or replay counts one).
  The card shows today's count.
- **Time zone**, **engagement dates** (first and last day, inclusive) and
  **testing windows** (days of the week and hours; a window ending before
  it starts runs past midnight). No window means any time.

Every scan, attack start or resume, Repeater send and replay asks the
gate first. A refusal answers `403 engagement_refused` with the reason
(`active_testing_off`, `before_engagement`, `after_engagement`,
`outside_window`, `budget_spent`); requests refused in the middle of a
scan or attack are not sent and say why. The card lists recent
decisions: who asked (you or an agent), the operation, the host, the
policy version and the outcome.

Rules are yours: agents read them (`engagement_get`,
`engagement_decisions`) but cannot change them. An agent may narrow a
scope but never widen it, and a vault an agent creates starts with
active testing off until you turn it on.

| Method | Route | Does |
|---|---|---|
| GET | `/vaults/{id}/engagement` | Rules, policy version, today's count, whether active work is refused now |
| PUT | `/vaults/{id}/engagement` | Replace the rules (user only) |
| GET | `/vaults/{id}/engagement/decisions?outcome=&limit=` | Newest decisions |

## Data policy

Each vault can keep its own data longer or shorter than the rest, in
the **Data policy** card of the vault page:

- **Keep HTTP history for N days**: requests older than that are
  removed from this vault, at once when you save and every six hours.
  Annotated requests (tags, bookmarks, notes) and requests linked to
  findings as evidence are never removed. Empty follows the global
  retention of the proxy settings, which also never removes finding
  evidence.
- **Overwrite stored files before removing them**: the vault's stored
  file contents are overwritten with random bytes and flushed before
  they are removed, when a file is deleted, when unused contents are
  cleaned up, and when the whole vault is deleted. On SSDs and
  copy-on-write file systems old blocks can survive overwriting; disk
  encryption is the reliable protection there.

Who may read a vault is set where agent access is granted: each token
lists the vaults it may use. Changing the data policy is for you only
(`GET|PUT /vaults/{id}/data-policy` `{flow_days, secure_delete}`).

## Emergency stop

**Stop all active work** in the command palette stops everything Phantom
sends to targets at once: queued and running scans are cancelled,
running Intruder attacks pause at their place, and Repeater sends in
flight are cancelled. Until you choose **Resume active work** on the
banner that appears on every page, any new scan, attack, Repeater send
or replay is refused with `409 engagement_halted`, whether you or an
agent asks for it. Proxy capture and Intercept go on, since they carry
your own browser's traffic. The stop survives a restart. Paused attacks
stay paused after Resume until you resume them.

`GET /api/v1/system/halt` returns the state; `POST /api/v1/system/halt
{reason}` and `POST /api/v1/system/resume` are for the user only, and
agents cannot call them. See `docs/design/engagement-safety.md`.

## REST and MCP

| Operation | REST | MCP tool |
|---|---|---|
| List, create | `GET`, `POST /api/v1/vaults` | `vault_list`, `vault_create` |
| Read, update, delete | `GET`, `PATCH`, `DELETE /api/v1/vaults/{vault_id}` | `vault_get`, `vault_update`, `vault_delete` |
| Scope review | `GET /api/v1/vaults/{vault_id}` (`scope_rules`) | `scope_rules` |
| Targets | `GET`, `POST /api/v1/vaults/{vault_id}/targets`, `PATCH`, `DELETE .../targets/{target_id}` | `target_list`, `target_create`, `target_get`, `target_update`, `target_delete` |

Agents need the `vault_meta` grant for these tools, and only see the
vaults their token names ([Agent permissions](../agents/permissions.md)).
`vault_delete` is marked destructive.

See [Data models](../reference/models/workspace.md#vault) for every stored field.
