Repository navigation
Backlog
Labels
follow-up-pendingMerged work left follow-ups; the follow-ups workflow turns them into backlog issueshotfixPatch of a released version; handled before everything elsemcpneeds-maintainerNeeds an account, instance, measurement or secret from the maintainerpersistencequestion-triageQuestion of an agent, being prepared for the maintainersecurity
Milestone
Description
Goal
A plaintext database that appears where the app expects its encrypted one is never converted and opened silently, and an MCP token found in settings.json is no longer taken over outside the original one-time upgrade. Both upgrade steps from versions before database encryption keep working.
Context
- Plaintext database. The start-up decision table (Spec 0101 A3,
decide_startup,crates/app-logic/src/database_startup.rs:94-135) maps a plaintext file (SQLite format 3header) toConvertwhen the root key is present and toGenerateKeyThenConvertwhen there is none. Both run the conversion (A6) without asking (E5: "converted automatically on the first start"). This was meant for upgrading from versions before Spec 0101. But the same happens at any later start: ifsmart-ssh.dbis replaced by a plaintext SQLite file, the app converts it with the existing key and continues with its contents (server profiles, rules, provider settings) as if they were the user's own. This also holds in master password mode. - Legacy MCP token.
load_or_init_token(crates/app-logic/src/mcp_token.rs:125-180, Spec 0101 A12) takes the token fromsettings.json(mcpServerToken) whenever the database has no token entry. That is the one-time move from the settings file into the database, but it is not limited to that move: a database without a token (e.g. a freshly converted or freshly created one) adopts whatever token the settings file holds, so the token value can be chosen by whoever wrote that file. - The THREAT-MODEL.md section 3 scopes encryption at rest to a copy of the data directory, not to a party that can write it; the data directory ownership check is a separate issue (see Related Work).
Requirements
- Decided by maintainer: a plaintext database is converted only after the user confirms it in a start-up dialog ("An unencrypted database was found at (last modified ). Convert it and continue / Quit"); Quit changes nothing. The MCP token from
settings.jsonis adopted only in the start in which the user confirmed that conversion; otherwise it is removed fromsettings.jsonwithout being used, and a new token is generated if the database has none (as for an empty token, Reject MCP requests when the expected token is empty #115). Users upgrading directly from a version before database encryption see this dialog once. - New
StartupDialogvariant for "plaintext database found" with the two choices;ConvertandGenerateKeyThenConvertrun only after "Convert and continue". The decision table stays a pure function (A3, T3): the plan becomes "dialog, then convert" instead of "convert". - The dialog shows the full path, size and modification time of the file; texts in all app locales.
- "Quit" leaves the file,
-wal,-shm, the key and the key file untouched. load_or_init_tokentakes a flag "conversion confirmed in this start"; without it, a token insettings.jsonis removed (best effort, as today) and not adopted; a missing database token is generated as in case 3 of the doc comment.- Spec 0101 (E5, A3 table, A6, A12, tests T4/T12) and THREAT-MODEL.md section 3 updated.
Acceptance Criteria
- Test (
decide_startup): plaintext file with key present / not found → the new dialog, never a direct conversion; every other cell of the table unchanged. - Test: confirming the dialog converts exactly as before (existing conversion tests T4–T6 pass through the dialog path).
- Test: "Quit" leaves database file, WAL, SHM and key material byte-identical.
- Test: database without token + token in
settings.json+ no confirmed conversion → a newly generated token in the database, the settings value removed and not used. - Test: database without token + token in
settings.json+ confirmed conversion in this start → that token in the database (A12 behaviour kept for the real upgrade). - Relevant automated tests pass.
Technical Notes
- Security-relevant start-up path (Spec 0101, ADR 0093). No silent fallbacks: never continue in plaintext, never create a new key for an encrypted file (existing rules E4, "no silent fallbacks").
- No data model change.
- The start-up dialogs are shown before the main window (
crates/app-shell/src/startup_dialog.rs); follow the existing D1–D4 pattern for texts and tests.
Files: crates/app-logic/src/database_startup.rs, crates/app-logic/src/mcp_token.rs, crates/app-logic/src/mcp_token/, crates/app-shell/src/startup_dialog.rs, crates/app-shell/src/lib.rs, frontend locales, THREAT-MODEL.md, docs/specs/0101-database-encryption.md
Spec impact: update 0101
Open questions
- none (technical details follow the existing D1–D4 implementation)
Related Work
- Reject MCP requests when the expected token is empty #115 (empty MCP token)
- Integrity of local data at rest against modification without the database key #1720 (epic: integrity of local data at rest)
- Data directory override: refuse a pointer file or data directory that other users can modify #1717 (data directory ownership check)
Metadata
Metadata
Assignees
Labels
follow-up-pendingMerged work left follow-ups; the follow-ups workflow turns them into backlog issueshotfixPatch of a released version; handled before everything elsemcpneeds-maintainerNeeds an account, instance, measurement or secret from the maintainerpersistencequestion-triageQuestion of an agent, being prepared for the maintainersecurity
Type
Fields
Priority
P2 - Normal
Activity
fix(app-logic): confirm plaintext database conversion, adopt legacy M…
test(real-app-tests): seed the upgrade path already converted, the ap…
smart-ssh-coder commentedon Dec 5, 2026
Implementation ready for review. PR #1752. A plaintext database is now converted only after a start-up dialog confirmation (new PlaintextFound dialog, native and in-window, DE/EN texts, button label in all locales). The legacy MCP token from settings.json is adopted only in the start that confirmed the conversion. Tests added with counter-proof, Spec 0101 and threat model updated; real-app upgrade test now seeds the converted file. CI green on PR #1752.
smart-ssh-coordinator commentedon Dec 5, 2026
Automation paused after 2 technical failures (last: crashed). Lift the block in the dashboard (Remove Block); removing the labels alone does not resume it.
smart-ssh-reviewer commentedon Dec 5, 2026
Review: 1. D5 title and message exist only in DE/EN (startup_choice_dialogs.rs plaintext_found_text); the issue requires texts in all app locales. Provide them, or raise it with the maintainer if the native pre-window dialog cannot do it; do not narrow the requirement in the spec. 2. Spec 0090 A14 path 2 still says the real-app test starts on a 0.5.2 plaintext database, but seed_plaintext_upgrade now converts it before the app starts. Either let the harness answer D5, or update 0090 A14 with an ADR for the coverage reduction and rename the function. 3. Spec 0101 has stale statements: A3 closing paragraph and T3 still say 'two K-generating fields'; the lists at l. 88/446 say D1-D4 instead of D1-D5; D5's 'Quit leaves the wrapping file byte-identical / no K' is false after D1 'set up master password' on a plaintext file. Fix the spec or the order, and add a D1-setup -> D5 test. 4. D5 content: size 0 shown on a metadata read error (use Option and show 'unknown'; the comment at l. 250 is wrong); raw byte count instead of readable units; label 'File:' instead of 'Data path:' as in D2-D4; 'recognise' -> 'recognize'. 5. Comments contradicting the code: mcp_token.rs:12-17, mcp_settings.rs:113-114, database_startup.rs:79, :562-564, :42/:274 (D1-D4), startup_choice_dialogs.rs:2, window_prompt.rs:92-93. Follow-up noted: the D4 path (plaintext x invalid key) in master password mode converts without D5's file details and warning; outside this issue's AC.
fix(app-logic): address review of plaintext conversion dialog (#1718)
smart-ssh-coder commentedon Dec 5, 2026
Needs maintainer: Question: Must the D5 dialog ("Unencrypted database found", crates/app-logic/src/startup_choice_dialogs.rs plaintext_found_text) exist in all app locales, as the issue requires ("texts in all app locales")?
Context: All other review points are fixed and pushed, CI is green. The startup dialogs run natively before the Tauri runtime and the frontend i18n exist, so they carry their own texts and only support DE and EN (startup_error_messages.rs Language enum; Spec 0071 A11a; Spec 0101 A20). D1-D4 are the same.
Options:
Technical assessment: 1: no effort, no risk. 2: ~6-10 files plus ~30 translations, 2-3 review rounds, low risk but large scope. 3: ~4 files, 1-2 rounds, risk of an inconsistent dialog language within one startup.