增强安全性

This commit is contained in:
刘祥超
2024-03-18 11:45:13 +08:00
parent 711e36d0bf
commit 005e25c1b8
4 changed files with 24 additions and 0 deletions

View File

@@ -21,6 +21,12 @@ func (this *UserShouldAuth) BeforeAction(actionPtr actions.ActionWrapper, paramN
this.action = actionPtr.Object()
// 检查请求是否合法
if isEvilRequest(this.action.Request) {
this.action.ResponseWriter.WriteHeader(http.StatusForbidden)
return false
}
// 安全相关
var action = this.action
securityConfig, _ := configloaders.LoadSecurityConfig()