907 B
907 B
Telegram 出站脱敏 + 安全回归测试(F2d-04 / F2f-06)
日期: 2026-05-22
F2d-04 — Telegram 脱敏
server/infrastructure/telegram/__init__.py:新增sanitize_external_message(),屏蔽 DB/Redis URL、password、Bearer、密钥片段。send_telegram_system_alert():出站前脱敏 +html.escape。send_telegram()成功日志同样脱敏后再截断。self_monitor.py:Redis/MySQL 失败详情写入logger.warning(..., exc_info=True);Telegram 仅固定文案。
F2f-06 — 回归测试
tests/test_security_unit.py 扩展至 15 项,覆盖:
- 危险命令、
server_idsJSON 解析、HTTPS callback sanitize_external_message脱敏与截断JwtAuthMiddleware401 / 公开路径跳过/api/install/、/api/auth/logout公开前缀- 安装后
_reject_if_installed()→ 403
pytest tests/test_security_unit.py -q