Skip to content

Validate recent database paths before display and auto-cleanup stale entries#38

Merged
jonax1337 merged 5 commits into
enhancement/title-bar-actionsfrom
copilot/sub-pr-36
Jan 10, 2026
Merged

Validate recent database paths before display and auto-cleanup stale entries#38
jonax1337 merged 5 commits into
enhancement/title-bar-actionsfrom
copilot/sub-pr-36

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 10, 2026

The recent databases list stored file paths in localStorage without validation. Users saw stale entries for moved/deleted files, and could attempt to open invalid databases.

Changes

Backend: New validate_database_file command

  • Checks file existence, type, and .kdbx extension
  • Validates KDBX magic bytes (0x03D9A29A) by reading only first 8 bytes
  • Returns boolean without exposing sensitive data

Frontend: New getValidatedRecentDatabases() function

  • Validates all paths concurrently on mount
  • Auto-removes invalid entries from localStorage
  • Handles errors gracefully (permissions, I/O failures)

UI: CustomTitleBar now uses validated paths

  • "Open Recent" menu shows only accessible databases
  • No user-facing changes beyond removing stale entries
// Before: Direct localStorage read, no validation
const recent = getRecentDatabases(); // May include missing/invalid files

// After: Validated and cleaned
const recent = await getValidatedRecentDatabases(); // Only valid KDBX files

Concurrent validation is bounded to 10 items (enforced by addRecentDatabase). Tauri provides built-in timeout protection for invoke calls.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 10, 2026 21:11
… valid KDBX files

Co-authored-by: jonax1337 <25123834+jonax1337@users.noreply.github.com>
…file

Co-authored-by: jonax1337 <25123834+jonax1337@users.noreply.github.com>
Co-authored-by: jonax1337 <25123834+jonax1337@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on custom title bar enhancement Validate recent database paths before display and auto-cleanup stale entries Jan 10, 2026
Copilot AI requested a review from jonax1337 January 10, 2026 21:19
@jonax1337 jonax1337 marked this pull request as ready for review January 10, 2026 21:34
@jonax1337 jonax1337 merged commit ac1fcfd into enhancement/title-bar-actions Jan 10, 2026
@jonax1337 jonax1337 deleted the copilot/sub-pr-36 branch January 10, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants