v1.7.1: fix all P1-P4, C1-C6, H1-H6, M1-M7, L1-L3 from error.md — async migrations, CSS variables, SQL validation, event loop, prompt injection, VCF parsing, race conditions, unused imports, gitignore

This commit is contained in:
2026-05-29 03:46:41 +03:00
parent 72b6879f4b
commit 54af5892d5
21 changed files with 406 additions and 156 deletions
+27
View File
@@ -1,5 +1,32 @@
# Changelog — AegisOne MAX Bot
## 1.7.1 (29.05.2026)
### Исправления
- **P1 (CRITICAL):** _add_column_if_not_exists — async def + await, миграции выполняются
- **P2 (CSS):** bot_consent, bot_tickets, bot_kb, bot_settings — var(--light-bg) → var(--bg-card), хардкод цвета → CSS-переменные
- **P3 (Event loop):** email_sender.send_ticket_escalation — обёрнут в run_in_executor
- **P4 (SQL injection):** _add_column_if_not_exists — валидация _validate_sql_name/type
- **C1 (CRITICAL):** BotConversation импортирован в main.py
- **C2 (VCF N-field):** regex исправлен, захватывает полную строку N:
- **C3 (Email typo):** contact.py — user.email вместо user.phone
- **C4 (None user):** inquiry.py — проверка user is None
- **C5 (Висячий тикет):** inquiry.py — flush + единый commit
- **C6 (Secrets):** docker-compose.yml — переменные через .env
- **H1 (Prompt injection):** yandex_gpt.py — instruction boundary, _sanitize_input
- **H2 (Дубль BotMessage):** contact.py — удалён дублирующий save
- **H3 (VCF phone regex):** расширен захват полного номера
- **H4 (Race condition):** greeting.py — try/except + rollback при IntegrityError
- **H5 (Silent error):** email_sender.py — logger.error добавлен
- **M1 (TOCTOU):** main.py — audit-log только при изменении статуса
- **M2 (Двухсессионный дизайн):** inquiry.py — единая транзакция
- **M3 (Stale state):** greeting.py — conv из текущей сессии
- **M4 (Double-load race):** settings_cache.py — asyncio.Lock
- **M5 (ORG regex):** захват полного ORG без обрезки по ;
- **M7 (bot_test.html):** тема наследуется через CSS-переменные + скрипт инициализации
- **L1 (Dead code):** _extract_name_from_vcf удалена
- **L2 (Импорты):** неиспользуемые Optional, json, config_reader удалены
- **L3 (.gitignore):** .opencode/, .env.example добавлены
## 1.7.0 (29.05.2026)
### Новые функции
- **Рефакторинг архитектуры:** плоская структура модулей (models.py, yandex_gpt.py, keyboards.py, email_sender.py, config_reader.py) вместо вложенных пакетов