Skip to main content
Integrity Modes provide ring-based access control for schema governance in ChameleonDB. Inspired by Unix protection rings, they enforce explicit authority over schema changes at runtime.

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

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
Use cases:
  • Production deployments
  • Environments where schema should never change
  • Compliance-sensitive systems
  • Read-only replicas
Example:
readonly mode is the fail-safe default. Even if no password is set, schema changes are blocked.

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
Use cases:
  • Development environments
  • Testing environments
  • CI/CD pipelines
  • Team collaboration
Example:

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
Use cases:
  • DBA operations
  • Hotfixes
  • Schema repairs
  • Advanced troubleshooting
Example:
privileged mode should be used sparingly and only by authorized DBAs. All operations are logged.

emergency (R0)

For incident recovery only.
  • ✅ All safety checks disabled
  • ✅ Direct database access
  • ✅ Skip integrity verification (emergency only)
  • 🚨 Everything is audited
Use cases:
  • Production incidents
  • Vault corruption recovery
  • Emergency rollbacks
  • Disaster recovery
Example:
emergency mode disables integrity checks. Use only during incidents. Return to a safer mode immediately after 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 with chameleon status:
Or use 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 to integrity.log:

Common Workflows

Development Workflow

Production Deployment

Emergency Recovery

Security Model

Integrity Modes are part of ChameleonDB’s multi-layered security:
  1. OS Permissions - File access control
  2. Hash Integrity - SHA256 tamper detection
  3. Integrity Modes ← Runtime access control (this page)
  4. Vault Enforcement - No schema bypass
  5. Audit Trail - Complete forensics

Best Practices

  1. Always set a mode password - Even in development
  2. Use readonly in production - Default to most restrictive
  3. Minimize privileged mode use - Only when necessary
  4. Never stay in emergency mode - Return to readonly immediately
  5. Review integrity.log regularly - Monitor mode changes
  6. Document mode changes - Track why and when modes changed
  7. Rotate passwords periodically - Especially after personnel changes

Commands

Comparison with Traditional Systems

Next Steps