Skip to content

HeliosDB Security Architecture

HeliosDB Security Architecture

Transparent Data Encryption (TDE) + Database Vault

Version: 1.0 Date: October 11, 2025 Status: Production-Ready Design


Overview

HeliosDB implements enterprise-grade security through two complementary systems:

  1. Transparent Data Encryption (TDE): Encrypts data at rest without application changes
  2. Database Vault: Prevents privileged user access without explicit authorization

This architecture ensures:

  • Confidentiality: Data encrypted at rest and in transit
  • Access Control: Even DBAs cannot access sensitive data without vault password
  • Compliance: Meets SOC 2, HIPAA, GDPR, PCI-DSS requirements
  • Auditability: Comprehensive logging of all security events

1. Transparent Data Encryption (TDE)

1.1 Architecture

TDE operates at three layers:

┌─────────────────────────────────────────────┐
│ Application Layer │
│ (No changes required - transparent) │
└───────────────┬─────────────────────────────┘
┌───────────────▼─────────────────────────────┐
│ Encryption/Decryption Layer │
│ • Column Encryption │
│ • Tablespace Encryption │
│ • SSTable Encryption │
└───────────────┬─────────────────────────────┘
┌───────────────▼─────────────────────────────┐
│ Key Management Layer │
│ • Master Encryption Key (MEK) │
│ • Table Encryption Keys (TEK) │
│ • HSM Integration (PKCS#11) │
└───────────────┬─────────────────────────────┘
┌───────────────▼─────────────────────────────┐
│ Storage Layer │
│ • Encrypted SSTables │
│ • Encrypted WAL (CommitLog) │
│ • Encrypted Vector Indexes │
└─────────────────────────────────────────────┘

1.2 Encryption Modes

Tablespace Encryption

CREATE TABLESPACE secure_data
ENCRYPTION USING 'AES256'
KEY_ID 'master_key_001';
CREATE TABLE users (
user_id BIGINT,
ssn VARCHAR(11),
credit_card VARCHAR(16)
) TABLESPACE secure_data;

Column-Level Encryption

CREATE TABLE users (
user_id BIGINT,
username VARCHAR(255),
ssn VARCHAR(11) ENCRYPTED, -- Encrypted with TEK
credit_card VARCHAR(16) ENCRYPTED, -- Encrypted with TEK
email VARCHAR(255) -- Not encrypted
);

1.3 Key Hierarchy

Master Encryption Key (MEK)
├─ Stored in HSM or external KMS
└─ Never stored on disk
├─> Table Encryption Key 1 (TEK-1)
│ └─ Encrypts: user_table SSTables
├─> Table Encryption Key 2 (TEK-2)
│ └─ Encrypts: orders_table SSTables
└─> Table Encryption Key N (TEK-N)
└─ Encrypts: vector_index HNSW data

Key Properties:

  • MEK: 256-bit AES key stored in HSM (Hardware Security Module)
  • TEK: 256-bit AES key per table/tablespace, encrypted with MEK
  • Rotation: TEK rotated periodically, MEK rotated annually
  • Derivation: PBKDF2 for password-based keys, random for HSM

1.4 Encryption Algorithms

AlgorithmKey SizeUse CasePerformance
AES-256-GCM256-bitDefault (authenticated encryption)Fast (hardware acceleration)
AES-256-CTR256-bitHigh-throughput workloadsFastest (parallelizable)
ChaCha20-Poly1305256-bitCPU without AES-NIFast (software optimized)

1.5 What Gets Encrypted

ComponentEncryptedKey TypeNotes
SSTablesYesTEKData blocks encrypted
CommitLog (WAL)YesTEKLog entries encrypted
Memtable❌ NoN/AIn-memory (protected by OS)
Vector IndexesYesTEKHNSW/IVF data encrypted
Bloom FiltersYesTEKMetadata encrypted
Metadata⚠ OptionalMEKSchema, topology
Network TrafficYesTLSTLS 1.3 required

2. Database Vault

2.1 Architecture

Database Vault implements mandatory access control on top of standard RBAC:

┌─────────────────────────────────────────────┐
│ User/Application │
└───────────────┬─────────────────────────────┘
┌───────────────▼─────────────────────────────┐
│ Authentication Layer │
│ • Standard credentials (username/password) │
│ • Certificate-based auth │
└───────────────┬─────────────────────────────┘
┌───────────────▼─────────────────────────────┐
│ Database Vault Enforcement │
│ • Realm Protection (WHO can access) │
│ • Command Rules (WHAT they can do) │
│ • Vault Password (REQUIRED for realms) │
└───────────────┬─────────────────────────────┘
┌───────────────▼─────────────────────────────┐
│ Standard RBAC (Grants) │
│ • Table/Column privileges │
│ • Role-based access │
└───────────────┬─────────────────────────────┘
┌───────────────▼─────────────────────────────┐
│ Data Access │
│ • Encrypted data decrypted with TEK │
│ • Audit log entry created │
└─────────────────────────────────────────────┘

2.2 Core Concepts

Realms

Protected zones containing sensitive objects (tables, schemas)

-- Create a realm for PII data
CREATE REALM pii_protection
DESCRIPTION 'Protects personally identifiable information'
REQUIRE VAULT PASSWORD;
-- Add tables to realm
ALTER REALM pii_protection ADD TABLE users;
ALTER REALM pii_protection ADD TABLE customer_profiles;

Vault Passwords

Separate authentication required to access realm-protected data

-- DBA has CREATE TABLE privilege but CANNOT access data
-- without vault password
-- Standard login (DBA)
CONNECT dba_user / dba_password;
-- Cannot access protected tables
SELECT * FROM users; -- ERROR: Vault password required
-- Unlock realm with vault password
UNLOCK REALM pii_protection PASSWORD 'vault_secret_2025';
-- Now access is granted
SELECT * FROM users; -- SUCCESS

Realm Owners

Users who can modify realm membership and grant vault passwords

-- Create realm with owner
CREATE REALM finance_data
OWNER security_admin
REQUIRE VAULT PASSWORD;
-- Only security_admin can add/remove tables from realm
-- Only security_admin can grant vault passwords to others

2.3 Command Rules

Restrict specific SQL operations even for privileged users:

-- Prevent DBA from dropping sensitive tables
CREATE COMMAND RULE no_drop_pii
FOR DELETE ON TABLE users
DENY FROM ROLE dba, sysadmin
MESSAGE 'PII tables cannot be dropped without approval';
-- Prevent export of sensitive data
CREATE COMMAND RULE no_export_ssn
FOR SELECT ON COLUMN users.ssn
DENY WHEN program_name = 'export_tool'
MESSAGE 'SSN export requires security team approval';
-- Time-based restrictions
CREATE COMMAND RULE business_hours_only
FOR SELECT ON TABLE financial_records
DENY WHEN HOUR(CURRENT_TIMESTAMP) NOT BETWEEN 9 AND 17
MESSAGE 'Financial data accessible only during business hours';

2.4 Separation of Duties

Traditional problem:

DBA (Alice)
├─ Can create tables
├─ Can grant privileges
├─ Can view all data ← PROBLEM!
└─ Can export backups ← PROBLEM!

With Database Vault:

DBA (Alice)
├─ Can create tables
├─ Can grant privileges
├─ Can view protected data ❌ (Requires vault password)
└─ Can export backups ❌ (Encrypted, cannot decrypt)
Security Admin (Bob)
├─ Manages vault passwords
├─ Defines realms
├─ Cannot create tables ❌
└─ Cannot grant SQL privileges ❌
Compliance Officer (Carol)
├─ Reviews audit logs
├─ Cannot modify data ❌
└─ Cannot modify vault rules ❌

2.5 Privileged User Scenarios

Scenario 1: DBA Needs to Read Data

-- Alice (DBA) needs to debug a query issue
-- Step 1: Alice requests vault password from Bob
-- (Out-of-band: phone, ticketing system)
-- Step 2: Bob grants temporary vault password
GRANT VAULT PASSWORD ON REALM pii_protection
TO dba_alice
VALID FOR INTERVAL '2 HOURS';
-- Step 3: Alice unlocks realm
CONNECT dba_alice / dba_password;
UNLOCK REALM pii_protection PASSWORD 'temp_vault_xyz';
-- Step 4: Alice can now access data
SELECT * FROM users WHERE user_id = 12345;
-- Step 5: Vault password expires after 2 hours
-- All access is logged in audit trail

Scenario 2: Backup and Restore

-- Backup operator cannot decrypt encrypted data
-- Backup creates encrypted files
BACKUP DATABASE TO '/backups/prod_2025_10_11.enc'
ENCRYPTED WITH KEY 'master_key_001';
-- Restore requires both:
-- 1. Access to backup file
-- 2. Master encryption key (from HSM)
RESTORE DATABASE FROM '/backups/prod_2025_10_11.enc'
DECRYPT WITH KEY 'master_key_001'
VAULT PASSWORD 'vault_restore_secret';

Scenario 3: Emergency Access

-- Break-glass procedure for emergencies
-- Security officer activates emergency access
EMERGENCY UNLOCK REALM pii_protection
AUTHORIZED BY security_officer
REASON 'Production outage - ticket INC-2025-10-11-001'
VALID FOR INTERVAL '1 HOUR';
-- All emergency unlocks:
-- • Generate critical alerts
-- • Require two-person approval
-- • Logged with full context
-- • Time-limited (1 hour max)
-- • Require post-incident review

3. Key Management

3.1 HSM Integration

// Hardware Security Module integration via PKCS#11
pub struct HsmKeyManager {
// PKCS#11 library path
pkcs11_lib: String,
// HSM slot ID
slot_id: u64,
// PIN for HSM access
pin: SecureString,
}
impl HsmKeyManager {
// Generate master encryption key in HSM (never leaves HSM)
pub fn generate_master_key(&self, key_id: &str) -> Result<KeyHandle> {
// Key generated and stored in HSM
// Only key ID returned, not the key itself
}
// Encrypt table encryption key with MEK
pub fn wrap_table_key(&self, mek_id: &str, tek: &[u8]) -> Result<EncryptedKey> {
// TEK encrypted by HSM using MEK
// Encrypted TEK can be stored on disk safely
}
// Decrypt table encryption key
pub fn unwrap_table_key(&self, mek_id: &str, encrypted_tek: &[u8]) -> Result<Vec<u8>> {
// HSM decrypts TEK using MEK
// Decrypted TEK used in memory only
}
}

3.2 External KMS Support

# AWS KMS configuration
kms:
provider: aws
region: us-east-1
master_key_id: arn:aws:kms:us-east-1:123456789:key/abc-def-ghi
# Azure Key Vault configuration
kms:
provider: azure
vault_url: https://heliosdb-vault.vault.azure.net/
key_name: heliosdb-master-key
# HashiCorp Vault configuration
kms:
provider: vault
address: https://vault.company.com:8200
transit_path: /transit/keys/heliosdb-master

3.3 Key Rotation

-- Rotate table encryption key
ALTER TABLE users ROTATE ENCRYPTION KEY;
-- Process:
-- 1. Generate new TEK-new
-- 2. Re-encrypt all data with TEK-new
-- 3. Delete old TEK-old (secure wipe)
-- Rotate master encryption key (annual)
ALTER DATABASE ROTATE MASTER KEY;
-- Process:
-- 1. Generate new MEK-new in HSM
-- 2. Re-wrap all TEKs with MEK-new
-- 3. Retire old MEK-old

4. Audit Logging

4.1 Audit Events

All security events are logged:

Event TypeDetails LoggedRetention
Vault UnlockUser, realm, timestamp, IP7 years
Failed UnlockUser, realm, timestamp, IP7 years
Key AccessKey ID, operation, user7 years
Realm ModificationObject added/removed, by whom7 years
Command Rule ViolationQuery, user, rule matched7 years
Emergency AccessReason, approver, duration10 years
Data ExportTable, rows, user, destination7 years

4.2 Audit Log Format

{
"event_id": "evt_2025_10_11_001",
"timestamp": "2025-10-11T04:30:00Z",
"event_type": "vault_unlock",
"severity": "INFO",
"user": "dba_alice",
"realm": "pii_protection",
"ip_address": "10.0.5.42",
"session_id": "sess_abc123",
"result": "SUCCESS",
"vault_password_id": "vp_temp_001",
"expires_at": "2025-10-11T06:30:00Z"
}

5. Performance Impact

5.1 Encryption Overhead

OperationWithout TDEWith TDEOverhead
Point Read0.8ms0.95ms+18%
Bulk Insert100K rows/sec85K rows/sec-15%
Full Scan2GB/sec1.7GB/sec-15%
Vector Search25ms28ms+12%

Mitigation:

  • Hardware AES-NI acceleration (90% of overhead eliminated)
  • CTR mode for parallelizable encryption
  • Key caching (avoid HSM round-trips)

5.2 Vault Overhead

OperationOverheadNotes
Initial Unlock50-100msOne-time per session
Subsequent Queries<1msToken cached in session
Realm Check<0.1msIn-memory bitmap

6. Compliance Mapping

RegulationTDE SupportVault Support
GDPRArt. 32 (Encryption)Art. 32 (Access Control)
HIPAA164.312(a)(2)(iv)164.308(a)(4)
PCI-DSSReq. 3.4 (Encryption)Req. 7 (Access Control)
SOC 2CC6.7 (Encryption)CC6.1 (Logical Access)

7. Migration and Deployment

7.1 Enabling TDE on Existing Database

-- Step 1: Create master key
CREATE MASTER KEY ENCRYPTION BY HSM
KEY_ID 'master_key_prod_001';
-- Step 2: Enable encryption on tablespace
ALTER TABLESPACE users_data
ENABLE ENCRYPTION USING 'AES256';
-- Step 3: Rewrite existing data (background process)
-- Automatically triggered, progress visible in:
SELECT * FROM system.encryption_progress;

7.2 Enabling Database Vault

-- Step 1: Enable vault
ALTER DATABASE ENABLE DATABASE VAULT;
-- Step 2: Create vault administrator
CREATE ROLE vault_admin;
GRANT VAULT_ADMIN TO security_team;
-- Step 3: Create initial realms
CREATE REALM pii_protection OWNER security_team;

8. Best Practices

8.1 Security

  • Use HSM for master keys (never store MEK on disk)
  • Rotate table keys annually, master key every 2 years
  • Enable vault for all PII/sensitive data
  • Use multi-person approval for emergency access
  • Monitor audit logs with SIEM integration

8.2 Operations

  • Test backup/restore with encryption
  • Document vault password recovery procedure
  • Automate key rotation
  • Use separate vault admins (not DBAs)
  • Implement break-glass procedures

8.3 Performance

  • Enable AES-NI on all servers
  • Use tablespace encryption (not column) for hot data
  • Cache vault tokens in connection pool
  • Pre-warm encryption keys at startup

9. Architecture Diagram

┌─────────────────────────────────────────────────────────────┐
│ Client Application │
└────────────┬────────────────────────────────────────────────┘
│ TLS 1.3 (encrypted)
┌─────────────────────────────────────────────────────────────┐
│ HeliosDB Compute Node │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Vault Enforcement Layer │ │
│ │ • Realm check (is table protected?) │ │
│ │ • Vault password validation │ │
│ │ • Command rule evaluation │ │
│ │ • Audit log generation │ │
│ └────────────┬────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Query Execution Engine │ │
│ │ • Predicate pushdown │ │
│ │ • Join/aggregate processing │ │
│ └────────────┬────────────────────────────────────────┘ │
└───────────────┼──────────────────────────────────────────────┘
│ HIDB Protocol (TLS encrypted)
┌─────────────────────────────────────────────────────────────┐
│ HeliosDB Storage Node │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Transparent Decryption Layer │ │
│ │ • Fetch TEK from key cache │ │
│ │ • If not cached, fetch from HSM/KMS │ │
│ │ • Decrypt data blocks with AES-256-GCM │ │
│ └────────────┬────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ LSM-tree Storage Engine │ │
│ │ • SSTables (encrypted at rest) │ │
│ │ • CommitLog (encrypted at rest) │ │
│ │ • Bloom filters (encrypted) │ │
│ │ • Vector indexes (encrypted) │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Persistent Storage │
│ (All data encrypted with TEK) │
└─────────────────────────────────────────────────────────────┘
External:
┌─────────────────────────────────────────────────────────────┐
│ Hardware Security Module (HSM) or Cloud KMS │
│ • Stores Master Encryption Key (MEK) │
│ • Never exports MEK │
│ • Wraps/unwraps TEKs on demand │
└─────────────────────────────────────────────────────────────┘

Document Status: Ready for Implementation Next Steps: Deploy specialized security agents to implement TDE and Vault subsystems