| Version | Supported |
|---|---|
| 1.0.x | ✅ |
If you discover a security vulnerability, please report it by creating a private issue or contacting the maintainer directly.
Please do not open public issues for security vulnerabilities.
-
Owner-only access: The bot uses middleware (
auth.ts) that checksctx.from.id === OWNER_CHAT_IDto ensure only the configured owner can interact with the bot. -
GramJS Session: The userbot session is stored as a string in
.env. This session provides full access to your Telegram account.- Never share your session string
- Never commit
.envto version control - If you suspect session compromise, revoke all sessions in Telegram settings
-
Environment Variables: All secrets are stored in
.env:BOT_TOKEN— Bot API tokenTELEGRAM_API_HASH— MTProto API hashTELEGRAM_SESSION— GramJS session stringYANDEX_API_KEY— YandexGPT API key (if used)
-
Database: PostgreSQL connection string in
DATABASE_URLmay contain credentials.- Use a dedicated database user with minimal privileges
- Enable SSL for remote connections
-
XSS Prevention: All user-generated content (channel titles, message text) is escaped using
escapeHtml()informatter.tsbefore being sent as HTML. -
SQL Injection: Prisma ORM handles query parameterization automatically. Raw SQL is not used.
-
Telegram MTProto: The collector uses a 1.5-second delay between channel requests to avoid rate limiting and account restrictions.
-
AI Providers: No built-in rate limiting for AI API calls. Consider adding if you process large volumes.
| Risk | Severity | Mitigation |
|---|---|---|
| Session leakage | High | Keep .env secure, use .gitignore |
| Account ban | Medium | Respect rate limits, avoid spam-like behavior |
| Database exposure | Medium | Use strong passwords, enable SSL |
| AI prompt injection | Low | AI summaries are user-facing only |
-
Run security audit:
npm audit
-
Verify
.gitignoreincludes:.env*.sessionnode_modules/
-
Check no secrets in git history:
git log --all --full-history -- "*.env"
- Monitor bot logs for unusual activity
- Regularly update dependencies
- Use a separate Telegram account for the userbot if possible
- Back up your database regularly
- Immediately revoke the bot token via @BotFather
- Revoke all Telegram sessions in Settings → Devices
- Regenerate API credentials on my.telegram.org
- Change database passwords
- Audit collected data for unauthorized access
This project uses:
- Telegraf — Popular Telegram Bot framework
- GramJS (telegram) — MTProto client
- Prisma — Type-safe ORM with built-in SQL injection protection
- OpenAI SDK — For LM Studio compatibility
All dependencies are from npm and should be regularly updated.
For future web interface (v2.0), ensure:
- HTTPS only
- CSP headers
- CSRF protection
- Rate limiting on API endpoints