Ver código fonte

Fixed csrf issue

Toby Chui 8 meses atrás
pai
commit
34b2ce7519
1 arquivos alterados com 8 adições e 2 exclusões
  1. 8 2
      main.go

+ 8 - 2
main.go

@@ -180,8 +180,14 @@ func main() {
 	nodeUUID = string(uuidBytes)
 
 	//Create a new webmin mux and csrf middleware layer
-	webminPanelMux := http.NewServeMux()
-	csrfMiddleware := csrf.Protect([]byte(nodeUUID))
+	webminPanelMux = http.NewServeMux()
+	csrfMiddleware = csrf.Protect(
+		[]byte(nodeUUID),
+		csrf.CookieName("zoraxy-csrf"),
+		csrf.Secure(false),
+		csrf.Path("/"),
+		csrf.SameSite(csrf.SameSiteLaxMode),
+	)
 
 	//Startup all modules
 	startupSequence()