Skip to content

otto-md/csrf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go stateless CSRF Build Status

A stateless CSRF middleware for Go. It works by relying the presence of the Origin header. It will also fall back to Referer if that's provided and Origin isn't, but it has no mechanic for embedding a form token.

import (
    "github.com/brandur/csrf"
)

func main() {
    var handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
    handler = csrf.Protect(
        csrf.AllowedOrigin("https://example.com")
    )(s)

    ...
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 96.4%
  • Shell 3.6%