Skip to content

AI security

Verifying OpenAI’s signed agent traffic from Python

6 min read

Written by an AI model from the linked sources and checked against them by a second model. How we work

All about: OpenAI models and products →
Image: github.com

Regent Protocol, which builds runtime control and identity tooling for AI agents, on August 19 released regent-httpsig, a Python library that covers both ends of the signed-agent handshake. It checks the RFC 9421 signatures OpenAI’s agents attach to every HTTP request, so an API can tell which agent is calling. It also signs your own agent’s requests, so bot walls that verify signatures, such as Cloudflare, AWS WAF and Google, can recognize it.

The code is on GitHub under Apache-2.0 and installs with pip install regent-httpsig. The authors say it was built and battle-tested in production at Regent Protocol. The README lists three related projects: Cloudflare’s web-bot-auth in TypeScript and Rust, christian-posta’s full AAuth implementation in Python, and pyauth/http-message-signatures, the RFC 9421 building block that regent-httpsig wraps.

How a signed request identifies itself

RFC 9421 is a final IETF standard for signing selected parts of an HTTP message. Web Bot Auth, specified in draft-meunier-web-bot-auth-architecture, adds a Signature-Agent header that names the agent’s origin. A verifier fetches the public keys from {Signature-Agent}/.well-known/http-message-signatures-directory and checks the signature against them. The keyid is an RFC 7638 thumbprint, a hash of the public key itself. Cloudflare’s documentation for bot operators describes the same setup from the signer’s side: generate an Ed25519 key, convert the public half to a JWK, and serve the JWKS over HTTPS at that path.

The older ways of identifying a bot rely on what the client says about itself. User-agent strings can be faked, and scrapers do pose as Googlebot. IP and reverse-DNS checks get less reliable as operators move infrastructure around. In August 2025 Cloudflare documented an undeclared Perplexity crawler that rotated IPs and ASNs after its declared agent was blocked. A signature ties identity to a key, wherever the request comes from.

Cloudflare shared the Web Bot Auth proposal in May 2025, with Vercel, Shopify and Visa among the implementers, PPC Land reported. On October 30, 2025 Cloudflare announced a registry format, lists of URLs pointing to key directories, alongside Amazon Bedrock AgentCore, which adopted the protocol for its AgentCore Browser. One of the registry’s example entries, per the same report, is https://chatgpt.com/.well-known/http-message-signatures-directory. That is the origin regent-httpsig reports when OpenAI calls.

Verifying in five lines

The FastAPI integration is an attach(app, HttpsigVerifier()) call plus a dependency on the route. When a request is signed, the handler receives a VerifiedSignature whose sig.agent reads "https://chatgpt.com" and whose sig.keyid holds the key thumbprint. The core has no framework dependencies: await verifier.verify(method, url, headers) returns a VerifiedSignature or None.

By default verification only adds information. A request with no Signature header costs nothing, a bad signature yields None, and the README says nothing ever raises on untrusted input. Routes that must have a signature use RequiredSignatureDep, and its 401 response tells the agent exactly how to sign.

The README calls out one production trap. The agent signed the public URL, say https://api.example/…, but the ASGI server behind a reverse proxy sees http://container/…. The FastAPI dependency rebuilds the signed URL from X-Forwarded-Proto and Host, so the proxy has to forward the scheme; for nginx that means proxy_set_header X-Forwarded-Proto $scheme;. The authors put it bluntly: if signatures mysteriously fail in production, check this first.

Configuration goes through HttpsigConfig: trusted_agents takes an allow-list (the example lists https://chatgpt.com and https://operator.openai.com), max_age_hours=25 rejects older signatures, and cache_ttl=600 sets the key-directory cache in seconds. An app can pass its shared async client through http_client to reuse its connection pool.

Signing your own agent

The outbound side is an EgressSigner built from a key seed in an environment variable and the agent’s origin. Its sign() method returns headers to pass to httpx or any other client. A single command, regent-httpsig keygen --agent https://myagent.example --out ./well-known/, generates the key and the ready-to-publish /.well-known/ files. Once the directory is live at https://myagent.example/.well-known/http-message-signatures-directory, the README says any Web Bot Auth verifier can identify the agent.

Two dialects, and what testing found

The verifier accepts both wire forms of Signature-Agent: the current structured-field dictionary from draft -05, which carries a ;key= member, and the legacy bare string form that OpenAI actually ships in production. It also speaks AAuth (draft-hardt-oauth-aauth-protocol) in identity mode, installed with pip install 'regent-httpsig[aauth]'. There the agent carries a JWT agent_token in Signature-Key. The issuer’s JWKS verifies the token, and the token’s cnf.jwk verifies the request signature, which proves the caller holds the key. The library tracks the -11 editor’s copy, including RFC 9864’s fully-specified Ed25519 algorithm name with a transition flag for the -10 ecosystem’s EdDSA, and opt-in person tokens via HttpsigConfig.resource_url. For both AAuth roles and every token type, the authors point to christian-posta’s library and describe theirs as the thin relying-party verifier.

The CI checks are byte-exact against published vectors, and they turned up problems in the specs themselves, which are still young. The signature bytes printed in Web Bot Auth draft -05’s A.2.2 example do not verify over that draft’s own signature base. The legacy A.2.3 vector and RFC 9421’s Appendix B.2.6 both pass, so the authors place the defect in the example and not in canonicalization. Because Ed25519 is deterministic, their test pins the vector re-signed with the same RFC test key over the same base, and the issue has been reported upstream.

Interop with aauth-signing passed at the token, proof-of-possession and canonicalization layers. But its signers correctly omit the optional keyid, which exposed an unconditional keyid read in the underlying RFC 9421 library. aauth-signing also emits the signature bytes as base64url where RFC 8941 requires standard base64; that has been reported upstream too. The pyauth primitive has three more gaps that regent-httpsig works around: it cannot resolve ;key= dictionary members, it looks up header names case-sensitively while ASGI frameworks lowercase them, and it does not declare its typing_extensions dependency.

What the guard rails cover

Whoever signs a request picks its Signature-Agent, so the verifier ends up fetching key directories from origins an attacker can name. Protection against SSRF (server-side request forgery, getting a server to fetch internal addresses for you) is on by default. Fetches are https-only, and every resolved IP must be public, which blocks 169.254.169.254, loopback, private ranges and DNS names that map to internal services. Redirects are never followed and response sizes are capped. The cache is per-instance with a TTL and eviction, so a flood of fake keyids cannot grow memory. Failed lookups are cached too, so a dead origin cannot be used to slow the service down.

The admitted limits: Web Bot Auth and AAuth are IETF drafts, and while the library is at 0.x, breaking draft changes land as minor releases. Only Ed25519 is supported, which the authors say is what the agent ecosystem ships. When a signature covers the request body through content-digest, the library verifies it, but it does not require that coverage, so each route has to decide whether it needs it.

A verified request also does not mean a trusted caller. VerifiedSignature.trusted reflects only the configured allow-list, and the README leaves the rest to the application’s policy layer: “A valid signature proves key possession — not trustworthiness.”

No comments yet. Be the first.

Join the conversation

Sign in to leave a comment. It appears after moderation.