Webhook Security
URL validation, the tokenvault.uk egress IP for allowlists, bind-seal, OAuth secret rules, the kill switch and a hardening checklist for your webhook.
URL validation
When you bind a webhook, Token Vault rejects URLs that could point it at internal systems (SSRF).
- The scheme must be https.
- The hostname must resolve.
- Every resolved address must be a public one. The check is
is_globalon the address (after unwrapping IPv4-mapped IPv6), which also refuses CGNAT (100.64.0.0/10), 6to4, loopback, link-local, private and reserved space. - The port must be 443 or above 1024.
- The check runs again on every call, not only at bind time. Token Vault never follows a redirect from your webhook at call time. At bind time it follows at most 3 redirect hops.
Egress IP (tokenvault.uk)
Requests from the production control plane (tokenvault.uk) to your webhook leave from one static IP:
34.12.35.243This is the tokenvault.uk egress.
Use the IP as defence in depth. Allow or block it per endpoint. In the reference webhook, set TOKENVAULT_IP to this address (or list it in DENY_IPS) and it is refused on /v1/credential, /v1/store and /v1/totp-code:
| Endpoint | Allow from the Token Vault IP? | Why |
|---|---|---|
/v1/exchange | yes | Token Vault calls it at bind |
/v1/health (POST, HEAD) | yes | Health checks |
/v1/storage | yes | Metadata |
/v1/proxy | yes | MCP tool calls |
/v1/refresh-notify | yes | Refresh notices |
/v1/admin/migrate | yes | TOTP sweep, when you ask for it |
/v1/refresh (legacy) | yes | Legacy refresh only |
/v1/credential | no | Callers reach it from their own IP via the 307 |
/v1/store | no | Browsers and the CLI call it directly |
/v1/totp-code | no | Browsers call it directly |
/v1/oauth/start, /v1/oauth/callback | no | The user's browser calls them |
Defence in depth, not a guarantee
Token Vault holds the HMAC secret that signs tickets, so a network block is an extra layer, not the whole boundary. Whoever holds the HMAC secret can sign tickets your webhook honours, so Token Vault is the authority for every read your webhook serves. Blocking the Token Vault IP on the direct-access endpoints means a compromised control plane could not use them from its own address. Token Vault has no path that returns a credential value, with one exception: the legacy tv-refresh capability, used only for tokens from Token Vault's old built-in OAuth apps. The reference webhook advertises it only when TV_REFRESH_ENABLED=true is set. To turn it off, remove that variable, redeploy, then press Verify Connection so Token Vault re-reads the capabilities. See Token refresh.
Bind-seal
The reference webhook seals itself on its first successful /v1/exchange. Once sealed, the setup endpoints /v1/register-url, /v1/exchange and /bind need an x-tv-admin-secret header equal to the webhook's TV_ADMIN_SECRET. Without it they answer 403.
- If
TV_ADMIN_SECRETis not set, the webhook is sealed for good. Set it and redeploy to re-bind. - Runtime endpoints (
/v1/credential,/v1/store,/v1/totp-code,/v1/proxy,/v1/refresh*,/v1/storage,/v1/health) are not affected. - Token Vault performs one
/v1/exchangeat bind and then uses HMAC. It never sendsx-tv-admin-secret. - Bind-seal is a hardening layer. A webhook that only rejects used codes is conformant.
OAuth client secrets
A client secret goes only to a token URL from your webhook's own config or its built-in table. A token URL named by a ticket, a stored hint or a refresh request is a cross-check, and a mismatch is refused. The tv_oauth_state cookie binds an OAuth connect to the browser that started it.
Stopping access
The everyday kill switch is Stop all access in the app. It stops Token Vault from issuing new tickets and sessions for every agent, key and MCP client, and leaves your webhook untouched. Links already issued, and sessions that your webhook or a gateway has cached, can keep working for up to 60 seconds. Values already fetched stay with the caller until you rotate them. See Stop all access.
Taking your webhook offline is a harder second stop:
Your webhook owns the credentials, so every path fails when it is unreachable. Bring it back and everything resumes.
Checklist
- Verify the HMAC signature on every Token Vault request before you read the body, and reject with
401. - Verify the ticket on every direct-access request: signature,
exp,pur,svc. - Reject timestamps more than 5 minutes old. Deduplicate on the signature, not the request id alone (Token Vault reuses the id on retries). Track ticket nonces if you can.
- Keep the HMAC secret in a secrets manager. On Cloudflare Workers the reference webhook derives it from
TV_WEBHOOK_SEED, a write-only secret. On Docker and Node it is generated into the/datavolume, so back that volume up. - Encrypt credentials at rest. The spec makes it optional and recommends it. The reference webhook uses AES-256-GCM; your webhook, your choice.
- Never expose your encryption key to any external system. Never log credential values, TOTP secrets or codes.
- Use TLS 1.2 or later.
- Return CORS headers only on
/v1/credential,/v1/storeand/v1/totp-code. - Make
/v1/exchangeone-time. - Optionally block the Token Vault IP on the direct-access endpoints, as in the table above.
Verify your webhook
Settings > Webhook > Health runs three security checks as part of Webhook Tests: a forged credential ticket, a real ticket sent from the Token Vault IP, and a forged store ticket. See Health and tests for what each expects.
Ready to try it?
Sign in with Google or email. Your credentials stay on your own webhook, and the quickstart gets Claude Code making its first MCP tool call in about 15 minutes.