Repository navigation
Secrets Management
Canonical source:
docs/08-runtime-devops/secrets-management.md— this page is rendered from it on every publish; edit the source.
Encryption keys, JWT secrets, API key encryption, and security practices.
| Secret | Location | Purpose | Format |
|---|---|---|---|
JWT_SECRET |
.env |
Signs JWT access and refresh tokens | 64 hex chars |
ENCRYPTION_KEY |
.env |
AES-256-GCM encryption for API keys | 64 hex chars |
PLUGIN_ENCRYPTION_KEY |
.env |
AES-256-GCM over MCP credentials stored by plugin-service (separate from ENCRYPTION_KEY; changing it orphans them) |
64 hex chars |
ADMIN_PASSWORD |
.env |
Default admin user password | String |
PG_*_PASSWORD |
.env |
PostgreSQL database passwords (x9) | String |
MONGO_PASSWORD |
.env |
MongoDB root password | String |
RABBITMQ_DEFAULT_PASS |
.env |
RabbitMQ broker password | String |
| Connector API keys | PostgreSQL | Cloud provider API keys (encrypted) | AES-256-GCM blob |
JWT_SECRET=<64-character-hex-string>
JWT_ACCESS_EXPIRY=15m # Access token lifetime
JWT_REFRESH_EXPIRY=7d # Refresh token lifetime# Linux/macOS
openssl rand -hex 32
# Node.js
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
# Windows PowerShell
[System.BitConverter]::ToString((New-Object System.Security.Cryptography.RNGCryptoServiceProvider).GetBytes(32)).Replace('-','').ToLower()- Access tokens: Short-lived (15m default), signed with HMAC-SHA256
-
Refresh tokens: Longer-lived (7d default), stored in
sessionstable - Rotation: Each refresh request invalidates the old token and issues a new pair
- Password hashing: Argon2id (not related to JWT_SECRET but part of auth security)
- JWT_SECRET must be the same across all services that validate tokens (auth-service signs, all others verify)
- Changing JWT_SECRET invalidates all existing tokens (users must re-login)
- Never commit JWT_SECRET to version control
Cloud provider API keys (OpenAI, Anthropic, Google, etc.) are encrypted at rest using AES-256-GCM:
User provides API key
--> connector-service encrypts with ENCRYPTION_KEY
--> Stored as encrypted blob in PostgreSQL (encryptedConfig column)
--> Decrypted only when making API calls to the provider
ENCRYPTION_KEY=<64-character-hex-string>The ENCRYPTION_KEY is 32 bytes (64 hex characters) for AES-256.
| Property | Value |
|---|---|
| Algorithm | AES-256-GCM |
| Key length | 256 bits (32 bytes / 64 hex chars) |
| IV (nonce) | 12 bytes, randomly generated |
| Auth tag | 16 bytes |
| Storage format | IV + encrypted data + auth tag |
To rotate the ENCRYPTION_KEY:
- Decrypt all existing connector configs with the old key
- Re-encrypt with the new key
- Update
.envwith the new key - Restart the connector-service
There is no built-in rotation command; this must be done manually or via a migration script.
Each database has its own credentials:
PG_AUTH_PASSWORD=claw_secret # Auth database
PG_CHAT_PASSWORD=claw_secret # Chat database
PG_CONNECTOR_PASSWORD=claw_secret # Connector database
PG_ROUTING_PASSWORD=claw_secret # Routing database
PG_MEMORY_PASSWORD=claw_secret # Memory database
PG_FILES_PASSWORD=claw_secret # Files database
PG_OLLAMA_PASSWORD=claw_secret # Ollama database
PG_IMAGES_PASSWORD=claw_secret # Images database
PG_FILE_GEN_PASSWORD=claw_secret # File generations databaseProduction: Each database should have a unique, strong password.
MONGO_USER=claw
MONGO_PASSWORD=claw_secretUsed for three databases: claw_audit, claw_client_logs, claw_server_logs.
RABBITMQ_DEFAULT_USER=claw
RABBITMQ_DEFAULT_PASS=claw_secretPino is configured to redact sensitive fields from all log output:
redact: ['authorization', 'password', 'refreshToken', 'apiKey', 'token', 'secret'];Any log entry containing these field names will have the value replaced with [REDACTED].
- HTTP Authorization headers
- Password fields in request bodies
- Refresh tokens in auth responses
- API keys in connector configurations
- Any field named
tokenorsecret
-
No
console.log-- ESLint enforced; onlyconsole.warnandconsole.error - No secrets in localStorage -- only auth tokens (with security note in code)
- No NEXT_PUBLIC_ secrets -- only non-sensitive config uses NEXT_PUBLIC_ prefix
- X-Request-ID -- uses random UUIDs, no sensitive data
All NestJS services use @nestjs/throttler and Helmet security headers:
- Rate limiting: 100 requests per 60 seconds (configurable via THROTTLE_TTL/THROTTLE_LIMIT)
- CORS: Restricted to origins in CORS_ORIGINS env var
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 0
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()-
Never commit
.envto version control (listed in.gitignore) -
.env.examplecontains placeholder values for documentation - Each developer generates their own
.envfrom.env.example
All services use env_file: .env which passes the entire .env file to each container. In production, consider:
- Using Docker secrets or a vault (HashiCorp Vault, AWS Secrets Manager)
- Injecting secrets via orchestrator (Kubernetes secrets, ECS task definitions)
- Using environment-specific
.envfiles (.env.production,.env.staging)
- JWT_SECRET is a unique, randomly generated 64-character hex string
- ENCRYPTION_KEY is a unique, randomly generated 64-character hex string
- All database passwords are unique and strong
- ADMIN_PASSWORD is changed from default
- CORS_ORIGINS is restricted to your domain
-
.envis not committed to version control - SSL/TLS is configured for all external traffic
- RabbitMQ Management UI (port 15672) is not exposed publicly
- Database ports (5441-5449, 27018) are not exposed publicly
- Redis port (6380) is not exposed publicly
- Rate limiting is configured appropriately for production traffic
ClawAI Wiki · source-controlled under wiki/ · generated/mirrored from the current repository knowledge layer.
ClawAI Wiki
Product
- Product-Vision
- Flagship-Features
- Business-Overview
- Requirements-Register
- Drift-Log
- Runtime-Managed-Connector-Providers
- Threads
- ADR-Index
Architecture
- System-at-a-Glance
- Architecture-Map
- System-Architecture
- Message-Flow
- End-to-End-Data-Flow
- Routing-Engine
- Event-Bus
- Security-Architecture
Platform
- Backend-Services
- Frontend-Architecture
- Shared-Packages
- Database-Reference
- API-Reference
- Provider-Catalog
- Memory-and-Context-Architecture
- File-Support-Architecture
- Research-and-Web-Crawling
Runtime & Ops
- Docker-Guide
- Nginx-Reference
- CI-CD-Pipeline
- Logging-and-Observability
- Operational-Runbooks
- Troubleshooting
Quality
Engineering OS
- AI-Native-Engineering-OS
- Generated-Manifests
- Rules-Catalog
- Skills-Catalog
- Context-Layer
- Engineering-Memory
- Tooling-and-Automation
- Scripts-and-Operations
- ESLint-and-Architecture-Enforcement
- Extended-Work-Skills
Agents
Reference