tftsr-devops_investigation/src-tauri
Shaun Arman f0358cfb13 fix(db,auth): auto-generate encryption keys for release builds
Fixes two critical issues preventing Mac release builds from working:

1. Database encryption key auto-generation: Release builds now
   auto-generate and persist the SQLCipher encryption key to
   ~/.../trcaa/.dbkey (mode 0600) instead of requiring the
   TFTSR_DB_KEY env var. This prevents 'file is not a database'
   errors when users don't set the env var.

2. Plain SQLite to encrypted migration: When a release build
   encounters a plain SQLite database (from a previous debug build),
   it now automatically migrates it to encrypted SQLCipher format
   using ATTACH DATABASE + sqlcipher_export. Creates a backup at
   .db.plain-backup before migration.

3. Credential encryption key auto-generation: Applied the same
   pattern to TFTSR_ENCRYPTION_KEY for encrypting AI provider API
   keys and integration tokens. Release builds now auto-generate
   and persist to ~/.../trcaa/.enckey (mode 0600) instead of
   failing with 'TFTSR_ENCRYPTION_KEY must be set'.

4. Refactored app data directory helper: Moved dirs_data_dir()
   from lib.rs to state.rs as get_app_data_dir() so it can be
   reused by both database and auth modules.

Testing:
- All unit tests pass (db::connection::tests + integrations::auth::tests)
- Verified manual migration from plain to encrypted database
- No clippy warnings

Impact: Users installing the Mac release build will now have a
working app out-of-the-box without needing to set environment
variables. Developers switching from debug to release builds will
have their databases automatically migrated.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-07 09:35:34 -05:00
..
.cargo fix: resolve clippy format-args failures and OpenSSL vendoring issue 2026-04-04 15:05:13 -05:00
capabilities fix(security): harden secret handling and audit integrity 2026-04-04 23:37:05 -05:00
gen/schemas fix(security): harden secret handling and audit integrity 2026-04-04 23:37:05 -05:00
icons fix: replace empty icon placeholder files with real app icons 2026-03-15 20:31:52 -05:00
resources/ollama feat(ui): fix model dropdown, auth prefill, PII persistence, theme toggle, and Ollama bundle 2026-04-05 19:30:41 -05:00
src fix(db,auth): auto-generate encryption keys for release builds 2026-04-07 09:35:34 -05:00
target security: rotate exposed token, redact from PLAN.md, add secret patterns to .gitignore 2026-03-15 14:04:49 -05:00
build.rs feat: initial implementation of TFTSR IT Triage & RCA application 2026-03-14 22:36:25 -05:00
Cargo.lock feat(ai): add tool-calling and integration search as AI data source 2026-04-07 09:35:34 -05:00
Cargo.toml feat(ai): add tool-calling and integration search as AI data source 2026-04-07 09:35:34 -05:00
tauri.conf.json refactor(ollama): remove download/install buttons — show plain install instructions only 2026-04-05 20:53:57 -05:00