feat(sqlite): support encrypting column values through SQL functions - #9209
feat(sqlite): support encrypting column values through SQL functions#9209chirag-bruno wants to merge 1 commit into
Conversation
Statements can wrap values in bruno_encrypt/bruno_decrypt, registered from a codec the host supplies when opening the database. Injecting it keeps @usebruno/sqlite free of an electron dependency. Registration runs before the migrations so a later backfill migration can use the same functions.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughThe change adds a SQLite codec abstraction with nullable transforms, registers codec functions during database creation, connects Electron safe-storage encryption, updates migration verification, and adds tests for encrypted storage and failure behavior. ChangesSQLite codec integration
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This adds SQLite encryption/decryption functions and connects Electron safe storage without changing existing statements. The implementation preserves null handling and has coverage for encryption, fallback, and failure cases, so it is ready to merge. Sequence Diagram(s)sequenceDiagram
participant ElectronSQLite
participant DB
participant SQLite
participant SafeStorage
ElectronSQLite->>DB: create database with codec
DB->>SQLite: register bruno_encrypt and bruno_decrypt
SQLite->>SafeStorage: encrypt or decrypt value
SafeStorage-->>SQLite: return transformed value
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Codec threads through SQLite bright Comment |
Statements can wrap values in
bruno_encrypt/bruno_decrypt, registered as SQLite functions from a codec passed tocreateDatabase. Injecting the codec keeps the package free of anelectrondependency; bruno-electron supplies Bruno's existing encryption utilities.Registration runs before the migrations so a later backfill migration can use the same functions. Opening without a codec warns and stores values unchanged.
No statement uses the functions yet, so there is no behaviour change on its own.
Ticket: BRU-4509
Summary by CodeRabbit
New Features
Bug Fixes
Tests