Token VaultDocs
ReferenceWebhook Protocol

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).

  1. The scheme must be https.
  2. The hostname must resolve.
  3. Every resolved address must be a public one. The check is is_global on the address (after unwrapping IPv4-mapped IPv6), which also refuses CGNAT (100.64.0.0/10), 6to4, loopback, link-local, private and reserved space.
  4. The port must be 443 or above 1024.
  5. 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.243

This 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:

EndpointAllow from the Token Vault IP?Why
/v1/exchangeyesToken Vault calls it at bind
/v1/health (POST, HEAD)yesHealth checks
/v1/storageyesMetadata
/v1/proxyyesMCP tool calls
/v1/refresh-notifyyesRefresh notices
/v1/admin/migrateyesTOTP sweep, when you ask for it
/v1/refresh (legacy)yesLegacy refresh only
/v1/credentialnoCallers reach it from their own IP via the 307
/v1/storenoBrowsers and the CLI call it directly
/v1/totp-codenoBrowsers call it directly
/v1/oauth/start, /v1/oauth/callbacknoThe 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_SECRET is 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/exchange at bind and then uses HMAC. It never sends x-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:

Loading diagram...

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 /data volume, 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/store and /v1/totp-code.
  • Make /v1/exchange one-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.

On this page