Authentication
Mission Control supports multiple authentication methods:Session-Based Authentication
The primary authentication method uses secure HTTP-only cookies with cryptographically random session tokens. Login flow:- User submits credentials to
/api/auth/login - Server validates credentials using constant-time comparison (timing attack prevention)
- On success, creates session token (32-byte random hex) with 7-day expiration
- Returns
mc-sessioncookie withhttpOnly,secure(in production), andsameSite=strictflags - Subsequent requests include session cookie for authentication
- Cryptographic randomness: Uses Node.js
crypto.randomBytes(32)for unpredictable tokens - Automatic expiration: Sessions expire after 7 days
- Cleanup: Expired sessions are purged on new session creation
- IP & User-Agent tracking: Sessions log IP address and user agent for audit trails
API Key Authentication
For headless/programmatic access, use API key authentication:- Constant-time comparison: Uses
crypto.timingSafeEqual()to prevent timing attacks - Admin privileges: API key grants full admin access (synthetic user with
role: 'admin') - Single key: One API key per instance (rotate regularly)
Google OAuth (Optional)
Mission Control supports Google Sign-In with approval workflow:- User clicks “Sign in with Google”
- Google OAuth flow validates user identity
- Admin approval required: New Google users are created with
is_approved=0 - Admin approves user via UI or API
- User can then access the dashboard
Role-Based Access Control (RBAC)
Mission Control implements a three-tier role hierarchy:| Role | Level | Permissions |
|---|---|---|
| viewer | 0 | Read-only access to dashboards, logs, and metrics |
| operator | 1 | Viewer permissions + trigger pipelines, manage agents, modify configurations |
| admin | 2 | Operator permissions + user management, system settings, API key access |
requireRole() to enforce minimum role requirements:
Managing Users
Admins can manage users via the UI or API:Password minimum length: 12 characters (enforced in src/lib/auth.ts:208)
Network Access Control
Mission Control implements default-deny host-based access control in production environments.How It Works (src/proxy.ts:56-70)
- Development (
NODE_ENV !== 'production'): All hosts allowed by default - Production (
NODE_ENV === 'production'): Only hosts matchingMC_ALLOWED_HOSTSpatterns are allowed - Override: Set
MC_ALLOW_ANY_HOST=trueto disable (not recommended in production)
Allowed Host Patterns
Supports flexible pattern matching (src/proxy.ts:28-46):| Pattern | Example | Matches | Does NOT Match |
|---|---|---|---|
| Exact host | app.example.com | app.example.com | api.example.com, app.example.com:8080 |
| Subdomain wildcard | *.example.com | api.example.com, app.example.com | example.com (bare domain) |
| Prefix wildcard | 100.* | 100.64.0.1, 100.100.100.100 | 10.0.0.1 |
localhostand127.0.0.1(local development/testing)mc.example.com(production domain)api.internal.example.com,dashboard.internal.example.com(internal subdomains)100.64.0.1,100.100.100.100(Tailscale IP range)
CSRF Protection
Mission Control validates theOrigin header for state-changing requests (src/proxy.ts:74-88):
- Validates
Originheader matchesHostheader for POST/PUT/DELETE/PATCH requests - Prevents cross-site request forgery attacks
- Works automatically with modern browsers
Security Headers
All responses include security headers (src/proxy.ts:48-53):| Header | Value | Purpose |
|---|---|---|
X-Content-Type-Options | nosniff | Prevent MIME type sniffing attacks |
X-Frame-Options | DENY | Prevent clickjacking (no iframe embedding) |
Referrer-Policy | strict-origin-when-cross-origin | Limit referrer information leakage |
TLS / HTTPS
Enable Secure Cookies
When serving over HTTPS, enable secure cookies:Secure flag on session cookies, preventing transmission over unencrypted HTTP.
Default behavior:
- Production (
NODE_ENV=production):secure=trueunless explicitly set tofalse - Development:
secure=false(allows testing over HTTP)
Reverse Proxy TLS Termination
See Production Deployment - Reverse Proxy Configuration for Nginx/Caddy/Traefik examples with:- TLS 1.2/1.3 only
- Strong cipher suites
- HSTS (Strict-Transport-Security)
- HTTP to HTTPS redirect
Password Security
Mission Control uses industry-standard password hashing:- Algorithm: Argon2id (via
@node-rs/argon2or fallback to bcrypt) - Verification: Constant-time comparison to prevent timing attacks
- Minimum length: 12 characters (enforced at user creation)
AUTH_PASS contains #, use one of these methods:
Secrets Management
Best Practices
-
Use environment-specific files:
- Development:
.env.local - Production:
.envor secret management service
- Development:
-
Rotate credentials regularly:
-
Use secret management services:
- Docker Swarm: Docker Secrets
- Kubernetes: Sealed Secrets or External Secrets Operator
- Cloud: AWS Secrets Manager, Azure Key Vault, Google Secret Manager
-
Restrict file permissions:
1Password Integration
Mission Control supports pulling secrets from 1Password CLI:Gateway Security
Device Identity & WebCrypto
Mission Control uses WebCrypto for device identity signing when connecting to gateways:Device identity requires a secure context (HTTPS or localhost).If you see “Gateway error: device identity required”, ensure Mission Control is served over HTTPS.
Gateway Origin Allowlist
Configure your OpenClaw gateway to allow Mission Control origins:openclaw.json
Audit Logging
Mission Control logs security-relevant events:- User authentication: Login attempts, session creation/destruction
- User management: User creation, role changes, deletions
- API access: API key usage with IP address and user agent
- Configuration changes: System settings modifications
Security Checklist
Authentication
- Set strong
AUTH_PASS(min 12 characters, high entropy) - Generate secure
API_KEYwithopenssl rand -hex 32 - Rotate credentials on initial deployment
- Enable Google OAuth approval workflow if using SSO
Network Security
- Configure
MC_ALLOWED_HOSTSto restrict access - Deploy behind reverse proxy (Nginx/Caddy)
- Enable TLS with valid certificates (Let’s Encrypt)
- Set
MC_COOKIE_SECURE=truefor HTTPS - Configure firewall to allow only necessary ports
Access Control
- Assign users appropriate roles (viewer/operator/admin)
- Regularly review user list and remove inactive accounts
- Use API key only for automation (not humans)
- Enable 2FA for admin accounts (if using Google OAuth)
Data Protection
- Restrict
.envfile permissions (chmod 600) - Keep
.envout of version control - Use secret management service in production
- Configure audit log retention (
MC_RETAIN_AUDIT_DAYS=365)
Reporting Vulnerabilities
If you discover a security vulnerability in Mission Control:Additional Resources
- Environment Variables - Complete configuration reference
- Docker Deployment - Container security best practices
- Production Deployment - Infrastructure hardening