Threat model
This page sets out the adversaries CloakAPI is built to defend against, the trust boundaries, the controls, and what CloakAPI does not protect against.
In-scope assumptions
CloakAPI’s controls rely on the following:
| Property | Implementation |
|---|---|
| Transport encryption | The public edge (api.cloakapi.io, app.cloakapi.io, docs.cloakapi.io) accepts TLS 1.2 and 1.3 and refuses TLS 1.0 and 1.1 (measured with a handshake against api.cloakapi.io). Gateway calls to the hosted providers go over HTTPS with certificate verification (see adversary 3); the TLS version on that leg is whatever the provider negotiates, not pinned by CloakAPI. The local proxy listens on plain http://localhost, which stays on your machine. |
| Receipts | Gateway responses can carry a receipt envelope signed with ECDSA P-256. Each stored receipt carries prev_hash, the SHA-256 of the previous envelope, so the chain can be checked. Organizations that opt into transparency publication also have their current tenant seed state in the public seed feed, which is not a receipt log (see Transparency log). |
| Tokenization before egress (client-side) | Supported client paths (browser chat, desktop, browser extension, or local proxy at base_url=http://localhost:8799/v1) attempt to replace values their detector matches before egress. The inference gateway validates a caller declaration and a MAC over the submitted bytes; this binds the bytes to a key, not to a particular binary. It does not verify that a detector ran or that all PII was replaced. A missing or invalid proof is refused; a valid proof is not a content-safety finding. |
| Public receipt JWKS | Signing public keys are published at https://api.cloakapi.io/api/.well-known/cloakapi-receipt-pubkeys.jwks, so anyone can check a receipt signature themselves. |
Adversaries we defend against
Compromised LLM provider
Threat: an attacker gains read access to an LLM provider’s inference infrastructure and sees all prompt traffic in plaintext.
Control: supported client paths (browser chat, desktop, extension, local proxy) attempt to replace detector matches before egress. A provider cannot map a stand-in back to a detected value without the tokenization map, which stays on the client. The gateway does not tokenize the inference body; its proof check authenticates submitted bytes and caller declarations, not detector execution.
Limitation: the protection covers only what the client’s detector matched (see Known limitations), and only if the client tokenizes and reviews the body before sending it. It also weakens if your application de-tokenizes values before sending prompts, or if the system prompt itself contains PII injected by the application layer.
Malicious insider at LLM provider
Threat: an employee with access to LLM serving infrastructure tries to extract customer data from stored prompt logs.
Control: the same client-side replacement as for adversary 1. The gateway relays the request bytes your client submitted, and keeps little from them:
- Application logs are scrubbed of known payload-shaped fields (a safeguard, not a guarantee); usage and audit records are written without prompt or answer fields.
- The request-body derivative the gateway keeps is a SHA-256 digest used for idempotency
matching. For model relay requests with an
Idempotency-Key, it keeps that digest and a completion marker for up to 24 hours. After a successful completion, a retry with the same key and body returns HTTP 409, and the response is not replayed. The response to a retried request is not kept. - Successful responses for some other API operations may be cached for replay for up to 24 hours.
- Response buffering is off by default. If a request sends
X-CloakAPI-Buffer: truewhile buffering is disabled, the gateway returns HTTP 400 before provider dispatch or billing. If an operator explicitly enables buffering, the provider response is stored encrypted for up to the configured retention period (24 hours by default), and a successful fetch removes it. - An optional semantic response cache exists and is off by default.
Limitation: CloakAPI cannot enforce LLM provider data-retention policies. Review each provider’s DPA and turn on prompt-logging opt-out where it is available.
Network MITM between gateway and LLM provider
Threat: an attacker with a position on the network between api.cloakapi.io and the upstream
LLM API intercepts or modifies traffic.
Control: TLS with strict certificate verification in the gateway process. Outbound connections
to OpenAI, Anthropic, Google Gemini, Grok and DeepSeek verify the peer certificate and hostname
against the system trust store (CURLOPT_SSL_VERIFYPEER / VERIFYHOST=2 in the provider HTTP
client; the Anthropic streaming path uses the HTTP client’s default verification).
Certificate and CA pinning are not deployed. The receipt does not detect tampering on this leg:
the gateway signs the response as it received it from the provider, so a response altered in
transit would be signed as received.
Limitation: an attacker who can insert a trusted CA into the gateway’s trust store, or who compromises a public CA, would break this control. That scenario is as severe as a compromise of the gateway infrastructure (see Compromised CloakAPI infrastructure).
Compromised customer endpoint (server-side application)
Threat: a customer’s backend server that uses the CloakAPI SDK is compromised. The attacker tries to exfiltrate data or forge receipts.
Control: API keys can be rotated or revoked on demand; both stop the old key authenticating on the next request (the key lookup is not cached). The account owner can restore a revoked key for 3 days; a rotated-out key cannot be restored. After a compromise, also secure the portal account that owns the key. Gateway receipts are signed with CloakAPI’s gateway key, not the customer’s, so a compromised endpoint cannot forge a valid gateway receipt for a response it fabricated. Receipts signed on a device (for example by the desktop app) use a key on that device, so a compromised device can sign those.
Limitation: a compromised backend has full access to tokenization maps, so it can de-tokenize any intercepted receipts or future prompts. Receipt authenticity still holds; confidentiality depends on the security of your own endpoint.
Adversaries we do not defend against
These threats are out of scope. They are listed so security teams can decide whether CloakAPI is sufficient for their deployment.
Compromised customer browser running the tokenizer
If the customer’s browser is already compromised (malware, XSS with full DOM access, a
malicious browser extension with <all_urls> permission), an attacker can observe PII values
before tokenization. CloakAPI’s in-browser tokenizer runs in that same browser. There is no
feasible application-layer defense once the browser itself is compromised.
The extension begins working only after it is active on a supported chat site. The site’s own JavaScript may send data before then. A provider site may also change its display, so what appears on screen does not confirm what the provider received.
OS-level keyloggers on the customer machine
A keylogger or screen-capture malware on the user’s device observes keystrokes or screen pixels before any application layer processes them. This is outside CloakAPI’s threat boundary.
Compromised CloakAPI infrastructure
If the CloakAPI gateway itself is compromised, including the key management system, the gateway process or the HSM interface, none of its controls can be relied on. CloakAPI is a trusted intermediary. A self-hosted gateway, for customers who cannot accept this trust dependency, is on the roadmap and not available today.
Quantum adversary with harvested ciphertext
ECDSA P-256 signatures and the TLS 1.2 and TLS 1.3 protocols enabled by the configured Nginx HTTPS vhosts are not post-quantum secure. A future adversary that harvests TLS sessions today could decrypt them with a cryptographically relevant quantum computer. Post-quantum migration is on the roadmap but not deployed.
Trust boundaries
A request crosses these points in order:
- Your device (browser, desktop app, extension, local proxy or SDK) replaces the values its detector matches with stand-ins and sends the request.
- The CloakAPI gateway (
api.cloakapi.io) checks the client proof and relays the request bytes as submitted. - The LLM provider (OpenAI, Anthropic, Google Gemini, Grok or DeepSeek) receives what your client sent and returns a response that refers to the stand-ins.
- The gateway returns the response to your application. When a receipt is issued, the
gateway signs the receipt envelope (ECDSA P-256, kid
gw-prod-YYYY-qN) and returns it with the response.
The trust boundary that matters most is between your device and the CloakAPI gateway: personal data must be tokenized on your side of it. The gateway and the providers behind it receive what your client sent: stand-ins for what the engine detected, and any undetected text as written.
Control-to-threat mapping
| Control | Threat mitigated |
|---|---|
| On-device tokenization before egress | Compromised LLM provider; malicious insider at an LLM provider |
| TLS with strict certificate verification (gateway → provider) | Network MITM |
| ECDSA P-256 receipt signatures | Tampering with response content after signing; forged receipts |
SHA-256 receipt chain links (prev_hash) | Changing a receipt’s recorded chain position; a standalone receipt does not prove complete chain history |
| API key rotation (immediate deactivation) | Compromised customer endpoint key |
| Public JWKS at a well-known URL | Lets third parties verify receipts independently |
| No server-side prompt retention | Reduces the blast radius of a gateway infrastructure compromise |
Known limitations
- Tokenization coverage is not exhaustive. The ruleset (
patterns.json1.6.1) defines 142 entity types, includingEMAIL,PHONE,IBAN,CREDIT_CARD,IP_ADDRESS,IP_ADDRESS_V6,DATE_OF_BIRTH,PASSPORT,NAME,ADDRESSandORGANIZATION, with 61 national-ID rules and 14 postcode rules.ORGANIZATIONdefines a label without a pattern. Organization-name detection depends on the client. Sensitive data outside these categories, or not matched, is sent as written. See Detection coverage for known evasions. - Receipts record authenticity, not privacy. A receipt records that a specific response was returned by the gateway for a specific submitted request. It does not prove that the request was free of PII, or that the upstream LLM provider did not log it.
- Transparency publication is opt-in. Only organizations that opt in have their tenant seed state in the public seed feed. The feed is not a receipt log: a receipt’s signature is checked against the JWKS whether or not its organization opted in.
- HSM deployment is conditional. Standard accounts use software-backed key material (PEM files under restrictive permissions in the isolated gateway container). A full HSM deployment (a dedicated hardware security module with an audited key ceremony) is available on enterprise request. See Key rotation policy.
- SLSA provenance is planned. Build provenance is at SLSA L0 today, and SLSA L3 is on the roadmap. See Reproducibility.
- The gateway checks that a request comes from a CloakAPI client, but it cannot verify that the client’s detection ran or that the text was reviewed, and it reads request bytes to verify the body MAC and route the request, but does not scan request text for personal data or verify that detection ran.