If you discover a security vulnerability in this project, please help us by reporting it responsibly.
DO NOT create a public GitHub issue for security vulnerabilities.
Instead, please report security issues by:
- GitHub Security Advisory: Use the Security Advisory feature (preferred)
- Direct Contact: Contact @TheHolyOneZ directly through GitHub
Please include the following information in your report:
- Description: Clear description of the vulnerability
- Impact: What could an attacker do with this vulnerability?
- Reproduction: Step-by-step instructions to reproduce
- Affected Versions: Which versions are affected?
- Suggested Fix: If you have ideas for fixing it (optional)
- Your Contact: How we can reach you for follow-up
- Acknowledgment: We'll acknowledge your report within 48 hours
- Updates: We'll keep you informed about progress
- Credit: With your permission, we'll credit you in the fix announcement
- Timeline: We aim to address critical issues within 7 days
When using this bot framework, follow these security guidelines:
# β
CORRECT: Store in .env file (add to .gitignore)
DISCORD_TOKEN=your_token_here
# β NEVER do this:
# - Hardcode tokens in code
# - Commit .env to git
# - Share tokens publicly
# - Post tokens in screenshots# Only enable intents you actually need
intents = discord.Intents.default()
intents.message_content = True # Only if needed
# Don't use Intents.all() in production unless necessary# Always validate and sanitize user input
@commands.command()
async def example(ctx, user_input: str):
# Validate input
if len(user_input) > 100:
await ctx.send("Input too long!")
return
# Sanitize if needed
safe_input = user_input.strip()# Always check permissions for sensitive commands
@commands.command()
@commands.has_permissions(administrator=True)
async def sensitive_command(ctx):
await ctx.send("Admin only!")# Implement cooldowns to prevent abuse
@commands.command()
@commands.cooldown(1, 5, commands.BucketType.user)
async def limited_command(ctx):
await ctx.send("Rate limited command!")# Regularly update dependencies
pip install --upgrade discord.py
pip install --upgrade python-dotenv- Run the bot with minimal privileges
- Don't run as root/administrator
- Use a dedicated user account
- Keep your system updated
- Regularly check
botlogs/for suspicious activity - Set up alerts for critical errors
- Rotate logs to prevent disk space issues
If you're contributing to this project:
- Add
.envto.gitignore - Use environment variables for all secrets
- Review commits before pushing
- Never trust user input
- Validate types, lengths, and formats
- Sanitize data before processing
# Validate file paths
import os
def safe_file_read(filename):
# Prevent directory traversal
if ".." in filename or "/" in filename:
raise ValueError("Invalid filename")
safe_path = os.path.join("./extensions", filename)
# Read file safely# Don't expose sensitive info in errors
try:
# risky operation
pass
except Exception as e:
logger.error(f"Error: {e}")
# Don't send full error to user
await ctx.send("An error occurred")Your Discord bot token is like a password. If compromised:
- Attackers can control your bot
- They can access all servers your bot is in
- They can read messages (if intents enabled)
If your token is compromised:
- Regenerate it immediately in Discord Developer Portal
- Update your
.envfile - Review bot logs for suspicious activity
- Consider rotating all related credentials
This framework uses Intents.all() by default for simplicity. In production:
- Only enable intents you need
- Request minimal permissions
- Regularly audit what data your bot accesses
Extensions run with full bot privileges:
- Only load trusted extensions
- Review extension code before using
- Keep extensions updated
- Be cautious with third-party extensions
Before deploying your bot:
- Bot token stored in
.envfile -
.envadded to.gitignore - Using minimal required intents
- Permission checks on sensitive commands
- Rate limiting implemented
- Input validation in place
- Error handling doesn't expose secrets
- Logging configured properly
- Dependencies are up to date
- Running with non-root privileges
We take security seriously. When security issues are found:
- We'll patch them as quickly as possible
- Release a security advisory
- Update affected versions
- Notify users through GitHub
We provide security updates for:
- Latest release version
- Previous major version (when applicable)
We appreciate responsible disclosure and the security community's help in keeping this project safe.
Remember: Security is everyone's responsibility! π