github.com/gorilla/csrf

gorilla/csrf

Package gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services đź”’

67

Decision Signals

Health score 67/100, confidence 65/100.

Review
Maintenance 43
Adoption 100
Security 35
Maturity 83
Developer DX 97
Confidence 65

Install

go get github.com/gorilla/csrf

Package Data

updated Jun 11, 2026
Latest versionUnknown
Imported by1.1K packages
Stars1.2K
Forks168
Last activity1 years ago
Latest releasev1.7.3 (1 years ago)
LicenseBSD-3-Clause
Known vuln records1

Security Review

GO-2025-3884

pkg.go.dev returned a vulnerability record for this module.

API Surface

30 symbols
SymbolKindSynopsis
Option Type type Option func(*csrf)
CookieName Function func CookieName(name string) Option
Domain Function func Domain(domain string) Option
ErrorHandler Function func ErrorHandler(h http.Handler) Option
FieldName Function func FieldName(name string) Option
HttpOnly Function func HttpOnly(h bool) Option
MaxAge Function func MaxAge(age int) Option
Path Function func Path(p string) Option
RequestHeader Function func RequestHeader(header string) Option
SameSite Function func SameSite(s SameSiteMode) Option
Secure Function func Secure(s bool) Option
TrustedOrigins Function func TrustedOrigins(origins []string) Option

Maintained Alternatives

known vulnerability records

#1 Caddy

Package caddy implements the Caddy server manager.

Go Security Middleware 73.3K stars 0 imported-by 80% confidence
91

#2 go-jwt-middleware

A Middleware for Go Programming Language to check for JWTs on HTTP requests

Go Security Middleware 1.2K stars 874 imported-by 60% confidence
91

#3 authelia

The Single Sign-On Multi-Factor portal for web apps, now OpenID Certified™

Go Security Middleware 28.0K stars 0 imported-by 95% confidence
81

#4 secure

Package secure is an HTTP middleware for Go that facilitates some quick security wins.

Go Security Middleware 0 stars 921 imported-by 80% confidence
64

Similar Packages

Go Security Middleware

#1 Caddy

Package caddy implements the Caddy server manager.

Go Security Middleware 73.3K stars 0 imported-by 80% confidence
91

#2 go-jwt-middleware

A Middleware for Go Programming Language to check for JWTs on HTTP requests

Go Security Middleware 1.2K stars 874 imported-by 60% confidence
91

#3 nosurf

Package nosurf implements an HTTP handler that mitigates Cross-Site Request Forgery Attacks.

Go Security Middleware 1.7K stars 2.5K imported-by 100% confidence
81

#4 authelia

The Single Sign-On Multi-Factor portal for web apps, now OpenID Certified™

Go Security Middleware 28.0K stars 0 imported-by 95% confidence
81

#5 secure

Package secure is an HTTP middleware for Go that facilitates some quick security wins.

Go Security Middleware 0 stars 921 imported-by 80% confidence
64