Back

Redact secrets from LLM prompts: inside Pookie’s design


Redact secrets from LLM prompts: inside Pookie’s design

A redaction proxy promises something simple: the model provider never sees your secrets, and you never notice the proxy is there. Keeping that promise takes more than a list of regular expressions. This article looks at how Pookie, an internal OVHcloud tool, is designed to redact secrets from LLM prompts safely: how it builds placeholders, isolates each user’s data, handles streaming answers, and fails when something goes wrong. If you’re new to the idea, start with how a redaction proxy works.

How placeholders are built

Keyed, typed placeholders

Every placeholder is derived from the original value with a keyed HMAC, a cryptographic function that turns a value and a secret key into a fixed-length fingerprint. Without the key, the fingerprint reveals nothing about the value and can’t be reversed. With the key, the same value always produces the same fingerprint. That determinism is what lets the model reason: server A stays server A across a whole conversation.

The same IP address always gets the same placeholder, a different server gets another

A placeholder looks like __PK_PRIVIP_fe44bc609bf6__. PK stands for Pookie, PRIVIP tells the model the hidden value is a private IP address, and the final string identifies the stored original. The placeholder itself contains no data. It’s only a reference to a value held in Pookie’s cache, so a third-party provider that stores, logs, or analyses it gets nothing it can use. There’s no value to decrypt, only a key to a store it can’t reach. Because the placeholder is computed from the key and the value alone, redaction needs no store lookup on the way out, and the proxy simply records each mapping for the return trip.

Anatomy of a placeholder used to redact secrets from LLM prompts, with no data inside

Pookie uses a single master key, read from a key file mounted by the platform. It splits that key into separate subkeys for placeholders, encryption, and namespaces, so no single subkey serves two purposes.

Detection that favours recall

Detection runs in two layers. Pattern matching catches values with a known shape: IP addresses, hostnames in configured zones, tokens, keys, IBANs, card numbers, and customer account IDs. An entropy check then catches strings that look random, which is how a generated password with no recognisable format still gets hidden. Encoded content is decoded and scanned again.

Detection never phones a provider to check whether a secret is live. It’s also tuned for recall rather than precision: Pookie would rather replace a harmless value than miss a real one. Many secret scanners make the opposite choice, because a false alarm in a code review costs time. In a proxy, a false positive costs a little context, while a false negative leaks a secret.

Per-user isolation in the store

Restoring values means storing them. In the shared deployment, each user’s mappings live in a namespace derived from their own provider credential with an HMAC. One user’s placeholder can’t be resolved in another user’s session, even if both sent the same value.

This blocks a subtle attack. Without namespaces, a malicious provider could echo user A’s placeholder into user B’s response, and a shared store would resolve it into A’s secret inside B’s session. With namespaces, a lookup outside your own space is a plain miss, never a wider search.

A placeholder replayed in another user’s session misses in that user’s namespace

Values are encrypted at rest with XChaCha20-Poly1305 and a random nonce. The namespaced key is bound to each ciphertext as additional authenticated data, so a value copied to another key fails authentication, even against an attacker who can write to Redis. The store behaves as a cache, with a 72-hour default lifetime refreshed on write, and runs behind TLS, authentication, and network isolation. The 72-hour default is meant to cover a weekend, so you can pick a task up on Monday where you left it on Friday.

The design favours isolation over tenancy: no accounts, no role-based access control, and no new identity system to attack. If the service is misconfigured, it refuses to start.

Fail closed out, fail visible in

On the way out, any error blocks the request. If the store is unreachable or detection fails, nothing reaches the provider. In the worst case, your AI tool stops working and your data stays home.

Outbound redaction and inbound restoration pipeline of the proxy

The way back works differently. Answers stream event by event, and a placeholder can be split across two chunks. Pookie holds back just enough of the stream to never half-replace one. Values restored inside tool-call arguments are JSON-escaped so the agent receives valid input. A placeholder that can’t be restored stays visible and raises an alert rather than breaking the answer.

Hiding encrypted material matters as well. An attacker can store ciphertext today and wait until it becomes possible to decrypt it, a strategy known as “harvest now, decrypt later.” If the ciphertext never leaves, there’s nothing to harvest.

None of this slows the model down noticeably. Restoring values adds under 200 microseconds per streamed event at the 99th percentile. Redacting a very large request peaks at about two seconds, small next to a model answer that takes several seconds.

Known limits, written down

Pookie’s limits are documented as deliberate non-guarantees, not left for an auditor to discover:

  • A passphrase made of ordinary words can pass, because it doesn’t look like a secret.
  • Encrypted data with no recognisable marker isn’t replaced, since Pookie never decrypts to check.
  • Rare encodings, like double base64 or compressed data, can hide a secret from the scan.
  • Determinism has a cost: the provider can’t see values, but it can see which fields repeat.
  • Port numbers are never replaced.
  • An agent can still leak a value after Pookie has restored it.
  • Pookie trusts the agent and its configuration. It isn’t a sandbox against a hostile one.
  • If the store is lost, old placeholders saved in your files can’t be restored.

Named entity recognition could catch postal addresses and personal names, which patterns can’t. I tested it, and processing time per request jumped from about 200 milliseconds to 30 seconds. For now, the cost outweighs the gain, and I’m exploring lighter models that could change the balance.

Redact secrets before they reach an LLM

The same engine runs in four modes: a command-line tool to preview redactions, a standalone binary with an in-memory store, a Docker Compose stack with dashboards, and a Helm chart on Kubernetes with Redis for the shared, multi-user instance. A test pins a fixed key and checks that the proxy and the command-line tool produce byte-identical output, so the trust story can’t diverge between modes. I built the first working version in two weeks with AI agents, as told in this companion article.

If you redact secrets from LLM prompts in your own stack, start with the boring part: keep secrets out of code in the first place. The guide to managing Kubernetes secrets with OVHcloud Secret Manager shows one way to do it. And when the data mustn’t leave Europe at all, you can run the model on AI Endpoints, which hosts open-weight models in the European Union behind an OpenAI-compatible API.


Share on: