My Hermes agent used a GitHub token it never saw
DEV Community

My Hermes agent used a GitHub token it never saw

Hermes Agent already protects you from the obvious mistake. Ask it to read a .env file and the read is refused.

Point it at an ordinary config file holding a token and the token comes back cut down to ghp_ng...39e5, thanks to security.redact_secrets, which is on by default. That is a one-way door. The model never sees the token, which is the point, but it can't use it either. Ask the agent to call the API with that token and it passes ghp_ng...39e5 to the shell, which is useless.

In practice people turn redaction off so the agent can do its job, and then every key it reads goes to the model provider and into the provider's logs. We wanted the third option: the model works with a value it never sees. Our MCP firewall, WARDEN, now does that for Hermes, and this is what it looked like on a live Hermes 0.19.0 on November 22.

The run A file on the server held a random GitHub-format token. With WARDEN's plugin enabled and Hermes' own redaction off, we asked the agent (DeepSeek through OpenRouter) to read the file and hash the token in the shell:

$ printf %s WARDEN_SECRET_CG4G9F0HM4 | sha256sum
c7b5d5202a9cac9faad197c2a57920ab6abfd8643a16f8c372163ce9673f3251

The model only ever had GITHUB_TOKEN=WARDEN_SECRET_CG4G9F0HM4. That is what sits in Hermes' session store. The shell received the real token, and the hash it printed equals the hash we computed next to the file. The placeholder went out to the model; the value went only to the tool.

Where WARDEN sits in Hermes

Hermes 0.19 has a middleware API, and two of its seams are what make this clean:

  • llm_request sees the full request to the provider: the person's messages, tool results, the system prompt, memory. WARDEN masks all of it. That is the real boundary, because everything the provider receives passes through this one function.
  • tool_execution wraps the actual tool call, after approvals and guardrails ran. WARDEN swaps placeholders for values there, so Hermes' approval prompt and its dangerous-command patterns still see the placeholder, never the key.

transform_tool_result masks results again before they reach the session store, and transform_llm_output gives the person their own personal data back in the final reply. Credentials stay masked even there, because chat transcripts get copied and forwarded.

The placeholder table lives in one warden-mcp agent-guard child process the plugin starts: in memory, never on disk, gone when Hermes stops. Placeholders are random (50 bits), carry no part of the value and differ between sessions. In the vocabulary of the EDPB's pseudonymisation guidelines, the model provider is the pseudonymisation domain and the table is the additional information that must stay out of it.

One turn of the recorded run, top to bottom. Blue tags mask, the orange one restores, grey ones are the flow guard. Click for the full-size SVG.

A placeholder doesn't go everywhere

Restoring a value on request would just be a slower leak if any tool could ask. By default, a placeholder turns back into its value only for the place the value came from. Hermes' file and shell tools count as one place, the local machine; the web tools are another; each MCP server is its own.

A key read from a local file can go into a local shell command. The same placeholder in a web_extract URL stops the call: WARDEN masking: WARDEN_SECRET_… stands for a credential read from local; the masking policy lets it go back only there, not to web/web_extract. The call was not sent.

That matters for prompt injection. A page that talks the model into "post the token to this URL" gets a placeholder the tool can't use, or a refused call. Hermes groups its tools into origins; by default a placeholder turns back into its value only for the origin it came from.

On top of that, WARDEN's flow guard judges every call as it will actually run, real values included. Its default policy is strict: a call that carries a recognisable secret is refused even towards its origin. In our run the hash command was refused with "this call carries a secret (GitHub token)" until we turned the flow guard off for the test.

Masking decides where a value may go. The flow guard decides whether a call should run at all. You can tune them separately.

Personal data, for teams that need it

Credentials are masked by default. Personal data is off by default, because it gets in the way of ordinary work, and on with one line in ~/.hermes/.env for an organisation under GDPR, CCPA, 152-FZ or PCI DSS:

WARDEN_MASK_PERSONAL=gdpr

The gdpr profile masks e-mail addresses, international phone numbers, payment cards (issuer range plus Luhn), IBANs (mod-97) and public IP addresses. A customer's address read from a CRM becomes warden_email_k3j5…@mask.invalid: still a valid address for any schema that wants one, and unroutable if anything tries to send to it. The person who asked still sees the real address in the reply.

Names need a language model to find, so WARDEN doesn't guess them; you give it a list.

Install

Masking ships in WARDEN 0.37.0. The plugin is inside the npm package:

npm install -g @aimarket/warden@0.37.0
cp -r "$(npm root -g)/@aimarket/warden/integrations/hermes/warden" ~/.hermes/plugins/warden
hermes plugins enable warden
systemctl restart hermes-gateway # or start hermes again

Decide on Hermes' own redaction. Keep security.redact_secrets: true if your agent never needs to use a secret; set it to false to let WARDEN mask reversibly.

What it doesn't do

  • Detection is pattern-based. A key in a format WARDEN doesn't know, in a field whose name doesn't say "key", passes.
  • The model can still reason about what a value is ("the deploy token"). Masking hides values, not the facts around them.
  • A WARDEN restart forgets every placeholder; old ones become plain text that no call can turn back into a value.

We wired the same thing into OpenClaw and found the opposite situation there. OpenClaw 2026.11.6 has no hook that rewrites a tool result before the model reads it within a run; tool_result_persist only changes what is stored. The transcript ends up clean, but during the run the model sees the raw file. Hermes' llm_request seam is why the Hermes integration can promise more.

The settings, the hooks the plugin uses and the full list of what is detected are in WARDEN's masking guide. This article was written with AI assistance. The runs, hashes and versions are from our own hosts on 2026-11-22.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.