Security Guide
Best practices for securing your OpenQA deployment in production.
⚠️ Important
OpenQA has access to your application and can execute tests. Proper security configuration is critical.
Authentication
OpenQA uses JWT-based authentication with httpOnly cookies:
- First-time setup: Create admin account at
/setup - Login: Authenticate at
/login - Session: JWT stored in httpOnly cookie (7 days)
- Roles: Admin and User roles with different permissions
JWT Secret
Generate a strong secret for production:
bash
1# Generate a 64-character hex secret2openssl rand -hex 323 4# Set in environment5OPENQA_JWT_SECRET=your-generated-secret🔑 Secret Requirements
- • Minimum 32 characters (64 recommended)
- • Use cryptographically random generation
- • Never commit to version control
- • Rotate periodically
Never Disable Authentication
bash
1# ❌ NEVER do this in production2OPENQA_AUTH_DISABLED=true3 4# ✅ Always keep authentication enabled5OPENQA_AUTH_DISABLED=false # or just don't set itHTTPS / SSL
Always use HTTPS in production:
Using Certbot (Let's Encrypt)
bash
1# Install Certbot2sudo apt install certbot3 4# Get certificate5sudo certbot certonly --standalone -d your-domain.com6 7# Certificates are stored at:8# /etc/letsencrypt/live/your-domain.com/fullchain.pem9# /etc/letsencrypt/live/your-domain.com/privkey.pemNginx SSL Configuration
bash
1server {2 listen 443 ssl http2;3 server_name your-domain.com;4 5 ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;6 ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;7 8 # Modern SSL configuration9 ssl_protocols TLSv1.2 TLSv1.3;10 ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;11 ssl_prefer_server_ciphers off;12 13 # Security headers14 add_header X-Frame-Options "SAMEORIGIN" always;15 add_header X-Content-Type-Options "nosniff" always;16 add_header X-XSS-Protection "1; mode=block" always;17 add_header Strict-Transport-Security "max-age=31536000" always;18 19 location / {20 proxy_pass http://localhost:4242;21 proxy_http_version 1.1;22 proxy_set_header Upgrade $http_upgrade;23 proxy_set_header Connection "upgrade";24 proxy_set_header Host $host;25 proxy_set_header X-Real-IP $remote_addr;26 }27}Rate Limiting
OpenQA includes built-in rate limiting:
- Global API: 300 requests/minute per IP
- Mutations: 30 requests/minute (start, stop, login)
- Login: 5 attempts before lockout
CORS Configuration
bash
1# Restrict to specific origins2CORS_ORIGINS=https://your-domain.com,https://admin.your-domain.com3 4# Or allow all (not recommended for production)5CORS_ORIGINS=*Firewall Rules
bash
1# Allow only HTTP/HTTPS2sudo ufw allow 80/tcp3sudo ufw allow 443/tcp4sudo ufw allow 22/tcp # SSH5sudo ufw enable6 7# Block direct access to OpenQA port (use Nginx proxy)8sudo ufw deny 4242/tcpEnvironment Security
- Set
NODE_ENV=productionto enable security features - Never expose
.envfiles publicly - Use environment variables or secrets management
- Rotate API keys periodically
Security Checklist
- ☐Strong
OPENQA_JWT_SECRET(64+ chars) - ☐Strong admin password (12+ chars, mixed)
- ☐HTTPS enabled with valid SSL certificate
- ☐
NODE_ENV=production - ☐
OPENQA_AUTH_DISABLEDis NOT set to true - ☐CORS origins restricted
- ☐Firewall configured (ports 80, 443 only)
- ☐Regular backups configured
- ☐API keys stored securely (not in code)
- ☐Monitoring and alerting enabled
Incident Response
If you suspect a security breach:
- Immediately rotate
OPENQA_JWT_SECRET - Change all admin passwords
- Rotate LLM API keys
- Review access logs
- Check for unauthorized configuration changes
