Overview
Integrity Modes are ChameleonDB’s answer to the question: Who has authority to change the schema? Unlike traditional databases where schema authority is implicit, ChameleonDB enforces it through four protection rings with password-protected escalation.Integrity Modes work in conjunction with the Schema Vault to provide complete schema governance.
The Four Modes
| Mode | Ring | Use Case | Schema Changes | Password Required |
|---|---|---|---|---|
| readonly | R3 | Production (default) | ❌ Blocked | Upgrade: Yes |
| standard | R2 | Development teams | ✅ Controlled | Upgrade: Yes |
| privileged | R1 | DBAs | ✅ Direct (logged) | Upgrade: Yes |
| emergency | R0 | Incident recovery | ✅ No checks (audited) | Upgrade: Yes |
Downgrading modes (e.g., privileged → standard → readonly) does not require a password. Only upgrades require authentication.
Mode Details
readonly (R3)
Default mode for production environments.- ❌ All schema modifications are blocked
- ✅ Queries and data operations work normally
- ✅ Integrity verification runs on every operation
- 🔒 Schema is completely locked
- Production deployments
- Environments where schema should never change
- Compliance-sensitive systems
- Read-only replicas
standard (R2)
Recommended for development teams.- ✅ Controlled schema changes allowed
- ✅ Migrations go through normal validation
- ✅ All changes logged to integrity.log
- ✅ Vault verification still enforced
- Development environments
- Testing environments
- CI/CD pipelines
- Team collaboration
privileged (R1)
For database administrators with direct access.- ✅ Direct schema modifications (still logged)
- ✅ Bypass some validation checks
- ✅ Emergency fixes without full pipeline
- ⚠️ All operations heavily audited
- DBA operations
- Hotfixes
- Schema repairs
- Advanced troubleshooting
emergency (R0)
For incident recovery only.- ✅ All safety checks disabled
- ✅ Direct database access
- ✅ Skip integrity verification (emergency only)
- 🚨 Everything is audited
- Production incidents
- Vault corruption recovery
- Emergency rollbacks
- Disaster recovery
Password Protection
Setting a Password
Protect mode upgrades with a password:The password is hashed and stored in
.chameleon/vault/auth.json. Never commit this file to version control.Mode Upgrades
Upgrades always require the password:Mode Downgrades
Downgrades do not require a password:Checking Current Mode
View the current mode withchameleon status:
chameleon config get mode:
Mode Enforcement
Modes are enforced at runtime by the ChameleonDB engine:Mode checks happen before any database operations. Failed checks abort immediately.
Audit Trail
All mode changes are logged tointegrity.log:
Common Workflows
Development Workflow
Production Deployment
Emergency Recovery
Security Model
Integrity Modes are part of ChameleonDB’s multi-layered security:- OS Permissions - File access control
- Hash Integrity - SHA256 tamper detection
- Integrity Modes ← Runtime access control (this page)
- Vault Enforcement - No schema bypass
- Audit Trail - Complete forensics
Best Practices
- Always set a mode password - Even in development
- Use readonly in production - Default to most restrictive
- Minimize privileged mode use - Only when necessary
- Never stay in emergency mode - Return to readonly immediately
- Review integrity.log regularly - Monitor mode changes
- Document mode changes - Track why and when modes changed
- Rotate passwords periodically - Especially after personnel changes
Commands
Comparison with Traditional Systems
| Traditional DB | ChameleonDB Integrity Modes |
|---|---|
| ❌ Implicit authority | ✅ Explicit ring-based modes |
| ❌ No runtime enforcement | ✅ Enforced by engine |
| ❌ Anyone with DB access can ALTER | ✅ Password-protected escalation |
| ❌ No mode audit trail | ✅ All changes logged |
| ❌ Manual governance | ✅ Built into platform |
Next Steps
- Learn about the Schema Vault that Integrity Modes protect
- Understand the Schema Language
- Explore the Architecture