Consider a synthetic example: an agent needs a database credential to run a staging migration. A naive retrieval tool could return the secret directly as a model-facing JSON value:
{
"status": "success",
"password": "SENTINEL_CANARY_DATABASE_PASSWORD_00000000-0000-4000-8000-000000000003"
}
If the harness retains that tool result, the plaintext can enter later model requests or delegated transcripts. Cache and log retention depend on the actual provider and harness configuration; this example does not establish either outcome. Keeping the credential out of model-facing text removes one path an attacker-controlled prompt might exploit.
The design goal is simple: let a local tool use the secret without returning it to the agent's prompt context.
The API returns an encrypted envelope
Source inspection of the standalone llm-vault reveal route (POST /api/v1/secrets/:id/reveal) shows an envelope response. This abbreviated illustration uses synthetic identifiers and placeholder ciphertext:
{
"id": "sec_example_01",
"vaultId": "vlt_example_01",
"version": 1,
"keyVersion": 1,
"encryptedPayload": {
"algorithm": "AES-256-GCM",
"ciphertext": "SYNTHETIC_CIPHERTEXT",
"iv": "SYNTHETIC_IV",
"authTag": "SYNTHETIC_TAG",
"aad": "tenant_example:vlt_example_01:sec_example_01:1:1",
"keyVersion": 1
},
"encryptedVaultKey": { "ciphertext": "SYNTHETIC_WRAPPED_KEY" },
"auditEventId": "evt_example_01"
}
The response has an encryptedPayload and a caller-specific encryptedVaultKey. Payload Additional Authenticated Data uses five colon-separated fields: tenant ID, vault ID, secret ID, secret version, and key version. The envelope branch does not return a raw secret field; this source inspection does not prove what all downstream callers expose.
Confining decryption to the local MCP process
The reviewed llm-vault-mcp flow uses WebCrypto inside the local Model Context Protocol (MCP) process. Decryption means plaintext does exist in that process while the tool uses it.
An agent can call an action-oriented tool such as vault_run_command instead of requesting a plaintext tool result. The local process can make the credential available to a subprocess for a bounded lease and return a sanitized result. Buffer cleanup limits retention but does not prove every copy is erased from process memory.
Output scrubbing covers selected variants
Subprocesses can write credential values to stdout or stderr. The inspected MCP implementation filters selected variants from returned text.
The MCP tool flow filters recognized raw, trimmed, Base64, and URL-encoded secret variants from returned text. This is a safety layer with limits: a transformed or unexpectedly routed value can evade a pattern-based filter.
The companion paper times Python string replacement on synthetic text. That timing is not a measurement of the TypeScript scrubber or the latency of a live tool call.
What the offline canary simulation found
A Python runner constructs five synthetic secret fixtures and compares naive and envelope-path transcripts. It does not invoke the live API, MCP server, subprocess, or model provider.
- Constructed naive transcript: eight literal sentinel appearances and ten raw credential appearances, counted separately.
- Constructed envelope-path transcript: zero appearances of those strings under the runner's assertions.
- Three-turn input tokens: the authored histories average 326.6 tokens for the naive case and 193.8 for the sandbox-shaped case. The unweighted mean of per-fixture reductions is 35.26%; the reduction between those displayed means is 40.66%.
These fixture outcomes describe constructed Python values; they are not a runtime containment measurement. The separate allowRawContextReveal setting affects the MCP getSecret path, not the standalone API reveal route.
Three rules for agent tool builders
- Keep secret values out of model-facing results: Prefer an action tool such as
vault_run_commandwhen the agent needs work done with a credential. - Check each boundary separately: Inspect the API envelope, local decryption path, MCP result, and actual harness transcript.
- Test output filtering: Include the transformations and side channels your subprocesses can produce; a scrubber cannot catch unknown variants.