Access Control (Whitelists)
The most effective way to secure your bot is to strictly limit who can use it.User Whitelist
UseUSERS_WHITELIST to specify exactly which Telegram users are allowed to interact with the bot.
- By ID (Recommended):
123456789,987654321 - By Username:
@myusername,@friend
Group Whitelist
If you add the bot to a group, useGROUPS_WHITELIST to ensure it only responds in authorized groups.
Privacy & Behavior Flags
Fine-tune how the bot behaves in public or shared spaces.ANSWER_DIRECT_MESSAGES_ONLY
- Default:
True - Effect: If set to
True, the bot will ignore messages in groups unless that specific group is in theGROUPS_WHITELIST. It will still respond to direct messages (DMs) from whitelisted users. - Use Case: Prevents the bot from being spammy or used by others if you accidentally add it to a public group.
ALLOW_BOTS
- Default:
False - Effect: If set to
False, Chibi will ignore all messages sent by other bots. - Use Case: Prevents infinite loops where two bots keep replying to each other. Keep this disabled unless you have a specific reason.
Pre-start Security Checks
Chibi 1.6.1+ includes automatic security validations that run before the bot starts. These checks prevent dangerous configurations that could lead to security vulnerabilities.What Gets Checked
| Check | Condition | Action |
|---|---|---|
| Private Mode Whitelist | PUBLIC_MODE=False without USERS_WHITELIST | Blocks startup - You must specify authorized users |
| Public + Filesystem | PUBLIC_MODE=True with FILESYSTEM_ACCESS=True | Blocks startup - Too risky for public access |
| Filesystem in Groups | FILESYSTEM_ACCESS=True with group usage | Shows warning - Consider if needed |
Why These Checks Matter
- Prevent Unauthorized Access: Without a user whitelist in private mode, anyone who knows your bot’s username could interact with it and use your API credits.
- Protect Sensitive Data: Public bots with filesystem access could allow malicious users to read sensitive files from your server.
- Reduce Accidental Exposure: The warning for filesystem access in groups helps you reconsider before enabling potentially risky configurations.
Best Practices
- Never share your
.envfile. It contains your API keys and bot token. - Use IDs over Usernames. Usernames can be changed; IDs are permanent. You can find your ID using bots like
@userinfobot. - Review Logs. Periodically check your logs for “Unauthorized access attempt” messages to see if strangers are trying to use your bot.
- Always configure
USERS_WHITELISTin private mode - Chibi will prevent starting without it. - Never enable
FILESYSTEM_ACCESSin public mode - this is blocked by security checks. - Keep
ALLOW_BOTS=Falseunless specifically needed to prevent bot-to-bot loops.

