增强安全性

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

@@ -109,6 +109,12 @@ func NewUserMustAuth(module string) *userMustAuth {
func (this *userMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramName string) (goNext bool) {
var action = actionPtr.Object()
// 检查请求是否合法
if isEvilRequest(action.Request) {
action.ResponseWriter.WriteHeader(http.StatusForbidden)
return false
}
// 恢复模式
if teaconst.IsRecoverMode {
action.RedirectURL("/recover")