HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.
Python agent-apiagent-frameworkagent-harnessai-agentsai-infrastructurecoding-agentconformance-testingdeepseek-harnessharness-engineeringhermesllmopen-protocolopen-sourceopen-standardpi-coding-agentself-hosteduhpunified-apiunified-harness-protocolunified-interface
docs(protocol): a security chapter, because the rules were scattered
richard-epsilla39a343cbae63
diff --git a/.gitignore b/.gitignoreindex 4faf809c..986c1be0 100644--- a/.gitignore+++ b/.gitignore@@ -10,3 +10,5 @@ __pycache__/# Generated by protocol/site/build.py — build it, do not commit it.protocol/site/dist/++protocol/site/dist/diff --git a/protocol/README.md b/protocol/README.mdindex 9f30f8ec..4155feb0 100644--- a/protocol/README.md+++ b/protocol/README.md@@ -69,6 +69,7 @@ your client depends on, that is a specification bug — please| [Sessions](versions/2026-08-11/sessions.md) | Continuing a conversation, and cancelling one || [Files](versions/2026-08-11/files.md) | Sending files in, getting artifacts out || [Errors](versions/2026-08-11/errors.md) | Failure taxonomy, retries and idempotency |+| [Security](versions/2026-08-11/security.md) | What an implementer must get right, collected in one place || [Schema](versions/2026-08-11/schema.md) | The machine-readable definitions and how to use them |## Quick shape of itdiff --git a/protocol/site/build.py b/protocol/site/build.pyindex 707d649a..ea4a38cc 100644--- a/protocol/site/build.py+++ b/protocol/site/build.py@@ -48,6 +48,7 @@ NAV = [("spec/sessions.html", "Sessions", ROOT / f"versions/{VERSION}/sessions.md"),("spec/files.html", "Files", ROOT / f"versions/{VERSION}/files.md"),("spec/errors.html", "Errors", ROOT / f"versions/{VERSION}/errors.md"),+ ("spec/security.html", "Security", ROOT / f"versions/{VERSION}/security.md"),("spec/schema.html", "Schema", ROOT / f"versions/{VERSION}/schema.md"),]),("Conformance", [diff --git a/protocol/versions/2026-08-11/index.md b/protocol/versions/2026-08-11/index.mdindex d1839c05..ae3416a9 100644--- a/protocol/versions/2026-08-11/index.md+++ b/protocol/versions/2026-08-11/index.md@@ -17,7 +17,8 @@ the [protocol README](../../README.md).| 6 | [Sessions](sessions.md) | Continuing, inspecting, cancelling, sharing, deleting || 7 | [Files](files.md) | File input, artifacts, download, retention and scope || 8 | [Errors](errors.md) | The error envelope, codes, retry rules, timeouts |-| 9 | [Schema](schema.md) | Machine-readable definitions and how to generate from them |+| 9 | [Security](security.md) | Credentials, object scope, artifacts, injection, exhaustion, error hygiene |+| 10 | [Schema](schema.md) | Machine-readable definitions and how to generate from them |## Endpoint summarydiff --git a/protocol/versions/2026-08-11/security.md b/protocol/versions/2026-08-11/security.mdnew file mode 100644index 00000000..f437931b--- /dev/null+++ b/protocol/versions/2026-08-11/security.md@@ -0,0 +1,120 @@+# Security considerations++**Unified Harness Protocol, version `2026-08-11`**++A UHP server runs an agent that executes tools, writes files, and holds a provider credential, on+behalf of a caller it has never met. That is a larger blast radius than a model endpoint, and the+requirements here are collected in one place so an implementer can check them off rather than+rediscover them.++Requirements stated in other chapters are repeated here rather than only cross-referenced. A+security rule a reader has to assemble from six chapters is a rule that gets missed.++## 1. Credentials++- A server MUST authenticate every endpoint except `GET /v1/uhp`+ ([Lifecycle §2](lifecycle.md)).+- A server MUST NOT distinguish "no such token" from "token not permitted here" in a way that lets a+ caller enumerate valid tokens.+- A server MUST NOT echo a credential — the caller's or a provider's — in any response body, error+ message, event, log line, or artifact.+- A server SHOULD support revoking a credential, and revocation MUST take effect for new requests+ immediately.++### 1.1 Provider credentials++The credential a server uses to reach a model provider is the most valuable secret in the system,+and the agent's own sandbox is the least trustworthy place in it: an agent can be induced to read+its environment and print it.++- A server SHOULD NOT place a provider credential where the agent's tools can read it.+- A server that must give a harness a credential SHOULD issue a short-lived, single-session one, and+ MUST be able to revoke it independently of the underlying key.+- A server MUST NOT accept a caller-supplied upstream URL for a brokered request without validating+ it against a configured allow-list. An unvalidated upstream turns the server into an SSRF proxy+ with its own credential attached.++## 2. Object scope++- Every object — harness, response, session, container, file — MUST be scoped to the principal that+ created it.+- A request for an object outside the caller's scope MUST return `404`, never `403`. `403` confirms+ the id exists, which is exactly what an enumerating attacker wants+ ([Architecture §5](architecture.md)).+- Scope MUST be enforced on every operation, not only on read. Cancel, delete, continue and download+ are all object access.++> The conformance suite cannot fully verify this with one credential. An implementer SHOULD run the+> equivalent check with two principals: create an object as A, then attempt every operation on it as+> B, and confirm each returns `404`.++## 3. Artifacts are attacker-influenced content++An agent can be persuaded to write a file with chosen content and a chosen name. Everything that+serves artifacts MUST treat them as hostile.++- Artifact downloads MUST be served with `X-Content-Type-Options: nosniff`. Without it, an artifact+ named `x.html` becomes stored XSS against the client's own origin+ ([Files §3](files.md)).+- Artifacts SHOULD be served from a different origin than the console or application UI, so that a+ successful injection cannot reach first-party cookies or storage.+- A server MUST NOT allow a `container_id` / `file_id` pair to address anything outside its+ container. Path traversal through artifact ids is the most likely serious vulnerability in a UHP+ implementation; the conformance suite probes for it (X-08), and passing that probe is a floor, not+ proof.+- A server SHOULD cap artifact size and count per session.++## 4. Prompt injection is in scope for the client++A harness that reads a web page, a repository, or an uploaded file may encounter instructions+addressed to it. UHP cannot prevent this, and a specification that pretended otherwise would be+worse than one that says so plainly.++What the protocol does provide, and a client SHOULD use:++- **`disabledTools`** on a configured harness — the smallest tool set that can do the job is the+ smallest injection surface.+- **`max_step` and `timeout_seconds`** — a bounded task cannot be induced into an unbounded one.+- **Separate harnesses for separate trust levels.** A harness that reads untrusted input SHOULD NOT+ be the same configured harness that holds privileged tools or MCP servers.+- **The event stream.** Tool calls are visible as they happen; a client can surface or gate them.++A server MUST NOT claim that any of this makes an agent safe to point at untrusted input.++## 5. Resource exhaustion++- A server MUST bound task duration, and MUST report `incomplete` rather than `completed` when a+ budget stopped the work ([Lifecycle §3](lifecycle.md)).+- A server MUST refuse a second concurrent task in the same session (`session_busy`) — two agents in+ one working directory is not a defined state, and is also a cheap way to multiply cost.+- A server SHOULD rate-limit task creation per principal and SHOULD expose remaining budget through+ `rate_limit_error` responses rather than by failing opaquely.+- A server MUST bound upload size and reject with `file_too_large` rather than truncating. A silently+ truncated input produces a confident, wrong answer.++## 6. Data handling++- Session artifacts and transcripts MUST be unreachable after the session is deleted.+- A server SHOULD document its retention period. "Indefinite" is an answer; silence is not.+- Session sharing, where implemented, MUST be read-only and revocable, and MUST NOT expose+ credentials or another principal's data ([Sessions §5](sessions.md)).++## 7. Transport++- TLS MUST be used except on loopback.+- A server SHOULD send `Strict-Transport-Security`.+- A server serving any HTML MUST send `X-Frame-Options: DENY` or an equivalent+ `frame-ancestors 'none'` policy.++## 8. Error hygiene++- `error.message` MUST be safe to show a user: no credentials, internal hostnames, file paths, or+ stack traces ([Errors §1](errors.md)).+- A server SHOULD log the detail it withholds, with a correlation id it returns in `error.detail`,+ so an operator can diagnose what a caller cannot see.++## 9. Reporting a vulnerability++Vulnerabilities in the reference implementation or in this specification follow private disclosure,+not a public issue. See the repository's security policy. A specification bug that makes a secure+implementation impossible is treated as a vulnerability, not as a documentation defect.