Skip to content

fix(auth): require bot secret for Telegram bot token exchange - #144

Merged
dzhhem merged 1 commit into
masterfrom
fix/bot-exchange-secret
Oct 1, 2026
Merged

dzhhem merged 1 commit into
masterfrom
fix/bot-exchange-secret

Conversation

@dzhhem

@dzhhem dzhhem commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

What

Require a shared BOT_API_SECRET (X-Bot-Secret header) for the bot source of /auth/telegram/exchange; untrack generated apps/web/next-env.d.ts.

Why

The bot exchange issued tokens for a bare telegramId with no proof of the caller - it must only be reachable by our bot. Missing source now returns 400 instead of defaulting to bot. next-env.d.ts is regenerated by Next on every dev/build run and kept showing up as a change; check-types now runs next typegen first so it still passes on a clean clone.

Deploy: set BOT_API_SECRET (same value) in Render and in ~/bot.env on the VM before merging - api and bot refuse to boot without it.

Testing

New auth integration cases (no header, wrong header, missing source, valid secret); pnpm check, pnpm check-types, test:api:light, test:bot pass. Web check-types verified without next-env.d.ts and .next.

@dzhhem
dzhhem requested a review from BODMAT as a code owner October 1, 2026 13:02
@vercel

vercel Bot commented Oct 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
fintrack-web Ready Ready Preview Oct 1, 2026 1:02pm UTC

@dzhhem
dzhhem merged commit 2650ccd into master Oct 1, 2026
14 checks passed
@dzhhem
dzhhem deleted the fix/bot-exchange-secret branch October 1, 2026 14:23

This branch was successfully deployed

1 active deployment
Preview – fintrack-web — f1b9fb9c Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants