New plugin: Aegis, which verifies Web Bot Auth signatures

Hi all! I’ve released Aegis (v0.1.0), a handler that checks Web Bot Auth signatures on incoming requests. Web Bot Auth lets an agent such as OpenAI’s sign its HTTP requests with a key it publishes at a well-known URL. Aegis checks each signature and passes the
result to the rest of your config, so your routes decide what each agent gets.

caddyfile
example.com {
        web_bot_auth

        @openai vars {web_bot_auth.agent} https://chatgpt.com/.well-known/http-message-signatures-directory
        handle @openai {
                reverse_proxy app:8080
        }

        handle {
                reverse_proxy anubis:8923
        }
}

It isn’t on the caddyserver.com download page yet (troubles claiming it). I’d suggest starting in observe and reading the
outcomes in your access log before you block anything. The README covers the settings, the reason codes, and running behind another HTTPS server.

Setup, settings and examples: GitHub - kauricre/aegis: Aegis is a Caddy module that checks Web Bot Auth signatures on incoming requests and tells the rest of the Caddy config the outcome of each check. · GitHub

Feedback welcome!

Interesting project :+1:
One question, how does replay protection work when running multiple caddy instances ?
Is the nonce state shared between them, or does each instance handle it separately? Just curious how that would behave behind a load balancer.

Each instance handles it separately.

Aegis remembers the nonce of each verified signature in memory, inside the Caddy process. A nonce is a random value the agent puts into one signature only. Behind a load balancer, a replay that lands on the instance that saw the original gets invalid with reason replay. A replay that lands on a different instance gets verified.

Two things bound the exposure:

  • A signature can only be replayed until its expires time.
  • max_validity caps how far expires can be from created(24h by default), so lowering it shortens the window.
  • Within one instance, all web_bot_auth directives with the samemax_nonces share their nonces, across sites and config reloads.

Thanks for clarifying! That’s an important limitation if you’re running more than one Caddy instance. The same signed request could still be accepted by a different node before it expires.

I’d probably make that quite prominent in the README, since it’s easy to assume replay protection covers the whole cluster.

Are you considering shared nonce storage, or is the per-instance approach intentional for now?

Good question, and thanks for pushing on it. The per-instance approach was the simplest correct starting point, not the end state. I’ll link the issue here once it’s up. Feedback on the design is welcome.