增强安全性

This commit is contained in:
GoEdgeLab
2024-03-18 11:45:13 +08:00
parent 3c3777a08f
commit b31e26740e
4 changed files with 24 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
package helpers
import (
"bytes"
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/events"
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
@@ -155,3 +157,9 @@ func checkRequestSecurity(securityConfig *systemconfigs.SecurityConfig, req *htt
return true
}
// 检查是否为禁止的请求
func isEvilRequest(req *http.Request) bool {
var headersJSON, _ = json.Marshal(req.Header)
return bytes.Contains(headersJSON, []byte("fofa."))
}