Implement CSRF protection and security hardening across the application (#4179)

* Implement CSRF protection and security hardening across the application

- Added CSRF token handling in axios requests and HTML templates.
- Introduced CSRF middleware to validate tokens for unsafe HTTP methods.
- Implemented login limiter to prevent brute-force attacks.
- Enhanced security headers in middleware for improved response security.
- Updated login notification to include safe metadata without passwords.
- Added tests for CSRF middleware and login limiter functionality.

* fix
This commit is contained in:
Farhad H. P. Shirvan
2026-05-07 23:36:11 +02:00
committed by GitHub
parent a1b2382877
commit 10ebc6cbdc
28 changed files with 525 additions and 41 deletions
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 الترافيك: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ الحالة: {{ .State }}\r\n"
"username" = "👤 اسم المستخدم: {{ .Username }}\r\n"
"password" = "👤 الباسورد: {{ .Password }}\r\n"
"reason" = "❗️ السبب: {{ .Reason }}\r\n"
"time" = "⏰ الوقت: {{ .Time }}\r\n"
"inbound" = "📍 الإدخال: {{ .Remark }}\r\n"
"port" = "🔌 البورت: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 Traffic: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Status: {{ .State }}\r\n"
"username" = "👤 Username: {{ .Username }}\r\n"
"password" = "👤 Password: {{ .Password }}\r\n"
"reason" = "❗️ Reason: {{ .Reason }}\r\n"
"time" = "⏰ Time: {{ .Time }}\r\n"
"inbound" = "📍 Inbound: {{ .Remark }}\r\n"
"port" = "🔌 Port: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 Tráfico: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Estado de Xray: {{ .State }}\r\n"
"username" = "👤 Nombre de usuario: {{ .Username }}\r\n"
"password" = "👤 Contraseña: {{ .Password }}\r\n"
"reason" = "❗️ Motivo: {{ .Reason }}\r\n"
"time" = "⏰ Hora: {{ .Time }}\r\n"
"inbound" = "📍 Inbound: {{ .Remark }}\r\n"
"port" = "🔌 Puerto: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 ترافیک: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "ℹ️ وضعیت‌ایکس‌ری: {{ .State }}\r\n"
"username" = "👤 نام‌کاربری: {{ .Username }}\r\n"
"password" = "👤 رمز عبور: {{ .Password }}\r\n"
"reason" = "❗️ دلیل: {{ .Reason }}\r\n"
"time" = "⏰ زمان: {{ .Time }}\r\n"
"inbound" = "📍 نام‌ورودی: {{ .Remark }}\r\n"
"port" = "🔌 پورت: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 Lalu Lintas: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Status: {{ .State }}\r\n"
"username" = "👤 Nama Pengguna: {{ .Username }}\r\n"
"password" = "👤 Kata Sandi: {{ .Password }}\r\n"
"reason" = "❗️ Alasan: {{ .Reason }}\r\n"
"time" = "⏰ Waktu: {{ .Time }}\r\n"
"inbound" = "📍 Inbound: {{ .Remark }}\r\n"
"port" = "🔌 Port: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 トラフィック:{{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Xrayステータス:{{ .State }}\r\n"
"username" = "👤 ユーザー名:{{ .Username }}\r\n"
"password" = "👤 パスワード: {{ .Password }}\r\n"
"reason" = "❗️ 理由:{{ .Reason }}\r\n"
"time" = "⏰ 時間:{{ .Time }}\r\n"
"inbound" = "📍 インバウンド:{{ .Remark }}\r\n"
"port" = "🔌 ポート:{{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 Tráfego: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Status: {{ .State }}\r\n"
"username" = "👤 Nome de usuário: {{ .Username }}\r\n"
"password" = "👤 Senha: {{ .Password }}\r\n"
"reason" = "❗️ Motivo: {{ .Reason }}\r\n"
"time" = "⏰ Hora: {{ .Time }}\r\n"
"inbound" = "📍 Inbound: {{ .Remark }}\r\n"
"port" = "🔌 Porta: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 Трафик: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Состояние Xray: {{ .State }}\r\n"
"username" = "👤 Имя пользователя: {{ .Username }}\r\n"
"password" = "👤 Пароль: {{ .Password }}\r\n"
"reason" = "❗️ Причина: {{ .Reason }}\r\n"
"time" = "⏰ Время: {{ .Time }}\r\n"
"inbound" = "📍 Входящее подключение: {{ .Remark }}\r\n"
"port" = "🔌 Порт: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 Trafik: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Durum: {{ .State }}\r\n"
"username" = "👤 Kullanıcı Adı: {{ .Username }}\r\n"
"password" = "👤 Şifre: {{ .Password }}\r\n"
"reason" = "❗️ Sebep: {{ .Reason }}\r\n"
"time" = "⏰ Zaman: {{ .Time }}\r\n"
"inbound" = "📍 Gelen: {{ .Remark }}\r\n"
"port" = "🔌 Port: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 Трафік: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Статус: {{ .State }}\r\n"
"username" = "👤 Ім'я користувача: {{ .Username }}\r\n"
"password" = "👤 Пароль: {{ .Password }}\r\n"
"reason" = "❗️ Причина: {{ .Reason }}\r\n"
"time" = "⏰ Час: {{ .Time }}\r\n"
"inbound" = "📍 Inbound: {{ .Remark }}\r\n"
"port" = "🔌 Порт: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 Lưu lượng: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Trạng thái Xray: {{ .State }}\r\n"
"username" = "👤 Tên người dùng: {{ .Username }}\r\n"
"password" = "👤 Mật khẩu: {{ .Password }}\r\n"
"reason" = "❗️ Lý do: {{ .Reason }}\r\n"
"time" = "⏰ Thời gian: {{ .Time }}\r\n"
"inbound" = "📍 Inbound: {{ .Remark }}\r\n"
"port" = "🔌 Cổng: {{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 流量:{{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Xray 状态:{{ .State }}\r\n"
"username" = "👤 用户名:{{ .Username }}\r\n"
"password" = "👤 密码: {{ .Password }}\r\n"
"reason" = "❗️ 原因:{{ .Reason }}\r\n"
"time" = "⏰ 时间:{{ .Time }}\r\n"
"inbound" = "📍 入站:{{ .Remark }}\r\n"
"port" = "🔌 端口:{{ .Port }}\r\n"
+1 -1
View File
@@ -765,7 +765,7 @@
"traffic" = "🚦 流量:{{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
"xrayStatus" = "️ Xray 狀態:{{ .State }}\r\n"
"username" = "👤 使用者名稱:{{ .Username }}\r\n"
"password" = "👤 密碼: {{ .Password }}\r\n"
"reason" = "❗️ 原因:{{ .Reason }}\r\n"
"time" = "⏰ 時間:{{ .Time }}\r\n"
"inbound" = "📍 入站:{{ .Remark }}\r\n"
"port" = "🔌 埠:{{ .Port }}\r\n"