# M1 — Proxy & HTTP workspace

### PX — Proxy service & capture [P0/P1]

- [x] Verify HTTP/1.1 and HTTP/2 behavior, connection reuse, streaming and protocol negotiation. — ALPN now offers only `http/1.1` on the intercepting and upstream contexts, so HTTP/2 clients and servers negotiate HTTP/1.1 deterministically; tests cover that negotiation, client keep-alive reuse to the proxy (upstream connections are per request by design) and slow chunked streaming relayed and stored intact (`test_proxy_protocols.py`, `docs/guides/proxy/protocols.md`). HTTP/2 framing itself remains unsupported and documented.
- [x] Validate HTTP CONNECT, TLS interception, CA installation and certificate errors. — *Progress:* upstream certificate errors are verified and reported (502 + flow error); per-host certificates use an IPAddress SAN for IP targets and pass strict verifiers (`b8933c2`, `tests/test_upstream_tls.py`, `tests/test_proxy_certs.py`); CA installation check: `http://phantom/` fetches `https://phantom/ca-check`, which the proxy terminates itself with a CA-signed certificate for `phantom`, so the page shows whether this browser trusts the CA (`own_tls.py`, `test_proxy_ca_check.py`).
- [x] Provide configurable listener interface, port, lifecycle and public CA download in Proxy Settings. — persisted, restarts the listener and restores it on bind failure (`f768853`, `952c330`, `tests/test_proxy_settings.py`).
- [x] Keep proxy start/stop distinct from interception enable/disable. — separate switches in API, UI header and MCP (`f768853`, `952c330`).
- [x] Verify binary capture, multipart bodies, large transfers and compressed responses (gzip, deflate, Brotli, Zstandard). — *Progress:* binary bodies, stacked codings and large chunked/Content-Length bodies are tested (`f768853`); multipart uploads with a binary part and boundary-like content, multipart responses, and a 3 MiB upload stored as a flagged prefix (`test_proxy_multipart.py`), which found plain HTTP refusing bodies over 1 MiB, fixed.
- [x] Store original captured bytes separately from decoded/pretty representations; indicate truncation and decoding failures. — raw bytes stored; decoding only for display with `decoded`/`decoded_truncated` flags; raw or decoded download (`f768853`).
- [x] Verify WebSocket capture including directional frame metadata, binary frames and session history. — *Progress (`48866e8`, backend):* handshake recorded as a flow of kind `websocket` on both relay paths (tunnel: RFC 6455 frames parsed from a copy of the piped bytes, masking, fragmentation, interleaved control frames, permessage-deflate inflated per direction; plain path: upstream handshake first, refused upgrade = 502 + recorded flow, pings and close codes end to end), `ws_sessions` summary and `ws_frames` per message (direction, opcode, sizes, truncation, masked, compressed, close code/reason), per-message body limit, per-session `ws_max_frames`/`ws_max_bytes` settings, shared memory budget, capture filter on the handshake, batched writes, throttled `proxy.ws.frames` and one `proxy.ws.closed`; `GET /flows?kind=websocket`, frame paging/filters/search, single frame, JSON lines export under the export redaction policy; MCP `ws_frames_list`/`ws_frame_get` (redacted, bounded); HAR `_webSocketMessages` export and import; frame bytes in retention stats and pruning; migration `c6d2a8f4e1b9` (`docs/guides/proxy/websocket.md`, `test_websocket_*.py`, `test_mcp_websocket.py`). Interface (`14873fe`): WS chip and counts on session rows, type filter, Messages tab with session summary, virtualized message list with direction, opcode, size and markers, backend filters, live append, payloads in the shared viewer (JSON, hex, masked).
- [x] Document unsupported transport features; evaluate HTTP/3/QUIC and gRPC compatibility separately. — *Progress:* HTTP/1.1-only behaviour, ALPN, WebSocket relay and no QUIC documented in `docs/guides/proxy/protocols.md` (`f768853`); gRPC evaluated there: native gRPC needs HTTP/2 and does not pass, gRPC-Web and JSON gateways work as ordinary HTTP without a protobuf decoder.
- [x] Add capture inclusion/exclusion settings, bounded buffering, disk limits and retention controls. — *Progress (`15ce3c5`, backend):* `proxy.capture` filter (in-scope only, static asset preset, include/exclude rules with bounded regex, skip counters), `max_body_bytes` setting and a shared in-flight memory budget, global `proxy.retention` policy (per-vault count, body-byte and age limits, annotated flows kept) enforced on a schedule and by `POST /flows/prune` with dry run, `GET /flows/stats`; REST and MCP (read and preview only) (`docs/guides/proxy/capture.md`, `test_capture_*.py`, `test_retention_*.py`, `test_mcp_capture.py`); interface open. *Interface (`48866e8`):* Proxy → Settings cards "What gets recorded" (scope, static preset, rules, live counters), "Memory" (body limit and budget with units) and "Storage and retention" (vault statistics, policy, cleanup preview and confirmed cleanup); `captureLimits.spec.ts`.
- [x] Support per-vault capture assignment, session labels, bookmarks and annotations. — *Progress (`cd904ee`):* backend for bookmarks, notes and vault tags on flows, targets and findings, deleted with their object, REST and MCP (`docs/guides/annotations.md`, `test_annotation_api.py`, `test_annotation_cascade.py`); History interface for bookmarks, tags and notes (`7f20bab`, `annotations.spec.ts`); session labels: the label set in the Proxy header is stored on captured flows (migration `e5a9c3d7f2b4`), shown in the Source column and searchable with `label:` (`test_session_label.py`, `historySearch.spec.ts`).

