From 614b63a76a71fd3dcd5a3de46b7892696b487052 Mon Sep 17 00:00:00 2001 From: Zhi Wang Date: Wed, 26 Jan 2022 10:43:15 -0500 Subject: [PATCH] set csrf.Path to / to have csrf across paths --- web/routing.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/routing.go b/web/routing.go index 41e812f..5bb5f07 100644 --- a/web/routing.go +++ b/web/routing.go @@ -30,7 +30,7 @@ func StartWeb(fp *os.File, cmd []string, naked bool, port uint16) { store := sessions.NewCookieStore([]byte(uniuri.NewLen(32))) rt.Use(sessions.Sessions("witty-session", store)) - csrfHttp := csrf.Protect([]byte(uniuri.NewLen(32))) + csrfHttp := csrf.Protect([]byte(uniuri.NewLen(32)), csrf.Path("/")) csrfGin := adapter.Wrap(csrfHttp) rt.Use(csrfGin)