Skip to main content
The Schema Vault uses SHA256 cryptographic hashing to ensure schema versions remain immutable and detect any tampering.

Vault Structure

The vault stores versioned schemas with cryptographic integrity:
The vault is automatically created when you run chameleon init for the first time.

How Hash Integrity Works

1. Schema Registration

When you apply a migration, ChameleonDB registers the schema version:
What happens internally:
  1. Schema content saved to versions/v002.json
  2. SHA256 hash computed from the JSON content
  3. Hash saved to hashes/v002.hash
  4. Manifest updated with new version metadata
  5. Event logged to integrity.log

2. Automatic Verification

Before every operation, ChameleonDB verifies integrity:
Verification process:

3. Tamper Detection

If someone modifies a vault file, the hash check fails:
When an integrity violation is detected, all schema operations are immediately blocked until the issue is resolved.

manifest.json Structure

The manifest tracks all registered versions:

Version Snapshots

Each version file contains a complete schema snapshot: versions/v001.json:
Version files are immutable. Once written, they should never be modified. Any modification is detected as tampering.

integrity.log (Audit Trail)

All vault operations are logged:
Log format:
Event types:
  • INIT - Vault creation
  • REGISTER - New version registered
  • MIGRATE - Migration applied
  • VERIFY - Integrity verification
  • MODE_CHANGE - Integrity mode changed
  • VIOLATION - Integrity violation detected
The integrity.log file is append-only. It should never be modified or deleted. Monitor this file for unexpected entries.

Verifying Vault Integrity

Manual Verification

View Version History

View Specific Version

Integrity Violation Recovery

If tampering is detected:

Step 1: Identify the Issue

Step 2: Review Integrity Log

Step 3: Restore from Backup

Always maintain backups of .chameleon/vault/ in version control or secure storage.

Step 4: Investigate Access

Check who modified the files:

Step 5: Rotate Passwords

Best Practices

Never manually edit vault files - Use CLI commands only
Commit vault to version control - Except auth/ directory
Monitor integrity.log - Set up alerts for violations
Run verify before deployments - Ensure vault integrity
Backup vault regularly - Automated backups recommended

Next Steps

Mode Enforcement

Learn about ring-based access control

Best Practices

Security recommendations for production