struct

KemalIdentity::CSRFConfig

Inherits Struct < Value < Object

How CSRF protection is named and scoped. Boot-time and immutable.

Constants

MIN_SECRET_BYTES = 32

Minimum signing key length. A short key is a weak signature, and this is the one place a weak default would be invisible.

SAFE_METHODS = ["GET", "HEAD", "OPTIONS", "TRACE", "QUERY"] of ::String

Anything not on this list is protected. A denylist of POST/PUT/PATCH/DELETE would leave every method nobody thought of unprotected — PROPFIND mutates in WebDAV, and HTTP QUERY did not exist when this shard was designed. Safe-by-name, protected otherwise.

QUERY is here because RFC 10008 defines it as safe and idempotent. It carries a request body, which makes it easy to mistake for a mutation; it is not one, and a spec asserts that its body does not get it treated as one.

Constructors

Instance methods

exempt?(path : String) : Bool
Source
exempt_prefixes
Source
field_name
Source
header_name
Source
inspect(io : IO) : Nil

Never prints the secret.

Source
protects?(method : String) : Bool
Source
secret
Source
secure?
Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source