CsrfOptions
Properties
Section titled “Properties”allowedOrigins
Section titled “allowedOrigins”
readonlyallowedOrigins: readonlystring[]
Origins allowed to send unsafe requests, such as https://app.example.
allowSameSite?
Section titled “allowSameSite?”
readonlyoptionalallowSameSite?:boolean
Accept Sec-Fetch-Site: same-site too, for sibling subdomains you trust. Default false.
crossSiteOrigins?
Section titled “crossSiteOrigins?”
readonlyoptionalcrossSiteOrigins?: readonlystring[]
Exact origins allowed to send unsafe requests from another site, such
as a desktop shell on its own scheme (app://desktop). An origin listed
here counts as allowed, and its Sec-Fetch-Site: cross-site requests
pass; the double-submit token is still required. Matched exactly, no
wildcards. Trust each one as much as your own origin. Default none.
exempt?
Section titled “exempt?”
readonlyoptionalexempt?: readonly (string|RegExp)[]
Paths that skip CSRF entirely, such as a webhook that authenticates with a signature. A string matches the request path exactly (a global prefix included); a RegExp is tested against it. Exempt requests are still subject to the session guard.
headerName?
Section titled “headerName?”
readonlyoptionalheaderName?:string
Header the page echoes the token in. Default x-csrf-token.
secrets
Section titled “secrets”
readonlysecrets: readonly (string|Uint8Array<ArrayBufferLike>)[]
Signs the double-submit token. At least 32 bytes each, and not the auth secret. Current secret first, previous ones after it during a rollover: a safe request replaces a token signed by a previous secret with one under the current secret.