From 6b89c3ea810e18c72278ae8fba30786aa1707ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D1=82=D0=B0=D0=BB=D0=B8=D0=B9=20=D0=9B=D0=B8?= =?UTF-8?q?=D1=82=D0=B2=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 24 Apr 2026 23:08:02 +0300 Subject: [PATCH] v2.5.0: redact admin overview secret --- admin-web/server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/admin-web/server.py b/admin-web/server.py index a81087d..94bb481 100644 --- a/admin-web/server.py +++ b/admin-web/server.py @@ -43,6 +43,7 @@ PORT = int(os.getenv("GOTELEGRAM_ADMIN_PORT", "1984")) VERSION = "2.5.0" USER_RE = re.compile(r"^[A-Za-z0-9_.-]{1,48}$") LANG_RE = re.compile(r"^(en|ru)$") +SENSITIVE_CONFIG_KEYS = {"secret"} def utc_now() -> str: @@ -91,6 +92,10 @@ def read_language(config: dict[str, Any] | None = None) -> str: return lang if lang in {"en", "ru"} else "en" +def public_config(config: dict[str, Any]) -> dict[str, Any]: + return {key: value for key, value in config.items() if key not in SENSITIVE_CONFIG_KEYS} + + def write_language(lang: str) -> dict[str, Any]: lang = str(lang or "").strip().lower() if not LANG_RE.match(lang): @@ -488,7 +493,7 @@ def overview_payload() -> dict[str, Any]: "time": utc_now(), "language": language, "admin_bind": {"host": HOST, "port": PORT}, - "config": config, + "config": public_config(config), "site_status": site_status(config), "users_count": len(users), "services": services,