# honeytokens

> Anthropic's reference server that blocks Claude requests containing your planted fake secrets

- Category: Evaluation & Production Ops / Guardrails & Security
- Language: Rust
- Licence: Apache-2.0
- Repository: https://github.com/anthropics/honeytokens
- Canonical page: https://ai-tldr.dev/tools/anthropic-honeytokens/
- Updated: 2026-12-03

## In short

honeytokens is a reference honeytoken server for Claude's Inference hooks API, published by Anthropic. A honeytoken is a random string you plant where an agent should never look: an unshared folder, a Kubernetes secret, a restricted hostname or an internal service. It sits in the Guardrails & Security category of the Evaluation & Production Ops tools and is open-source, written in Rust and licensed Apache-2.0.

## Overview

honeytokens is a reference honeytoken server for Claude's Inference hooks API, published by Anthropic. A honeytoken is a random string you plant where an agent should never look: an unshared folder, a Kubernetes secret, a restricted hostname or an internal service. Before Claude sees a governed request, Anthropic sends the transcript to this server. If it contains any string from your token list, the server replies `deny` and the request is blocked; otherwise it replies `allow`. Because the check runs on what the model is about to read, the agent is stopped the moment it reads a token, not only when it tries to use it.

Anthropic's Frontier Red Team released it with a December 2026 research post that replayed the idea against its Siren sandbox-escape evaluation: of 1,294 escapes across 1,753 sessions, honeytokens would have stopped 1,209 (93%), with no false positives in sessions where the model stayed inside. The server itself is about 400 lines of Rust with five dependencies and no async runtime, checks the signature on every request, and is released under the Apache-2.0 license. Anthropic marks it as a reference implementation that is not maintained and does not accept contributions.

## What it does

- Exact, case-sensitive matching of a list of planted tokens against each governed Claude transcript, answering `allow` or `deny`
- Mandatory webhook signature check with the `whsec_...` secret from the Inference hooks settings, including two secrets at once for rotation
- Configurable concurrency (`HONEYTOKENS_THREADS`, default 16) with request bodies up to 64 MiB
- `--no-echo-token` to hide the matched token from the user-visible deny reason
- Logs one line per connection and never logs token values or transcript contents

## Getting started

honeytokens needs Rust 1.75 or newer and a Claude organization with Inference hooks turned on. Anthropic only calls public `https://` URLs on port 443, so the server runs behind a TLS proxy.

1. Create a tokens file

   One token per line, 8 to 256 printable ASCII characters, no spaces. Blank lines and lines starting with `#` are ignored. Use long random strings and plant the same strings where agents should never look.

```bash
openssl rand -hex 16 >> tokens.txt
```

2. Build and run the server

   `HONEYTOKENS_SECRET` is the signing secret shown when you save the endpoint in the Inference hooks settings. The default listen address is `127.0.0.1:8000`; pass another as a second argument. Run the tests with `cargo test`.

```bash
cargo build --release
HONEYTOKENS_SECRET='whsec_...' ./target/release/honeytokens tokens.txt
```

3. Put TLS in front and allow only Anthropic

   The server speaks plain HTTP. The README's Caddy example terminates TLS and rejects every caller outside Anthropic's range `160.79.106.0/24`; the signature check stays on regardless.

```text
hooks.example.com {
    @others not remote_ip 160.79.106.0/24
    respond @others 403
    reverse_proxy 127.0.0.1:8000
}
```

4. Turn it on in Claude

   In Organization settings → Data and privacy → Inference hooks, allow hooks for your organization, save the endpoint URL, press "Test connection" to see an allow verdict, then turn on "Enforce verdicts".

## When to use it

- Plant fake credentials in Kubernetes secrets, unshared directories or config files so an agent that reaches beyond its scope is blocked as soon as it reads them
- Add a cheap tripwire on top of a coding-agent sandbox that may be weaker than it looks
- Use it as a starting point for an in-house Inference hooks server with your own allow/deny rules

## Version history

- 2026-12-03: Anthropic's Frontier Red Team published the honeytokens research and released this reference server; replayed against its Siren evaluation, honeytokens would have stopped 93% of sandbox escapes.
