Project

General

Profile

Actions

Task #6126

open

SECURITY: live Telegram bot token committed in workflow scripts — revoke and move to env

Added by Redmine Admin about 9 hours ago. Updated about 9 hours ago.

Status:
Feedback
Priority:
Immediate
Assignee:
-
Start date:
08/26/2026
Due date:
% Done:

50%

Estimated time:

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 every api.telegram.org/bot<token>/sendMessage url 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

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Actions #1

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).

Что нужно сделать руками:

  1. /revoke в @BotFather, выпустить новый токен.
  2. Прописать TELEGRAM_NOTIFY_TOKEN и TELEGRAM_NOTIFY_CHAT_ID в окружении демона на сервере — иначе после выкатки уведомления молча перестанут приходить (шаги при этом продолжат работать).
  3. Решить, чистить ли историю git. Токен к тому моменту будет мёртв, так что это опционально.

Ещё одна находка, того же рода. В build.gradle.kts:19-26 в открытом виде лежат логин и пароль к maven-репозиторию pm.skobeltsyn.com:5400. Это отдельный секрет и отдельный отзыв — стоит завести под него свою задачу, я её не создавал, чтобы не решать за вас, что с ним делать.

Actions

Also available in: Atom PDF