### HISTORY — Traffic explorer [P1]

- [x] Virtualized DataTable with server-side filtering, sorting, pagination and live updates. — *Progress (`cd904ee`):* server-side filters (repeated host/method/status class, tag, bookmark, saved view) under keyset pagination, rows carry bookmark and tag ids (`test_history_filters.py`); the history table now queries them with keyset paging and live matching (`7f20bab`, interface). Server-side sorting by method, host, status, size, duration or capture order in either direction with a (value, id) keyset cursor; the table's sortable headers drive it (`test_history_sort.py`, `historySort.spec.ts`).
- [x] Configurable columns, resizing, ordering, hiding, persisted layouts and keyboard navigation. — TanStack table with ↑/↓, R and Shift+R (`006ee60`).
- [x] Search by host, path, method, status, content type, time, tag and supported message content. — host, method, status class, tag and bookmark filters (`cd904ee`); a search language for words in the host or path and `type:`, `body:` (stored bytes), `since:`, `until:`, evaluated on the server for lists and saved views and mirrored for live rows (`app/core/proxy/search_terms.py`, `test_history_search.py`, `historySearch.spec.ts`, `docs/guides/proxy/history.md`).
- [x] Saved filters, quick filter presets, multi-selection and batch organizational actions. — *Progress (`cd904ee`):* saved views with a versioned, server-evaluated query and a batch bookmark/tag endpoint for up to 1,000 flows (`test_saved_views.py`, `test_annotation_batch.py`); interface: Save view, pinned views, multi-select with batch bookmark and tag (`7f20bab`). Quick filter presets built from the server filters and search operators, savable as views (`historyPresets.spec.ts`).
- [x] Optional in-scope highlighting (off by default); do not conflate visual highlighting with enforcement. (`006ee60`)
- [x] Host list/tree, host counts, search, expand/collapse, and responsive scrolling. — host list with counts and scope dot (`006ee60`); a filter field and grouping by site with expand and collapse, the chosen host's group kept open (`utils/hostTree.ts`, `hostTree.spec.ts`); the sidebar scrolls on its own.
- [x] Context menu: inspect, bookmark, annotate, copy sanitized URL/cURL, export, associate with finding, compare, and open in the appropriate authorized workspace. — the history row menu (`PFlowRowMenu.vue`, acting on a selection too): Repeater, Intruder, compare, attach to the agent, create a finding from the request with a `[[flow:id]]` reference, scan, bookmark, tags, note, masked URL and cURL copies, HAR export, scope actions, host filter, delete (`edd6cdd`, `docs/guides/proxy/history.md`).
- [x] HAR import/export with validation, optional sensitive-field redaction and clear limitations. — *Progress (`7f20bab`, backend):* streamed HAR 1.2 export with history filters or ids under the export redaction policy (redact / ask / reveal), truncation marked, 50,000-entry limit; import with dry-run preview, per-entry validation and skip reasons, body-limit truncation, `source = import`, original times, `in_scope_only`, one `proxy.imported` event; MCP `flow_export_har` (MCP policy, bounded) and `flow_import_har`; migration `a7d2c4e6f8b1` (`test_har_*.py`, `test_mcp_har.py`, `docs/guides/proxy/har.md`). Interface (`8248c63`): HAR menu exports the selection or the current filters, masked or as captured as the export policy allows, probed first so limit and policy errors show; import panel with drop zone, dry-run preview (valid entries, scope, skip reasons, hosts, truncated bodies), in-scope only and live reload.
- [x] Timeline with zoom, time-range filtering, request count, status distribution and latency summaries. — range selection drives the summaries and host table (`006ee60`).

