> ## Documentation Index
> Fetch the complete documentation index at: https://eispatch.framewire.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Security and privacy

> What EISPATCH v1.1.0 does and does not protect: pre-approval blocking, Local Composer hardening, approval integrity, secret redaction, and library storage.

EISPATCH is a **composition layer** that sits in front of your coding agent. It helps you review and approve a prompt before it is sent. It is not a centralized execution controller: once a prompt reaches your agent, the agent's own permissions, sandboxing, and tool policies decide what runs.

This page describes the protections that exist in the v1.1.0 source and where they apply.

## Scope of protections

| Protection | Antigravity (MCP App) | Codex, OpenCode, Claude Code (Local Composer) |
| - | - | - |
| Prompt held before execution | `PreInvocation` hook | Codex and Claude Code: `UserPromptSubmit` hook returns `{ "decision": "block" }`. OpenCode: `chat.message` replaces the prompt parts. |
| Approval state in the composer UI | Yes | Yes |
| Server-side approval token and SHA-256 prompt hash | No | Yes |
| Session token, Host, Origin, and Referer checks | Not applicable (stdio MCP server) | Yes |

## Local operation

Discovery, recommendation, task breakdown, and compilation run in local Node.js processes. The recommender is deterministic and does not call a remote AI service. Approved prompts are delivered through your existing agent session, which reuses that agent's authentication, model, and permissions.

The OpenCode adapter can talk to a local OpenCode server (`serverUrl` or `OPENCODE_SERVER_URL`) to dispatch into the active session.

## Zero dependencies

`package.json` declares no runtime dependencies and requires Node.js 20 or later. The codebase is plain ESM plus a single-file HTML UI, so you can audit it directly.

## Pre-approval blocking

Hooks match prompts against `^(?:\/(?:e|d)ispatch|(?:e|d)ispatch:)\s*(.+)$` (case-insensitive). On a match:

* **Codex and Claude Code**: the `UserPromptSubmit` hook returns `{ "decision": "block", "reason": "..." }` and, unless `EISPATCH_NO_SPAWN=1` is set, starts the Local Composer.
* **OpenCode** (experimental): the `chat.message` hook replaces `output.parts` with a notice that contains the composer URL, so the original task text is not passed on in that message.
* **Antigravity**: the `PreInvocation` hook captures the prompt before task execution.

Setting `EISPATCH_AUTO_INTERCEPT=1` makes the Codex, Claude Code, and OpenCode hooks intercept every prompt, not only prefixed ones.

Prompts that contain `<!-- DISPATCH_COMPILED_PROMPT` pass through unchanged. This prevents loops when an approved prompt is pasted or dispatched back into the agent.

> [!NOTE]
>
> How reliably a host honors a hook's block decision depends on the host. EISPATCH cannot stop a prompt that bypasses the hook (for example, if the hook is not installed or the host is configured to skip it).

## Local Composer hardening

The Local Composer (`core/local-composer.mjs`) is used by Codex, Claude Code, and OpenCode.

* **Loopback only**: binds to `127.0.0.1` on an ephemeral port.
* **Host header check**: every request must use `Host: 127.0.0.1:<port>` or `localhost:<port>`, otherwise **403**.
* **Same-origin checks on `/api/*`**: if `Origin` or `Referer` is present, it must point to the same loopback origin, otherwise **403**.
* **Session token on `/api/*`**: a random per-session token is injected into the page as `window.__EISPATCH_LOCAL_SESSION__` and must be sent as `X-EISPATCH-Token`. A missing or wrong token returns **401**.
* **Body size limit**: request bodies over 5 MB are rejected (returned as a **500** error).
* **Response headers**: `Cache-Control: no-store`, `X-Content-Type-Options: nosniff`, and `X-Frame-Options: DENY`.
* **Idle timeout**: the launcher used by the Codex and Claude Code hooks closes the server after 30 minutes without requests (configurable with `--idle-ms`). The timer resets on every request. The server started by the OpenCode plugin has no idle timeout; it is replaced when the next intercepted prompt starts a new composer.

## Approval integrity (Local Composer only)

The SHA-256 approval binding applies only to the Local Composer. The Antigravity MCP App tracks approval in the composer UI and dispatches with `app.sendMessage()`; it does not issue approval tokens or compute a prompt hash.

In the Local Composer:

1. `POST /api/approve` stores a random approval token and the SHA-256 hash of the exact compiled prompt. Only one approval is active at a time.
2. `POST /api/compose`, `/api/breakdown`, and `/api/compile` clear the active approval. `POST /api/revoke-approval` clears it and marks the token as consumed.
3. `POST /api/dispatch` checks the token and hash, then consumes the token before delivering the prompt.

| Status | Cause |
| - | - |
| **401** | Missing or invalid `X-EISPATCH-Token` session token. |
| **403** | No `approvalToken`, or a token that does not match the active approval (for example, an approval cleared by a later compose, breakdown, or compile). Also returned for a rejected `Host`, `Origin`, or `Referer`. |
| **409** | Replay: the token was already consumed by a dispatch or explicitly revoked with `/api/revoke-approval`. Tampering: the SHA-256 hash of the submitted prompt does not match the approved prompt. |

## Secret handling during discovery

`sanitizeMetadataText` in `core/schema.mjs` redacts the following from capability descriptions and saved instructions:

* `http(s)://` and `ws(s)://` URLs
* `Bearer` tokens
* `api_key`, `token`, `secret`, `password`, `passwd`, and `auth` assignments
* Common key formats (`sk-...`, `ghp_...` style GitHub tokens, `AIza...`)

Redaction is pattern-based. Secrets in other formats may not be caught, so avoid putting credentials in skill or plugin descriptions.

## Library storage

The Prompt Library is stored at `~/.eispatch/library.json`:

* The `~/.eispatch/` directory is created with mode `0700` if it does not exist.
* The library is written to a temporary file with mode `0600` and renamed into place.
* `library.json.lock` serializes writes. A writer waits up to 3 seconds for the lock; a lock older than 10 seconds is treated as stale.
* Saved and imported entries pass descriptions and instructions through the same redaction.
* Entries do not include approval tokens or prompt hashes.

## Installers and uninstallers

Installers register EISPATCH hooks, MCP servers, skills, or plugins. Each installer supports `--check` and `--uninstall`; the uninstaller removes only EISPATCH-owned entries and preserves other settings.

## Advisory capability labels

Selected capabilities are labeled **advisory guidance** unless a capability is marked `enforceable` by an active host-level `PreToolUse` or `BeforeToolSelection` enforcement hook. Advisory capabilities are instructions in the prompt; whether the model follows them is up to the model. See [Capabilities](https://eispatch.framewire.io/guides/capabilities.md).

## Reporting a security issue

Email `framewireio@gmail.com` with a description, steps to reproduce, and relevant logs. Do not open a public issue for undisclosed vulnerabilities.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.