浏览代码

Fixed csrf issue

Toby Chui 8 月之前
父节点
当前提交
34b2ce7519
共有 1 个文件被更改,包括 8 次插入2 次删除
  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()