httpsig

package module
v0.0.0-...-84b73ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

README

web-bot-auth Caddy Plugin

GitHub License GitHub Release

Caddy plugin extending Caddy configuration to allow for validation of web-bot-auth as defined in draft-meunier-web-bot-auth-architecture.

Tables of Content

Features

This is an example plugin and only supports Ed25519. You can find a test key in Appendix B.1.4 of RFC 9421.

  • httpsig configuration hook
  • Parse HTTP Message Signatures directory
  • Block request without a valid signature

Usage

First, you need to install xcaddy

go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest

Then you build caddy

xcaddy build latest --with github.com/cloudflareresearch/web-bot-auth/examples/caddy-plugin=./

And finally, you run caddy

./caddy run --config Caddyfile

To generate a signed request, you can use the sibling browser extension.

Security Considerations

This software has not been audited. Please use at your sole discretion.

License

This project is under the Apache 2.0 license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be Apache 2.0 licensed as above, without any additional terms or conditions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

type Directory struct {
	Keys    []json.RawMessage `json:"keys"`
	Purpose *string           `json:"purpose,omitempty"`
}

type Middleware

type Middleware struct {
	DirectoryBase string `json:"directory_base"`
	// contains filtered or unexported fields
}

Middleware struct to hold the configuration for the handler

func (Middleware) CaddyModule

func (m Middleware) CaddyModule() caddy.ModuleInfo

CaddyModule function to provide module information to Caddy

func (*Middleware) Provision

func (m *Middleware) Provision(ctx caddy.Context) error

Provision method for setting up the validator with the public key

func (*Middleware) ServeHTTP

func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

ServeHTTP method to handle the request and validate the signature

func (*Middleware) UnmarshalCaddyfile

func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile method to allow configuration via the Caddyfile

type SignatureValidator

type SignatureValidator struct {
	Verifier *httpsig.Verifier
}

func NewValidator

func NewValidator(keyData []byte) (*SignatureValidator, error)

func (*SignatureValidator) Validate

func (v *SignatureValidator) Validate(r *http.Request) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL