Built-in Security Measures
The Pope Bot includes several security measures by default:API Key Authentication
All external/api routes require a valid x-api-key header. Keys are SHA-256 hashed in the database.
Usage:
Webhook Secret Validation
Telegram and GitHub webhook endpoints validate shared secrets. If a secret is not configured, the endpoint rejects all requests (fail-closed). Configuration:Session Encryption
Web sessions use JWT encrypted withAUTH_SECRET, stored in httpOnly cookies.
Setup:
httpOnly flag prevents JavaScript access to the session cookie.
Secret Filtering in Docker Agent
Theenv-sanitizer extension filters AGENT_* secrets from the LLM’s bash subprocess, preventing the agent from accessing protected credentials.
How it works:
- Secrets prefixed with
AGENT_are filtered from the bash environment - Secrets prefixed with
AGENT_LLM_are deliberately left available for skills to use - The agent cannot
echo $AGENT_SECRETto exfiltrate protected values - Skills can access
$AGENT_LLM_BRAVE_API_KEYfor legitimate API calls
Auto-Merge Path Restrictions
Theauto-merge.yml workflow only merges PRs where all changed files fall within ALLOWED_PATHS (default: /logs). Changes outside allowed paths require manual review.
See the Auto-Merge page for details.
Server Actions with Session Checks
All browser-to-server mutations use Next.js Server Actions withrequireAuth(), which validates the session cookie before executing.
Pattern:
Security Disclaimer
We do our best to follow security best practices, but all software carries risk. The Pope Bot is provided as-is, without warranties of any kind. You are responsible for:- Securing your own infrastructure (server, network, DNS)
- Managing your API keys and secrets
- Reviewing agent-generated pull requests before merging outside
/logs - Monitoring your agent’s activity and resource usage
Local Development Risks
When you runnpm run dev and expose your machine to the internet via ngrok, Cloudflare Tunnel, or port forwarding, you are making your development server publicly accessible. This is useful for testing but carries real risks.
What’s Exposed
When your tunnel is active, the following endpoints are reachable from the internet:| Endpoint | Purpose | Auth |
|---|---|---|
/api/create-job | Creates GitHub branches and triggers Docker agent jobs | API key required |
/api/telegram/webhook | Accepts incoming Telegram updates | Webhook secret required |
/api/github/webhook | Accepts GitHub Actions notifications | Webhook secret required |
/api/ping | Health check | None (public) |
/login | Authentication page | None (public) |
/stream/chat | Chat streaming endpoint | Session cookie |
/ (all other routes) | Web chat interface | Session cookie via middleware |
Specific Risks
No Rate Limiting
There is no rate limiting on any endpoint. A determined attacker could:- Spam job creation (burning GitHub Actions minutes and LLM API credits)
- Flood the login page with brute-force attempts
- Overwhelm the webhook endpoints
Local Filesystem Access
The Next.js dev server runs with your user permissions. It has access to your local filesystem through the project directory and any paths thatprocess.cwd() can reach.
Local Network Exposure
npm run dev binds to 0.0.0.0 by default. Other devices on your local network (or anyone on the same Wi-Fi) can reach the dev server directly without going through the tunnel.
No TLS on Dev Server
npm run dev serves plain HTTP. On your local network, API keys, session cookies, and webhook payloads are transmitted in cleartext.
The tunnel itself provides TLS to the public internet, but the local hop between the tunnel agent and your dev server is unencrypted.
Persistent Exposure
Tunnels left running keep all endpoints accessible even when you’re not actively developing. If you step away or close your editor but leave the tunnel up, the endpoints remain live.Development Best Practices
Always Set Webhook Secrets
ConfigureTELEGRAM_WEBHOOK_SECRET and GH_WEBHOOK_SECRET in your .env, even for local development.
Always Set API Keys
Generate an API key through the web UI before exposing your server. Without a valid key,/api/create-job requests are rejected.
Stop Tunnels When Not in Use
Close ngrok or your tunnel when you’re done developing. Don’t leave endpoints exposed overnight.Restrict Telegram to Your Chat
SetTELEGRAM_CHAT_ID in your .env to your personal chat ID. This ensures the bot only responds to messages from your chat, ignoring messages from anyone else who discovers the bot.
Use Docker Compose with TLS for Production
For anything beyond local testing, deploy withdocker compose up and enable Let’s Encrypt TLS. See the Deployment page.
Review Auto-Merge Settings
KeepALLOWED_PATHS restrictive (default /logs). Only widen it after reviewing what your agent might change.
Production Security Checklist
Infrastructure Security
Infrastructure Security
- Server firewall configured (only ports 80, 443, and SSH open)
- SSH key-based authentication (password auth disabled)
- Regular security updates (
apt update && apt upgrade) - Non-root user for running services
- Fail2ban or similar intrusion prevention
Application Security
Application Security
- Strong
AUTH_SECRETgenerated and set - API keys rotated regularly
- Webhook secrets configured
- HTTPS enabled with Let’s Encrypt
-
ALLOWED_PATHSrestrictive (default/logs) - Regular backups of
.envand database
Agent Security
Agent Security
- Protected secrets use
AGENT_prefix (notAGENT_LLM_) - Skill secrets use
AGENT_LLM_prefix for legitimate access - Auto-merge disabled or restricted to safe paths
- Regular review of agent-generated PRs
- Monitoring of agent activity and resource usage
Monitoring
Monitoring
- Log aggregation configured
- Alert on unusual activity (high API usage, failed auth attempts)
- Resource monitoring (CPU, memory, disk)
- Regular review of job logs
Credential Management
Environment Variables
Never commit.env files to version control. Add to .gitignore:
GitHub Secrets
Use GitHub secrets for CI/CD credentials:Rotation Policy
Rotate credentials regularly:- API keys: Every 90 days
- Webhook secrets: Every 180 days
AUTH_SECRET: Every 365 days (invalidates all sessions)
Reporting Security Issues
If you discover a security vulnerability, please report it responsibly:- Do not open a public GitHub issue
- Email security details to the maintainers
- Allow time for a fix before public disclosure
SECURITY_TODOS.md in the repository.