# Design: Intruder payloads

Status: built (backend `5e60241`, interface `65054d0`) as a first-class payload collection
resource shared by every tool: model, REST (global and vault trees), MCP
and tests; see `docs/guides/payloads.md`. The list editor, the import row and the
"Add to payloads" selection action are still to be built in the interface
(roadmap M2, UTIL). The "payload set" below is called a payload collection
in the code, and agent-added items record `actor = agent` (the source stays
the item's provenance). Owner's request: keep it simple and keep the design's
aesthetics. Payloads should feel like a quiet, well-made list, not a
configuration screen.

## Payload sets

A payload set is a named, vault-scoped list of values, stored on the
backend and usable by Intruder, Repeater and signatures. It is a research
object, so it can be tagged and annotated ([Design: research annotations and saved views](research-annotations.md)).

| Field | Notes |
|---|---|
| `name` | Unique per vault. |
| `items` | Ordered values; duplicates allowed but flagged. |
| `source` | `manual`, `import:<filename>`, `selection:<flow id>`, for provenance. |
| `size` | Count and total bytes are shown; large sets are paged, not loaded at once. |

## Ways to add payloads

1. **Type or paste** into the list editor. The editor is one line per
   payload, with line numbers and inline duplicate and empty markers.
2. **Import a file.** One action opens the file picker, then a single
   compact row asks for the separator:
   - default **newline (`\n`)**;
   - presets: comma, semicolon, tab, null byte;
   - custom: any string, with escape sequences (`\r\n`, `\t`).

   A live preview shows the first items and the count before anything is
   saved. Options: trim whitespace, drop empty lines, deduplicate.
3. **From any request.** Select text in any message view (History,
   Repeater, Intercept, Comparer, Findings). The right-click menu gets
   **Add to payloads →**, which lists the payload sets plus "New set…". The
   exact selected text is added and the source flow is recorded. This uses
   the shared `PMessageView`, so it works everywhere at once.

## Interface principles

- Payload sets live in Intruder's sidebar, like Repeater tabs. The selected
  set opens in the main area as the list editor.
- Import and separator choice is one inline step in the editor, not a modal
  or a wizard.
- The selection menu item appears only when text is selected and shows the
  set's name and count, e.g. "Add to *usernames* (1,240)".
- Secrets in a selection are added as the real value, since payloads are
  for active testing, but the list editor masks values that look like
  credentials until revealed, the same as every other view.
- MCP gets the same capabilities: `payload_set_*` tools for create, import
  text with a separator, append and list. Agent-added items carry
  `source = agent`.

## Limits

- Import size is capped and the cap is configurable.
- Encoding is detected; invalid UTF-8 is kept as bytes and shown in hex.
- Sending payloads is governed by Intruder's scope and rate-limit policy,
  never by the payload set itself.