### EDITOR — Universal HTTP message viewer [P1]

- [x] Reuse one message viewer across History, Intercept, Repeater, Findings, Reports and other modules. — `PMessageView` serves History, Intercept, Repeater, Intruder results and finding evidence (`006ee60`, `952c330`); Report Studio's evidence requests and agent references open in that same viewer in History rather than a copy of it (`docs/guides/reports.md`).
- [x] Clear separation between Request and Response with adjustable split, side-by-side or stacked layout. — segmented switch or split cards with a draggable divider (`952c330`).
- [x] Raw, Pretty, Headers, Cookies, Params, Hex and safe Preview modes where applicable. — Headers and Params (query, form, top-level JSON) tables, Parts for multipart, masked; Cookies stays in the request panel switch (`ab24f36`, `viewerFields.spec.ts`).
- [x] Syntax highlighting, line numbers, folding, search, word wrap and copy/export controls. — line numbers (preference), fold JSON and markup with fold all/unfold all, Ctrl+F find over the shown text with case and bounded regex (`ab24f36`, `viewerCode.spec.ts`).
- [x] JSON, XML, HTML, form data, multipart and text formatting; do not silently modify original evidence. — every view derives from the shown text; captured bytes are unchanged (`ab24f36`).
- [x] Image preview, binary metadata, byte size and original-body download with explicit confirmation where sensitive. — metadata row with size, binary flag and image dimensions; download menu states masked or as captured (`ab24f36`).
- [x] Distinguish editable messages from read-only captured evidence. — captured messages are read-only; Repeater and Intercept use the editor (`952c330`).
- [x] Show decoding pipeline, original/decoded sizes and any unavailable content. — e.g. `br → 853.6 KB decoded from 117.3 KB`, undecoded codings and truncation flagged (`ab24f36`).
- [x] Accessibility, large-body performance and secret-masking regression tests. — *Progress (`ab24f36`):* virtualized code view above 400 lines; a 5 MB JSON body formats, masks, splits, folds and searches in ~230 ms (`viewerPerf.spec.ts`); masking regressions for find, Headers, Params and Parts; aria labels on toolbar controls. A full accessibility audit is open. Accessibility audit (`ecab9bc`): token contrast to AA with an automated test, keyboard and arrow navigation, focus return, grid semantics, reduced motion, 24 px targets (`docs/reference/accessibility.md`); keyboard alternative for drag-to-reorder: Alt+Left/Right on History column headers and Repeater tabs; an automated axe run in the Vitest suite over mounted components with a negative control (`src/components/__tests__/a11y.spec.ts`).

### REPEATER — Manual authorized request workspace [P1]

