Task #6126
openSECURITY: live Telegram bot token committed in workflow scripts — revoke and move to env
50%
Description
Found while reviewing the stats daemon (parent epic #6116).
Problem¶
A live Telegram bot token is hardcoded in the repository, in the notification curl calls:
-
scripts/workflow/update_stats.sh— appears in everyapi.telegram.org/bot<token>/sendMessageurl in the loop (10 occurrences) -
sdlc/0-vibes/raw/2026-08-26/slow_ daemon.md— the pasted copy of the daemon carries the same token
The target chat id is hardcoded alongside it.
Anyone with repository access — and anyone who ever had it, since it is in git history — can post as this bot, read what it can read, and change its webhook.
Actions¶
-
Revoke the token via @BotFather (
/revoke) and issue a new one. Do this first; everything below is cleanup that does not help until the old token is dead. - Move the new token and the chat id into environment variables (e.g.
TELEGRAM_NOTIFY_TOKEN,TELEGRAM_NOTIFY_CHAT_ID) read by the scripts, supplied by the deployment environment. - Redact the token in the vibes file — it is a raw capture and stays in the pipeline, so replace the value with a placeholder rather than deleting the file.
- Decide whether to purge git history. Given the token will already be revoked, this is optional and disruptive; note the decision either way.
Also in the same sweep¶
scripts/workflow/download_trading_point_inspections.sh contains a line of accidental keyboard input committed into a comment (#./jdk-21.0.1/bino8i7a SDFGTYHUIO90PQ …). Harmless but should be cleaned up while the scripts are being touched.
Updated by Redmine Admin about 9 hours ago
- Status changed from New to Feedback
- % Done changed from 0 to 50
Код почищен, ветка speedup/stats-daemon, коммит 50a6ebef. Главное — отзыв токена — не сделано и сделано быть не может отсюда: это действие в @BotFather. До него всё остальное бесполезно.
Сделано:
- новый
scripts/workflow/notify.shс функциейnotify(), берущейTELEGRAM_NOTIFY_TOKENиTELEGRAM_NOTIFY_CHAT_IDиз окружения. Если переменные не заданы, сообщение просто печатается в stdout и работа продолжается; -
update_stats.shпереписан на неё, зашитых токена и chat id в нём больше нет; - в сыром снимке
sdlc/0-vibes/raw/2026-08-26/slow_ daemon.mdтокен и chat id заменены на плейсхолдеры, сверху добавлен комментарий со ссылкой на эту задачу. Файл не удалён — это raw-捕 капча, она остаётся в пайплайне; - мусорная строка (
#./jdk-21.0.1/bino8i7a SDFGTYHUIO90PQ …) изdownload_trading_point_inspections.shубрана; - заодно
IikoRequestLogService.redactперестал складывать ключ сессии iiko (?key=...) вiiko_requests, аIikoAuthTokensFetchingService— печатать сам токен в лог (см. #6121, #6122).
Что нужно сделать руками:
-
/revokeв @BotFather, выпустить новый токен. - Прописать
TELEGRAM_NOTIFY_TOKENиTELEGRAM_NOTIFY_CHAT_IDв окружении демона на сервере — иначе после выкатки уведомления молча перестанут приходить (шаги при этом продолжат работать). - Решить, чистить ли историю git. Токен к тому моменту будет мёртв, так что это опционально.
Ещё одна находка, того же рода. В build.gradle.kts:19-26 в открытом виде лежат логин и пароль к maven-репозиторию pm.skobeltsyn.com:5400. Это отдельный секрет и отдельный отзыв — стоит завести под него свою задачу, я её не создавал, чтобы не решать за вас, что с ним делать.