An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/2lambda123/csrf

Package csrf (gorilla/csrf) provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services. It includes: gorilla/csrf is easy to use: add the middleware to individual handlers with the below: ... and then collect the token with `csrf.Token(r)` before passing it to the template, JSON body or HTTP header (you pick!). gorilla/csrf inspects the form body (first) and HTTP headers (second) on subsequent POST/PUT/PATCH/DELETE/etc. requests for the token. Here's the common use-case: HTML forms you want to provide CSRF protection for, in order to protect malicious POST requests being made: Note that the CSRF middleware will (by necessity) consume the request body if the token is passed via POST form values. If you need to consume this in your handler, insert your own middleware earlier in the chain to capture the request body. You can also send the CSRF token in the response header. This approach is useful if you're using a front-end JavaScript framework like Ember or Angular, or are providing a JSON API: In addition: getting CSRF protection right is important, so here's some background: This library does not seek to be adventurous.

Ecosystem
proxy.golang.org
Latest Release
v1.7.2
over 2 years ago
Versions
9
v1.7.2
Published: over 2 years ago
Registry - Documentation - Download
v1.7.1
Published: over 4 years ago
Registry - Documentation - Download
v1.7.0
Published: almost 6 years ago
Registry - Documentation - Download
v1.6.2
Published: over 6 years ago
Registry - Documentation - Download
v1.6.1
Published: over 6 years ago
Registry - Documentation - Download
v1.6.0
Published: over 6 years ago
Registry - Documentation - Download
v1.5.1
Published: almost 8 years ago
Registry - Documentation - Download
v1.0.2
Published: over 10 years ago
Registry - Documentation - Download
v1.0.1
Published: over 10 years ago
Registry - Documentation - Download
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/2lambda123/csrf
spec
License BSD-3-Clause
Namespace github.com/2lambda123
First Release over 10 years ago
Last Synced 23 days ago
Repository
Stars 0 on GitHub
Forks 0 on GitHub