Quellcode durchsuchen

Fixed csrf issue

Toby Chui vor 9 Monaten
Ursprung
Commit
34b2ce7519
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  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()