1. .pre-commit-config.yaml — local pygrep hook блокирует коммиты
с токенами формата \d{9,10}:AA[A-Za-z0-9_-]{35} (Telegram bot tokens).
Проверено: срабатывает на токен, пропускает чистые файлы.
2. backend/telegram.py — три функции (send_registration_notification,
answer_callback_query, edit_message_text) логировали exc напрямую,
что раскрывало BOT_TOKEN в URL httpx-исключений в journalctl.
Заменено на type(exc).__name__ — только тип ошибки, без URL.
Refs: #1303, #1309, #1283
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
11 lines
419 B
YAML
11 lines
419 B
YAML
repos:
|
|
- repo: local
|
|
hooks:
|
|
- id: no-telegram-bot-token
|
|
name: Block Telegram bot tokens
|
|
# Matches tokens of format: 1234567890:AAFisjLS-yO_AmwqMjpBQgfV9qlHnexZlMs
|
|
# Pattern: 9-10 digits, colon, "AA", then 35 alphanumeric/dash/underscore chars
|
|
entry: '\d{9,10}:AA[A-Za-z0-9_-]{35}'
|
|
language: pygrep
|
|
types: [text]
|
|
exclude: '^\.pre-commit-config\.yaml$'
|