Security

Security and threat model

Tokenhush is a security tool, so it has to be secure first. This page states what the gateway protects, what stays outside its scope, and how the local audit trail works. The honest claim is high-confidence interception plus full auditability, not an absolute protection guarantee.

What Tokenhush protects

The gateway sits between an AI coding tool and the model provider. Requests that pass through it are the requests it can work on; coverage is exactly as wide as that local path.

Prompt injection turned into exfiltration
Back-fill runs in one direction only: responses returned to the client. A placeholder that shows up in an outbound body stays a placeholder, so the original value is not forwarded.
A local process or web page reaches the gateway
The service binds loopback only (127.0.0.1 + [::1]). A Host allowlist is always enforced, the control API requires a per-run bearer token stored with 0600 permissions, and requests carrying an Origin get a same-origin check.
DNS rebinding
Host and Origin header validation stops a malicious domain that resolves to 127.0.0.1 from impersonating a trusted origin.
Placeholder collision
Placeholders come from an HMAC-deterministic mapping with a high-entropy suffix, so two secrets do not share one placeholder and a wrong back-fill cannot be triggered by a collision.
Audit log tampering
Records are append-only, and each record's hash includes the previous record's hash (HMAC chain, key in the OS keyring), so after-the-fact edits are detectable.
Plaintext written to disk
Request and response content is not stored by default. The audit trail records metadata only unless you explicitly opt in to content logging.

What Tokenhush does not protect

The public core covers tools that accept a custom base URL or endpoint. Everything outside that path is explicitly out of scope, and the list below is part of the security posture rather than fine print.

Hard invariants

Five rules define the security model. The public core locks them with named tests, and this page restates them for readers who are evaluating the tool.

Outbound requests are never back-filled with original values.

Prompt injection can try to make a tool echo a stored value into a new request. Because back-fill runs only on the response path to the client, the placeholder stays a placeholder on the way out.

  1. Back-fill is inbound only. Placeholders are replaced only on responses returned to the client, never on outbound requests.
  2. No plaintext stored by default. Audit records are metadata-only unless content logging is explicitly enabled.
  3. No root certificate, no MITM by default. System-level interception is an explicit opt-in and is not implemented in the public core.
  4. Loopback only. The local service binds 127.0.0.1 and [::1], with the guardrails described above.
  5. Fail-safe, not fail-open. When the gateway cannot tell whether content is sensitive, it prefers over-redaction or allows with a warning; it does not silently emit unredacted plaintext. The policy is configurable.

The local audit trail

Audit is designed to answer "what passed through the gateway" without becoming a second copy of your data. Records stay on your machine and contain metadata only by default.

Storage
Append-only SQLite in the local data directory.
Contents
Provider, endpoint, time, byte counts, redaction counts, and sensitive types. No request or response content by default.
Integrity
Each record's hash includes the previous record's hash (HMAC chain); the key is stored in the OS keyring.
Retention
14 days by default, configurable in a suggested range of 7 to 30 days.
Honest boundary
A local HMAC chain detects after-the-fact edits. It is not third-party-verifiable compliance proof.
Audit hash chainAppend-only audit records. Each record stores a hash computed over the previous record's hash plus its own metadata, so editing or removing an earlier record breaks the chain and is detectable.Record 1hash H1Record 2H2 = HMAC(H1 + metadata)Record 3H3 = HMAC(H2 + metadata)H1H2
Append-only records linked by an HMAC chain: each entry carries the previous entry's hash forward, so a later edit breaks the chain and becomes detectable.

Key handling

Where detection is honest

Detection is deterministic and high-precision-first: known key prefixes, high-entropy strings, JSON Web Tokens, private-key headers, Luhn-checked card numbers, and email addresses, backed by an allowlist and one-click release. No model calls, no semantic guessing.

The project does not make absolute claims. The approved claim is high-confidence secret interception plus full auditability.

Telemetry and site analytics

Two separate systems, stated separately.

The product

The gateway runs on your machine, and the product sends no telemetry by default. Redaction happens locally, and the audit trail stays local as well.

This website

This site uses privacy-friendly, cookieless analytics: aggregate page views only, no cookies, and no cross-site tracking. The privacy page has the details.

Responsible disclosure

Do not open a public issue for a vulnerability.

Report it through GitHub private security advisories. Details are published only after a fix has been released.

Open a private security advisory

Public sources

Every statement on this page is drawn from the open-source core: