Skip to content

Commit c2fd02a

Browse files
feat(system-security): Added 444 and 500 responses for unauthenticated settings (#7143)
1 parent a8aa1f8 commit c2fd02a

File tree

7 files changed

+37
-2
lines changed

7 files changed

+37
-2
lines changed

backend/constant/common.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,22 @@ var WebUrlMap = map[string]struct{}{
9999
"/websites/runtimes/python": {},
100100

101101
"/login": {},
102+
103+
"/xpack": {},
104+
"/xpack/waf/dashboard": {},
105+
"/xpack/waf/global": {},
106+
"/xpack/waf/websites": {},
107+
"/xpack/waf/log": {},
108+
"/xpack/waf/block": {},
109+
"/xpack/monitor/dashboard": {},
110+
"/xpack/monitor/setting": {},
111+
"/xpack/monitor/rank": {},
112+
"/xpack/monitor/log": {},
113+
"/xpack/tamper": {},
114+
"/xpack/gpu": {},
115+
"/xpack/alert/dashboard": {},
116+
"/xpack/alert/log": {},
117+
"/xpack/setting": {},
102118
}
103119

104120
var DynamicRoutes = []string{

backend/init/router/router.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ func handleNoRoute(c *gin.Context) {
9090
c.String(http.StatusInternalServerError, "Internal Server Error")
9191
return
9292
}
93+
if resPage == "444" {
94+
c.String(444, "")
95+
return
96+
}
97+
9398
file := fmt.Sprintf("html/%s.html", resPage)
9499
if resPage == "200" && c.GetHeader("Accept-Language") == "en" {
95100
file = "html/200_en.html"

cmd/server/res/html/500.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head><title>400 Bad Request</title></head>
3+
<head><title>Internal Server Error</title></head>
44
<body>
5-
<center><h1>400 Bad Request</h1></center>
5+
<center><h1>Internal Server Error</h1></center>
66
<hr><center>nginx</center>
77
</body>

frontend/src/lang/modules/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,8 @@ const message = {
15861586
error404: 'Not Found',
15871587
error408: 'Request Timeout',
15881588
error416: 'Range Not Satisfiable',
1589+
error444: 'Connection closed',
1590+
error500: 'Server error',
15891591

15901592
https: 'Setting up HTTPS protocol access for the panel can enhance the security of panel access.',
15911593
certType: 'Certificate type',

frontend/src/lang/modules/tw.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,8 @@ const message = {
15191519
error404: '未找到',
15201520
error408: '請求超時',
15211521
error416: '無效請求',
1522+
error444: '關閉連線',
1523+
error500: '伺服器錯誤',
15221524

15231525
https: '為面板設置 https 協議訪問,提升面板訪問安全性',
15241526
certType: '證書類型',

frontend/src/lang/modules/zh.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,8 @@ const message = {
15201520
error404: '未找到',
15211521
error408: '请求超时',
15221522
error416: '无效请求',
1523+
error444: '关闭连接',
1524+
error500: '服务器错误',
15231525

15241526
https: '为面板设置 https 协议访问,提升面板访问安全性',
15251527
certType: '证书类型',

frontend/src/views/setting/safe/response/index.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ const options = [
9090
value: '416',
9191
label: '416 - ' + i18n.global.t('setting.error416'),
9292
},
93+
{
94+
value: '444',
95+
label: '444 - ' + i18n.global.t('setting.error444'),
96+
},
97+
{
98+
value: '500',
99+
label: '500 - ' + i18n.global.t('setting.error500'),
100+
},
93101
];
94102
95103
interface DialogProps {

0 commit comments

Comments
 (0)