- [x] Modern multi-tab layout with rename, reorder, duplicate, close/reopen and per-vault persistence. — *Done (backend `ced8cd7`, interface `da3c6d2`):* `repeater_tabs` per vault with dense ordering, rename, reorder, move, duplicate, close (100 kept), reopen and delete; 200 open tabs per vault; REST under `/vaults/{id}/repeater/tabs`, `repeater.updated` events, MCP tools; migration `b2f6c8d4a1e7` (`docs/guides/repeater.md`, `test_repeater_tabs.py`, `test_repeater_isolation.py`). Interface: tabs kept with the vault, drag to reorder, rename in place, duplicate from the tab menu, Alt T / Alt W / Alt Shift T and a recently closed menu (`repeater.spec.ts`).
- [x] Request/response history, timing, cancellation, error states and per-tab settings. — *Done (backend `ced8cd7`, interface `da3c6d2`):* sends through the replay exchange with follow redirects (hops scope-checked), timeout and Content-Length settings; `completed` / `failed` / `cancelled` with duration and error; one send in flight per tab, cancel endpoint; keyset send history, 500 kept per tab; `repeater.sent` events (`test_repeater_send.py`, `test_repeater_history.py`). Interface: Send / Cancel (Esc), out-of-scope and TLS failure messages, send history popover with outcome, size, time and notes, settings and note popover.
- [x] Safe URL, headers, parameters and body editing with consistent serialization. — Repeater Fields view: method, path, query parameters and headers as rows written back into the raw request; the body is untouched byte for byte, unedited parameters keep their exact text, line endings are kept, and edits that would inject a header or split the request are refused (`utils/requestFields.ts`, `requestFields.spec.ts`, `docs/guides/repeater.md`); the body is edited in the raw view.
- [x] Preserve original captured requests and record edits as separate revisions. — *Done (backend `ced8cd7`, interface `da3c6d2`):* the source flow is never changed; each send stores the exact revision sent (raw, target, settings) and can be restored as the draft; flow delete, prune and clear keep sends with their revision (`test_repeater_history.py`). Interface: a past send shows the exact request it sent and its response; Restore makes it the draft.
- [x] Provide comparison between response versions and notes linked to evidence. — *Progress (backend, `ced8cd7`):* tab notes and per-send notes; each send links its response flow for comparison. Interface: compare a send with the previous or latest answered send in the Comparer (`da3c6d2`). Saved comparisons with notes, referenced from research notes as `[[comparison:id]]` (`docs/guides/comparer.md`, `edfb9b9`). A saved comparison creates a finding that references it and both requests (Create finding from this comparison…, `menus-proxy.spec.ts`, `docs/guides/comparer.md`).
- [x] Apply the active engagement policy before sending; surface blocked requests without side effects. — replay is scope-checked on the backend; the error is shown in the tab (`92f8f7b`, `952c330`).

### INTERCEPT — Traffic review [P1]

- [x] Implement a clear pending-message queue with actual state synchronization. — backend queue mirrored over `intercept.held/released/updated` events (`f768853`, `952c330`).
- [x] Review, edit, forward or drop authorized intercepted messages with explicit lifecycle feedback. — browser-verified end to end; flows record `intercepted`/`edited` (`f768853`, `952c330`, `tests/test_proxy_intercept.py`).
- [x] Configure interception rules and distinguish request versus response interception. — hold/skip rules on host, method, path, URL, query, header, body, status and type; separate request and response options; bounded regex (`badadb1`, `tests/test_intercept_rules.py`, `tests/test_proxy_intercept_rules.py`, browser-verified).
- [x] Define queue bounds, timeout behavior and safe release/stop behavior. — hold timeout (300 s default), release on disable, stop and shutdown; a client disconnect marks the item `cancelled` (`f768853`).
- [x] Ensure no queued traffic crosses vault or actor boundaries. — every held message keeps its capture vault; agents list, read, forward, drop and release only messages of vaults their token reaches, also after capture moved to another vault (`app/services/intercept_service.py`, `test_held_messages_stay_in_their_vault`).
- [x] Add tests for race conditions, disconnect, cancellation and restart behavior. — two decisions on one message (exactly one applies), a client disconnecting while held (the hold is cancelled within half a second; this test found the gap and the fix watches the connection), disable, timeout, stop and shutdown release (`tests/test_proxy_intercept.py`, `test_proxy_shutdown.py`); held messages live in memory and a restart releases them through shutdown first.

**Exit gate:** Test against controlled local fixtures for HTTP/1.1, HTTP/2, binary and compressed bodies, certificate verification and WebSocket behavior. All enabled UI actions have real backend implementations; show explicit unsupported states where applicable.
