mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-17 22:30:25 +08:00
增强安全性
This commit is contained in:
@@ -24,6 +24,12 @@ func NewUserMustAuth() *UserMustAuth {
|
||||
func (this *UserMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramName string) (goNext bool) {
|
||||
var action = actionPtr.Object()
|
||||
|
||||
// 安全相关
|
||||
if !teaconst.EnabledFrame {
|
||||
action.AddHeader("X-Frame-Options", "SAMEORIGIN")
|
||||
}
|
||||
action.AddHeader("Content-Security-Policy", "default-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'")
|
||||
|
||||
// 检查系统是否已经配置过
|
||||
if !setup.IsConfigured() {
|
||||
action.RedirectURL("/setup")
|
||||
|
||||
Reference in New Issue
Block a user