[<< BACK TO PROJECTS]
Backup & Recovery + Rust Systems2026 · Production Pilot

# SqlVault2

A recoverability-first rewrite of SqlVault in Rust. Encrypts SQL Server databases with AES-256-GCM, uploads artifacts to Google Drive or local storage, and exposes a loopback-only web UI for administration. The north star is verified restoreability, including recovery after the original host and local SQLite metadata are unavailable.

RustSQL ServerBackupAES-256-GCMGoogle DriveRecoverabilityFastCDCSpec-Driven

System Diagram

Host / entrypointEngineArtifactIntegrationStorageSecurityExternaldrag / scroll to zoom

Overview

SqlVault2 is a recoverability-first rewrite of SqlVault in Rust. It encrypts SQL Server databases with AES-256-GCM, uploads artifacts to Google Drive or local storage, and exposes a loopback-only web UI for administration. The north star is verified restoreability, including recovery after the original host and local SQLite metadata are unavailable. The workspace is split into eight crates: core domain models and ports, security with a KEK ring and passphrase-protected recovery key export/import, a versioned encrypted artifact container, SQLite persistence with leases and snapshots, SQL Server and Google Drive integrations, the backup/restore/scheduling/reconciliation engine, the CLI and web host, and a testkit with fixtures and fault injection. Every successful full backup is queued for a background restore drill that restores to a scratch database, runs DBCC CHECKDB, drops the database, and certifies the result. A clean-host restore CLI subcommand recovers a database on a machine with no prior SQLite catalog using only the cloud artifact and a documented recovery key. File backup adds FastCDC content-defined chunking with per-chunk AES-256-GCM, SHA-256 deduplication, glob exclusions, and delta sync manifests. The release gate requires a lost-host restore drill: produce an encrypted artifact, remove the host and SQLite catalog, then restore using only the cloud artifact, recovery key, and released binaries.

Problem

The .NET version proved the product, but recoverability is the real contract. A backup system that cannot restore after host loss, metadata loss, or key loss is a liability. The rewrite makes restoreability the primary acceptance criterion and hardens every layer around it.

Approach

Spec-driven Rust workspace split into core, security, artifact, data, integrations, engine, host, and testkit crates. Streaming AES-256-GCM encryption with resumable uploads, automatic restore drills on every full backup, a clean-host restore CLI subcommand, KEK ring with passphrase-protected recovery key export/import, and an HMAC-chained audit log that fails closed without a key. Loopback-only binding, CSRF, Origin checks, CSP, and rate limiting secure the web surface.

Impact

  • * Every successful full backup is queued for a background restore drill: restored to a scratch database, DBCC CHECKDB-verified, dropped, and certified.
  • * Clean-host restore subcommand recovers a database on a machine with no prior SQLite catalog, using only the cloud artifact and a documented recovery key.
  • * File backup (ENG-028) adds FastCDC content-defined chunking with per-chunk AES-256-GCM, SHA-256 deduplication, glob exclusions, and delta sync manifests.
  • * Release gate requires a lost-host restore drill: produce an encrypted artifact, remove the host and SQLite catalog, then restore using only the cloud artifact, recovery key, and released binaries.

Architecture

SqlVault2 is a spec-driven Rust workspace that makes verified restoreability the primary contract. Eight crates separate domain, security, artifact format, persistence, integrations, engine, host, and test infrastructure, with a release gate that requires a lost-host restore drill.

Layer
Implementation
Purpose
Core
sqlvault-core (domain models, policies, ports)
Domain models, retention policies, and port interfaces. No infrastructure dependencies; defines the contracts the engine and integrations implement.
Security
sqlvault-security (KEK ring, key wrapping, signing)
AES-KW key wrapping around a KEK ring, passphrase-protected recovery key export/import, and signing primitives. Fail-closed audit requires an explicit HMAC key.
Artifact
sqlvault-artifact (versioned encrypted container)
Versioned backup container with streaming AES-256-GCM encryption and compatibility handling across artifact versions.
Engine
sqlvault-engine (backup, restore, scheduling, reconciliation)
Backup and restore pipelines, cron scheduling with durable queue and lease-based workers, retention with minimum-copy safety, and crash-recovery reconciliation with state-transition classification.
Host
sqlvault-host (CLI, web UI/API, service lifecycle)
Loopback-only web UI and API with CSRF, Origin checks, CSP, Secure/HttpOnly/SameSite=Strict cookies, and rate limiting. CLI covers setup, migrate, auth, backup, restore, restore-clean-host, recovery-key export/import, and status.

Guardrails

  • * Audit log is HMAC-chained and fails closed without an explicit key; no silent operation.
  • * Loopback-only binding is enforced; the server refuses non-local binds.
  • * Release candidate is not accepted until the lost-host restore drill succeeds against only the cloud artifact, recovery key, and released binaries.