justinas/nosurf
CSRF protection middleware for Go. observed · 2026-08-28
Health v2 · maintenance only
32/100
- Activity 21
- Release rhythm 8
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 4759
- days_rel: 477
- days_push: 477
- n_releases_24m: 1
Adoption not part of the score
1747 stars · 129 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
nosurf is a Go HTTP package that provides CSRF protection via a CSRFHandler middleware wrapping any http.Handler. It validates tokens on unsafe HTTP methods, supports endpoint exemptions, custom failure handlers, and masked tokens to mitigate BREACH attacks.
Use cases
- add csrf protection to a go http server
- protect go web forms from cross-site request forgery
- csrf middleware for any go framework handler
- exempt specific api endpoints from csrf checks
- mitigate breach attacks with masked csrf tokens
- custom error response for failed csrf validation
When to choose
- you need framework-agnostic CSRF protection for any Go http.Handler
- you want zero dependencies outside the Go standard library
- you need fine-grained endpoint exemptions via paths, globs, or regexes
- you want BREACH-resistant masked tokens
When to avoid
- your framework already ships built-in CSRF protection
- you need CSRF protection outside Go
- you need session-backed token storage with advanced rotation policies
Facets
library · maturity stable
middleware security http-server security web-development backend go csrf csrf-protection http-middleware breach-mitigation zero-dependency web-server
5 sources
- readme: https://github.com/justinas/nosurf · fetched 2026-08-28 · e0a4ff8fbcbc
- homepage: http://godoc.org/github.com/justinas/nosurf · fetched 2026-08-29 · 314e7cd83b99
- site_page: https://pkg.go.dev/about · fetched 2026-08-29 · 757852027879
- site_page: https://pkg.go.dev/github.com/justinas/nosurf · fetched 2026-08-29 · eac6d2130669
- site_page: https://go.dev/project · fetched 2026-08-29 · d5ca00bb378b
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| justinas/nosurf | main | 32 |
For agents
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem