Verify Web Bot Auth signatures from AI agents
To verify a Web Bot Auth request, fetch the agent vendor's Ed25519 keys from its key directory, rebuild the RFC 9421 signature base from the components named in Signature-Input, and check the signature with the key its keyid names.
Status: Live. Web Bot Auth is the name for AI agents signing their HTTP requests
with RFC 9421 HTTP message signatures and publishing the public keys at a well-known URL. A valid signature is the
strongest proof of identity CrawlClick accepts: it reaches the top signature tier on
Verification tiers. This page describes exactly what CrawlClick’s verifier checks, read from the
botauth.rs, keydir.rs and headers.rs files of the API’s crawler-id crate, and gives Node and Python code
that applies the same rules, so your own check and CrawlClick’s agree on every request.
Which headers does a signed agent request carry?
A signed request carries three headers. CrawlClick treats a request as signed only when both Signature and
Signature-Input are present.
GET /compare HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/140 Safari/537.36
Signature-Agent: "https://chatgpt.com"
Signature-Input: sig1=("@method" "@authority" "@path" "signature-agent");created=1799999990;expires=1800000290;keyid="Qp34WT-6Td7XN7qxbcifgl-glK5-7y2MJkJMzD0cuGo";alg="ed25519";tag="web-bot-auth"
Signature: sig1=:<64-byte Ed25519 signature, base64>:
Signature-Inputnames the label (sig1), the covered components in order, and the parameters:created,expires,keyid,alg, and optionallynonceandtag.Signaturecarries the signature bytes for the same label, base64 between colons.Signature-Agentnames the agent’s operator. Two spellings exist: the plain quoted URL OpenAI sends ("https://chatgpt.com") and the labelled dictionary form of the current draft that Google sends (g="https://agent.bot.goog"). CrawlClick reads the first member of either and strips the quotes.
Which AI agents sign their requests?
6 agents in the registry sign requests and name a key directory or a Signature-Agent value.
An agent with no Signature-Agent value in the registry is still identified by its user agent; the signature then
proves that identity. An agent whose user agent is an ordinary browser string, such as ChatGPT’s agent, can only
be identified by its Signature-Agent header, and only when the request is signed.
What is in a key directory, and how are key ids derived?
A key directory is a JWK set served at /.well-known/http-message-signatures-directory on the agent’s domain:
{"keys": [...]}. CrawlClick’s fetch job reads every directory the registry names and keeps, for each JWK:
- only keys with
ktyofOKPandcrvofEd25519. Other key types are skipped; - only an
xvalue that decodes from base64url to exactly 32 bytes; - the key under its RFC 7638 thumbprint, which is the
keyidthe Web Bot Auth draft uses: SHA-256 over the exact string{"crv":"Ed25519","kty":"OKP","x":"<x>"}, base64url without padding; - the key also under its explicit
kid, when the JWK has one that differs from the thumbprint.
A directory with no usable key is an error, and the previously cached keys are kept. Each key is bound to the vendor of the registry entry that named the directory, and can vouch for that vendor’s agents and no others. The directory response may itself be signed; CrawlClick does not check that signature. HTTPS from the vendor’s documented host is the trust anchor, as it is for published IP ranges. The production proxy reloads the cached keys on the same hourly tick as the ranges.
How is the RFC 9421 signature base built?
The signature base is the exact byte string the agent signed. CrawlClick builds it from the first member of
Signature-Input, one line per covered component in the order declared, then the @signature-params line. Lines
are joined with a single line feed and there is no trailing newline.
| Component | Value used |
|---|---|
@method |
The request method, upper-cased. |
@authority |
The Host header, lower-cased. Behind a proxy, use the host the client addressed. |
@path |
The request path without the query string. |
any other @ component |
Not supported: @query, @target-uri, @scheme and the rest fail verification. |
a header name, such as signature-agent |
That header’s value with surrounding whitespace trimmed. A missing header fails verification. |
@signature-params |
The text of the first Signature-Input member after the label and =, exactly as sent: the parenthesised list and every parameter. |
Component names are lower-cased and their quotes removed. For the request above, the base is:
"@method": GET
"@authority": example.com
"@path": /compare
"signature-agent": "https://chatgpt.com"
"@signature-params": ("@method" "@authority" "@path" "signature-agent");created=1799999990;expires=1800000290;keyid="Qp34WT-6Td7XN7qxbcifgl-glK5-7y2MJkJMzD0cuGo";alg="ed25519";tag="web-bot-auth"
Because the parameters line is signed, an attacker cannot stretch expires on a captured signature: the edited
Signature-Input no longer matches what was signed.
What exactly does CrawlClick check, and in what order?
- Parse the first member of
Signature-Input. If it does not parse, the signature fails. - Take the
keyidparameter. If the first member has none, use akeyidfound anywhere in the header. No key id at all fails. - Look the key id up. A key id CrawlClick does not hold is no evidence either way: the vendor may have
rotated keys since the last fetch. The request is not refuted; it simply does not reach the
signaturetier. - If
algis present, it must beed25519. It may be absent. - The covered components must include
@method,@authorityand@path. A signature over less does not pin the request it authorises. - Both
createdandexpiresare required.expiresmust be aftercreated, the window may not exceed 3,600 seconds,createdmay be at most 60 seconds in the future, and the current time may be at most 60 seconds pastexpires. - Find the
Signaturemember with the same label, strip the colons and base64-decode it. It must be 64 bytes. - Build the signature base. An unsupported or missing component fails.
- Verify the Ed25519 signature over the base.
- The key must be registered to the same vendor as the agent the request claims to be. A valid signature by another vendor’s key is refuted.
Every failure from step 4 onwards, and a malformed Signature-Input or missing key id, counts as an
authoritative refutation and marks the request as a suspected spoof. Even a verified signature is overruled when
the agent’s published IP ranges are held and the source address is outside them.
How do I verify a Web Bot Auth signature in Node?
This module uses only node:crypto. It imports each directory key as a JWK with createPublicKey, and verifies
with crypto.verify(null, …), which is how Node runs Ed25519. It needs Node 22 or later.
// webbotauth.mjs — Node 22 or later, no dependencies.
// Verifies a Web Bot Auth (RFC 9421) request signature with the same rules as CrawlClick's verifier.
import { createHash, createPublicKey, verify } from 'node:crypto';
const MAX_SKEW_SECS = 60; // allowed clock difference between the signer and you
const MAX_VALIDITY_SECS = 3600; // longest expires - created window accepted
const REQUIRED = ['@method', '@authority', '@path'];
const B64URL = /^[A-Za-z0-9_\-+/]*$/;
// RFC 7638 JWK thumbprint of an Ed25519 key: the keyid the Web Bot Auth draft uses.
export function thumbprint(x) {
return createHash('sha256').update(`{"crv":"Ed25519","kty":"OKP","x":"${x}"}`).digest('base64url');
}
// Fetch one key directory and add its Ed25519 keys to `keys` (kid -> { key, vendor }).
// `vendor` is the registry vendor of the entry that names the directory: the only vendor
// these keys may vouch for.
export async function loadDirectory(url, vendor, keys = new Map()) {
const res = await fetch(url, { signal: AbortSignal.timeout(10_000) });
if (!res.ok) throw new Error(`${url}: HTTP ${res.status}`);
const doc = await res.json();
let added = 0;
for (const jwk of doc.keys ?? []) {
if (jwk.kty !== 'OKP' || jwk.crv !== 'Ed25519' || typeof jwk.x !== 'string') continue;
const x = jwk.x.trim().replace(/=+$/, '');
if (!B64URL.test(x) || Buffer.from(x, 'base64url').length !== 32) continue;
const entry = { vendor, key: createPublicKey({ key: { kty: 'OKP', crv: 'Ed25519', x }, format: 'jwk' }) };
if (typeof jwk.kid === 'string' && jwk.kid) keys.set(jwk.kid, entry);
keys.set(thumbprint(x), entry);
added += 1;
}
if (added === 0) throw new Error(`${url}: no Ed25519 keys`);
return keys;
}
const unquote = (s) => s.replace(/^"+|"+$/g, '');
const seconds = (s) => (/^\+?\d+$/.test(s) ? Number(s) : undefined);
// The first member of Signature-Input: label, covered components, and its parameters.
export function parseSignatureInput(header) {
const eq = header.indexOf('=');
if (eq < 0) return null;
const label = header.slice(0, eq).trim();
const value = header.slice(eq + 1).trim();
const close = value.indexOf(')');
if (close < 1 || !value.startsWith('(')) return null;
const comma = value.indexOf(',', close);
// The @signature-params value is this text exactly as the signer sent it.
const paramsValue = value.slice(0, comma < 0 ? value.length : comma).trim();
const components = value
.slice(1, close)
.split(/\s+/)
.filter(Boolean)
.map((c) => unquote(c).toLowerCase());
const input = { label, components, paramsValue };
for (const param of paramsValue.slice(close + 1).split(';')) {
const at = param.indexOf('=');
if (at < 0) continue;
const name = param.slice(0, at).trim();
const raw = unquote(param.slice(at + 1).trim());
if (name === 'keyid') input.keyid = raw;
else if (name === 'alg') input.alg = raw.toLowerCase();
else if (name === 'created') input.created = seconds(raw);
else if (name === 'expires') input.expires = seconds(raw);
}
return input;
}
// The RFC 9421 signature base, or null when a component is unsupported or missing.
// `req` is { method, path, headers } with lower-case header names; `path` has no query string.
export function signatureBase(req, input) {
const lines = [];
for (const c of input.components) {
let value;
if (c === '@method') value = (req.method ?? 'GET').toUpperCase();
else if (c === '@authority') {
if (typeof req.headers.host !== 'string') return null;
value = req.headers.host.toLowerCase();
} else if (c === '@path') value = req.path ?? '/';
else if (c.startsWith('@')) return null; // @query, @target-uri and the rest are not supported
else {
if (typeof req.headers[c] !== 'string') return null;
value = req.headers[c].trim();
}
lines.push(`"${c}": ${value}`);
}
lines.push(`"@signature-params": ${input.paramsValue}`);
return lines.join('\n');
}
// The Signature member whose label matches Signature-Input's, as raw bytes.
function signatureBytes(header, label) {
for (const member of header.split(',')) {
const eq = member.indexOf('=');
if (eq < 0 || member.slice(0, eq).trim() !== label) continue;
const value = member.slice(eq + 1).trim();
if (value.length < 2 || !value.startsWith(':') || !value.endsWith(':')) return null;
const b64 = value.slice(1, -1).replace(/[=\s]/g, '');
return /^[A-Za-z0-9+/]*$/.test(b64) ? Buffer.from(b64, 'base64') : null;
}
return null;
}
// A keyid anywhere in the header, for a first member that names none.
function anyKeyid(header) {
const m = header.match(/keyid="*([^";,]+)/);
return m ? m[1] : undefined;
}
/**
* Returns { outcome, keyid, reason }, where outcome is:
* 'verified' — a fresh, valid signature by a key registered to `vendor`
* 'refuted' — a failure involving a key you hold, or a malformed signature: treat as a spoof
* 'no-evidence' — signed by a key you do not hold (rotated, or never published): neither proof nor disproof
*/
export function verifySignedRequest(req, keys, vendor, now = Math.floor(Date.now() / 1000)) {
const refuted = (reason, keyid) => ({ outcome: 'refuted', keyid, reason });
const sigInput = req.headers['signature-input'];
const sigHeader = req.headers['signature'];
if (typeof sigInput !== 'string' || typeof sigHeader !== 'string') {
return { outcome: 'no-evidence', reason: 'request is not signed' };
}
const input = parseSignatureInput(sigInput);
if (!input) return refuted('unparseable Signature-Input');
const keyid = input.keyid ?? anyKeyid(sigInput);
if (!keyid) return refuted('no keyid');
const held = keys.get(keyid);
if (!held) return { outcome: 'no-evidence', keyid, reason: 'key not held' };
if (input.alg !== undefined && input.alg !== 'ed25519') return refuted(`alg ${input.alg}`, keyid);
for (const c of REQUIRED) if (!input.components.includes(c)) return refuted(`${c} not covered`, keyid);
const { created, expires } = input;
if (created === undefined || expires === undefined) return refuted('created and expires are required', keyid);
if (expires <= created || expires - created > MAX_VALIDITY_SECS) return refuted('validity window', keyid);
if (created > now + MAX_SKEW_SECS || now > expires + MAX_SKEW_SECS) return refuted('outside validity window', keyid);
const sig = signatureBytes(sigHeader, input.label);
if (!sig || sig.length !== 64) return refuted('no usable signature for this label', keyid);
const base = signatureBase(req, input);
if (base === null) return refuted('a covered component is unsupported or absent', keyid);
if (!verify(null, Buffer.from(base, 'utf8'), held.key, sig)) return refuted('bad signature', keyid);
if (held.vendor !== vendor) return refuted(`key is registered to ${held.vendor}`, keyid);
return { outcome: 'verified', keyid, reason: 'signature verified' };
}
Then identify the claimed agent from /crawlers.json and verify. This server answers every request with the verdict, which is a quick way to test your own signer against these rules:
// server.mjs — reports which agent a request claims to be and whether its signature verifies.
import { createServer } from 'node:http';
import { loadDirectory, verifySignedRequest } from './webbotauth.mjs';
const registry = await (await fetch('https://docs.crawlclick.com/crawlers.json')).json();
const keys = new Map();
for (const agent of registry.agents) {
if (!agent.key_directory) continue;
try {
await loadDirectory(agent.key_directory, agent.vendor, keys);
} catch (err) {
console.error(`keys: ${err.message}`); // keep serving; that vendor's signatures are "no-evidence"
}
}
// The Signature-Agent URL: `"https://chatgpt.com"` or the labelled form `g="https://agent.bot.goog"`.
function signatureAgent(header) {
const first = (header ?? '').split(',')[0].trim();
const eq = first.indexOf('=');
let value = eq >= 0 && !/[":]/.test(first.slice(0, eq)) ? first.slice(eq + 1).trim() : first;
if (value.length >= 2 && value.startsWith('"') && value.endsWith('"')) value = value.slice(1, -1);
return value.trim().replace(/\/+$/, '').toLowerCase();
}
// The user agent first, in registry order; Signature-Agent only if the user agent names no agent
// and the request carries both signature headers.
function claimedAgent(headers) {
const ua = (headers['user-agent'] ?? '').toLowerCase();
const byUa = registry.agents.find((a) => a.ua_match.some((token) => ua.includes(token)));
if (byUa || !headers.signature || !headers['signature-input']) return byUa;
const named = signatureAgent(headers['signature-agent']);
return registry.agents.find((a) => a.signature_agent && a.signature_agent.toLowerCase() === named);
}
createServer((req, res) => {
const agent = claimedAgent(req.headers);
const path = (req.url ?? '/').split('?')[0]; // @path never includes the query string
const verdict = agent
? verifySignedRequest({ method: req.method, path, headers: req.headers }, keys, agent.vendor)
: { outcome: 'no-evidence', reason: 'no registry agent claimed' };
res.setHeader('content-type', 'application/json');
res.end(JSON.stringify({ agent: agent ? agent.id : null, ...verdict }) + '\n');
}).listen(8080);
@authority comes from the Host header. If your server sits behind a proxy that rewrites Host, rebuild the
request with the hostname the client addressed before you verify, or every signature fails.
How do I verify a Web Bot Auth signature in Python?
The same rules with the cryptography package (pip install cryptography). Ed25519PublicKey.from_public_bytes
takes the 32 raw bytes decoded from the JWK’s x.
"""Verify a Web Bot Auth (RFC 9421) request signature with CrawlClick's rules.
Python 3.10+, `pip install cryptography`.
"""
import base64
import hashlib
import json
import re
import time
import urllib.request
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
MAX_SKEW_SECS = 60
MAX_VALIDITY_SECS = 3600
REQUIRED = ("@method", "@authority", "@path")
B64URL = re.compile(r"^[A-Za-z0-9_\-+/]*$")
B64 = re.compile(r"^[A-Za-z0-9+/]*$")
SECONDS = re.compile(r"^\+?[0-9]+$")
def b64url_decode(text):
text = text.replace("+", "-").replace("/", "_")
return base64.urlsafe_b64decode(text + "=" * (-len(text) % 4))
def thumbprint(x):
"""RFC 7638 thumbprint of an Ed25519 JWK: the keyid Web Bot Auth uses."""
canonical = '{"crv":"Ed25519","kty":"OKP","x":"%s"}' % x
digest = hashlib.sha256(canonical.encode()).digest()
return base64.urlsafe_b64encode(digest).rstrip(b"=").decode()
def load_directory(url, vendor, keys=None):
"""Add a directory's Ed25519 keys to `keys` (kid -> (public key, vendor))."""
keys = {} if keys is None else keys
request = urllib.request.Request(url, headers={"User-Agent": "key-directory-loader/1.0"})
with urllib.request.urlopen(request, timeout=10) as response:
doc = json.load(response)
added = 0
for jwk in doc.get("keys", []):
if jwk.get("kty") != "OKP" or jwk.get("crv") != "Ed25519" or not isinstance(jwk.get("x"), str):
continue
x = jwk["x"].strip().rstrip("=")
if not B64URL.match(x):
continue
raw = b64url_decode(x)
if len(raw) != 32:
continue
entry = (Ed25519PublicKey.from_public_bytes(raw), vendor)
if isinstance(jwk.get("kid"), str) and jwk["kid"]:
keys[jwk["kid"]] = entry
keys[thumbprint(x)] = entry
added += 1
if not added:
raise ValueError(url + ": no Ed25519 keys")
return keys
def parse_signature_input(header):
"""The first member of Signature-Input, or None."""
label, sep, value = header.partition("=")
if not sep:
return None
label, value = label.strip(), value.strip()
close = value.find(")")
if close < 1 or not value.startswith("("):
return None
comma = value.find(",", close)
params_value = value[: comma if comma >= 0 else len(value)].strip()
components = [c.strip('"').lower() for c in value[1:close].split()]
found = {"label": label, "components": components, "params_value": params_value}
for param in params_value[close + 1 :].split(";"):
name, sep, raw = param.partition("=")
if not sep:
continue
name, raw = name.strip(), raw.strip().strip('"')
if name == "keyid":
found["keyid"] = raw
elif name == "alg":
found["alg"] = raw.lower()
elif name in ("created", "expires"):
found[name] = int(raw) if SECONDS.match(raw) else None
return found
def signature_base(method, path, headers, parsed):
"""RFC 9421 signature base, or None. `headers` has lower-case names; `path` has no query."""
lines = []
for c in parsed["components"]:
if c == "@method":
value = (method if method is not None else "GET").upper()
elif c == "@authority":
if "host" not in headers:
return None
value = headers["host"].lower()
elif c == "@path":
value = path if path is not None else "/"
elif c.startswith("@"):
return None # @query, @target-uri and the rest are not supported
elif c in headers:
value = headers[c].strip()
else:
return None
lines.append('"%s": %s' % (c, value))
lines.append('"@signature-params": ' + parsed["params_value"])
return "\n".join(lines)
def signature_bytes(header, label):
for member in header.split(","):
name, sep, value = member.partition("=")
if not sep or name.strip() != label:
continue
value = value.strip()
if len(value) < 2 or not (value.startswith(":") and value.endswith(":")):
return None
b64 = re.sub(r"[=\s]", "", value[1:-1])
if not B64.match(b64):
return None
return base64.b64decode(b64 + "=" * (-len(b64) % 4))
return None
def verify_signed_request(method, path, headers, keys, vendor, now=None):
"""Return (outcome, keyid, reason); outcome is "verified", "refuted" or "no-evidence"."""
now = int(time.time()) if now is None else now
sig_input, sig_header = headers.get("signature-input"), headers.get("signature")
if sig_input is None or sig_header is None:
return "no-evidence", None, "request is not signed"
parsed = parse_signature_input(sig_input)
if parsed is None:
return "refuted", None, "unparseable Signature-Input"
keyid = parsed.get("keyid")
if keyid is None:
m = re.search(r'keyid="*([^";,]+)', sig_input)
keyid = m.group(1) if m else None
if not keyid:
return "refuted", None, "no keyid"
if keyid not in keys:
return "no-evidence", keyid, "key not held"
public_key, key_vendor = keys[keyid]
if parsed.get("alg") not in (None, "ed25519"):
return "refuted", keyid, "alg " + parsed["alg"]
for c in REQUIRED:
if c not in parsed["components"]:
return "refuted", keyid, c + " not covered"
created, expires = parsed.get("created"), parsed.get("expires")
if created is None or expires is None:
return "refuted", keyid, "created and expires are required"
if expires <= created or expires - created > MAX_VALIDITY_SECS:
return "refuted", keyid, "validity window"
if created > now + MAX_SKEW_SECS or now > expires + MAX_SKEW_SECS:
return "refuted", keyid, "outside validity window"
sig = signature_bytes(sig_header, parsed["label"])
if sig is None or len(sig) != 64:
return "refuted", keyid, "no usable signature for this label"
base = signature_base(method, path, headers, parsed)
if base is None:
return "refuted", keyid, "a covered component is unsupported or absent"
try:
public_key.verify(sig, base.encode("utf-8"))
except InvalidSignature:
return "refuted", keyid, "bad signature"
if key_vendor != vendor:
return "refuted", keyid, "key is registered to " + key_vendor
return "verified", keyid, "signature verified"
To use it, load every directory the registry names, pick the claimed agent the way CrawlClick does, and pass the agent’s vendor so a key from another vendor cannot vouch for it:
import json
import sys
import urllib.request
from webbotauth import load_directory, verify_signed_request
REGISTRY = urllib.request.Request(
"https://docs.crawlclick.com/crawlers.json", headers={"User-Agent": "key-directory-loader/1.0"}
)
with urllib.request.urlopen(REGISTRY, timeout=10) as response:
AGENTS = json.load(response)["agents"]
KEYS = {}
for agent in AGENTS:
if agent["key_directory"]:
try:
load_directory(agent["key_directory"], agent["vendor"], KEYS)
except (OSError, ValueError) as err:
print(f"keys: {err}", file=sys.stderr)
def signature_agent(header):
"""The URL in `"https://chatgpt.com"` or the labelled form `g="https://agent.bot.goog"`."""
first = (header or "").split(",")[0].strip()
label, sep, rest = first.partition("=")
value = rest.strip() if sep and '"' not in label and ":" not in label else first
if len(value) >= 2 and value.startswith('"') and value.endswith('"'):
value = value[1:-1]
return value.strip().rstrip("/").lower()
def claimed_agent(headers):
ua = headers.get("user-agent", "").lower()
for agent in AGENTS:
if any(token in ua for token in agent["ua_match"]):
return agent
if "signature" not in headers or "signature-input" not in headers:
return None
named = signature_agent(headers.get("signature-agent"))
return next((a for a in AGENTS if (a["signature_agent"] or "").lower() == named and named), None)
def verify(method, raw_path, headers):
"""`headers` maps lower-case names to values; `raw_path` may include a query string."""
agent = claimed_agent(headers)
if agent is None:
return None, ("no-evidence", None, "no registry agent claimed")
path = raw_path.split("?", 1)[0] # @path never includes the query string
return agent["id"], verify_signed_request(method, path, headers, KEYS, agent["vendor"])
Header names must be lower-case in the headers dictionary. In a WSGI app, rebuild them from the HTTP_*
environment keys; in an ASGI app, decode the scope’s header pairs.
Does CrawlClick’s production edge verify signatures today?
The verifier runs in production. The proxy holds every key the fetch job cached and checks each signed request it receives, and the publisher Worker passes the request’s signature headers through unchanged.
See Request routing for the Worker’s pattern,
Published IP ranges for the method most routed agents are verified by, and the
crawler registry for the signature_agent and key_directory fields.