Commit Graph
868 Commits
Author SHA1 Message Date
Jonathan White b5523be1a1 Additional fixes for macOS and modern Qt6
* Replace Q_OS_MAC with Q_OS_MACOS
* Remove deleted macro QTEST_DISABLE_KEYPAD_NAVIGATION
2026-10-15 14:18:47 -04:00
varjolintu 80e68bb4e8 Fix out-of-bounds writing to browser messages 2026-09-22 21:46:36 +02:00
varjolintu dfdd561fc5 Passkeys: Fix parsing punycode domains 2026-09-21 22:26:59 -04:00
2b58033398 Add native Windows Arm64 support on Qt-vcpkg builds (#13678)
* Add minimal native Windows Arm64 support

Extend the Qt-via-vcpkg work from #13473 with only the source changes required for Windows Arm64 triplet selection, deployqt resolution, ordered runtime dependency deployment, and architecture-correct MSI metadata.

Co-authored-by: Janek Bevendorff <[email protected]>
Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Gordon Lam (SH) (from Dev Box) <[email protected]>
Co-authored-by: Janek Bevendorff <[email protected]>
Co-authored-by: Copilot <[email protected]>
2026-09-20 23:59:34 +02:00
SimonandCopilot Autofix powered by AI 126f508e6a Add list storing key of all custom attributes in database
Add completer when adding/renaming custom attribute

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
2026-09-19 19:26:55 -04:00
Sami Vänttinen 474da9b877 Fix identifying nested reference placeholders (#13688) 2026-09-19 19:26:29 -04:00
Abdelrahman Saeed Elhassan 61d562b379 Fix search + prefix modifier ignoring case sensitivity
The search parser now passes the CASE_SENSITIVE flag to the term
when the '+' prefix modifier is used, so searches like '+p:test1'
correctly perform case-sensitive matching.

Fixes #13000

[skip ci]
2026-09-14 19:46:56 -04:00
Brais Couce 089cf9a916 Add the number of passkeys and TOTP entries to the statistics of the database report (#13632) 2026-09-14 19:44:49 -04:00
AetfandClaude Fable 5 8e6fe3ffd6 FdoSecrets: keep AccessControlDialog safe across database lock
The item access confirmation dialog used to hold raw Entry pointers in
its model, its deny buttons, and its result signal. When the database
locks or closes while the dialog is open, DatabaseWidget replaces the
Database and destroys every Entry, while the dialog stays up: painting
the model, or answering the dialog, then dereferenced freed entries
(crash in UnlockPrompt::itemUnlockFinished via Entry::uuid, see the
backtrace in #9104).

Make the dialog self-contained: snapshot each entry's uuid and display
data (title, username, icon) at construction and report decisions as a
QHash<QUuid, AuthDecision>, so the dialog never touches an Entry again
after it is shown.

On the UnlockPrompt side, restore the invariant that a non-null item
reference implies a usable backend: track items with QPointer and clear
all references as soon as an item retires (Item::itemAboutToDelete),
mirroring how collection retirement is handled. A decision for an item
that has retired counts as rejected, so the prompt completes as
dismissed instead of reporting success for nothing.

Finally, match the browser behavior: the dialog now withdraws itself
(rejects) when a collection it is asking about locks or goes away,
instead of keeping a stale question on screen.

Fixes #9104

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AqHu6RpvLpaoH2aUGSYQzR
2026-09-14 19:44:08 -04:00
Sami Vänttinen 26da2a1b17 Browser: Fix placeholders part two (#13670) 2026-09-13 19:03:55 -04:00
Dylan Pulver 31a4c9ddd4 Reject invalid padding in Base32::decode
decode() counted '=' anywhere in the last six characters and treated
any count outside {1,3,4,6} as unpadded. With two or five pad
characters nQuantumBytes became 0, so the output buffer was returned
with bytes that were never written, and the byte-extraction offset
became -8, shifting by a negative amount.

Count only the trailing run of pad characters, reject counts RFC 4648
does not allow, and reject a '=' that is not part of that run.
2026-09-01 11:12:39 -04:00
AetfandClaude Fable 5 30e1fa5dfb Fix use-after-free when a database tab close is re-entered (#13598)
* Fix use-after-free when a database tab close is re-entered

Closing a database tab may spin a nested event loop while the widget
performs save-on-close (Database::save waits for its worker thread in
AsyncTask::waitForFuture). If DatabaseTabWidget::closeDatabaseTab is
re-entered for the same widget from within that nested loop (e.g. two
concurrent FdoSecrets prompts deleting the same collection),
QWidget::close() short-circuits on its internal is_closing flag and
reports success immediately, without delivering another close event.
This behavior is identical in Qt 5 (QWidgetPrivate::close_helper) and
Qt 6 (QWidgetPrivate::handleClose), so none of the downstream guards
(such as DatabaseWidget::lock's m_attemptingLock) ever run for the
re-entrant close. The re-entrant call then removed the tab and
scheduled deletion, and the DeferredDelete event executed inside the
still-running nested loop, destroying the widget while the outer
invocation was still using it; the outer call afterwards repeated
parts of the teardown (stale-index removeTab, deleteLater on the freed
widget, duplicate databaseClosed emission). The bug is long-standing
and was surfaced by scheduler timing under an ASan build with Qt 6.11.

Detected by ASan as a heap-use-after-free in DatabaseWidget::save()
during TestGuiFdoSecrets::testCollectionDeleteConcurrent.

- DatabaseTabWidget::closeDatabaseTab: track widgets with a close in
  progress; a re-entrant call returns false without side effects, and
  only the outermost invocation may remove the tab, schedule deletion,
  and emit databaseClosed (exactly once now). Re-resolve the tab index
  after close() since nested event loops may shift tabs.
- FdoSecrets: PromptBase::prompt now schedules promptSync only once;
  repeated Prompt() calls wait for the same Completed signal instead
  of running the prompt action multiple times.
- FdoSecrets: DeleteCollectionPrompt clears its collection reference on
  Collection::collectionAboutToDelete. The QPointer alone still sees a
  retired collection (removed from D-Bus, m_backend already reset)
  until its deleteLater is delivered, which would violate the
  invariant behind Q_ASSERT(m_backend) in Collection::doDelete. With
  the explicit clearing the invariant "non-null m_collection implies
  usable backend" holds again and the assert stays.
- TestGuiFdoSecrets::testCollectionDeleteConcurrent: fix the second
  prompt proxy accidentally created from the first prompt's path (the
  test was exercising a double-Prompt on one object rather than two
  concurrent prompts), and assert the fail-fast behavior: the losing
  concurrent prompt completes as dismissed while the winner performs
  the deletion.

* FdoSecrets: complete prompts whose collections retire mid-prompt

A Collection retires (removed from D-Bus, backend reset, deleteLater
scheduled) synchronously when its database closes. Prompts, however,
reference collections via QPointer from timer callbacks outside D-Bus
dispatch, and a QPointer still sees the retired object until its
deferred deletion is delivered. This left two holes, both reachable
when a collection goes away while a prompt targeting it is in flight
(e.g. a concurrent Collection.Delete from another client):

- LockCollectionsPrompt/UnlockPrompt could call doLock()/doUnlock() on
  a retired collection, hitting Q_ASSERT(m_backend) in debug builds.
- UnlockPrompt would hang forever: the retired collection never emits
  doneUnlockCollection (its service connections are severed on
  retirement), and the count-based completion condition could no
  longer be satisfied, so the Completed signal never fired and the
  client waited indefinitely. The same accounting also hung when an
  entry was already destroyed by the time promptSync ran.

Following the same principle as DeleteCollectionPrompt: restore the
invariant that a non-null collection reference is usable, instead of
relaxing the asserts.

- LockCollectionsPrompt clears retired collection references on
  collectionAboutToDelete; a retired collection is skipped exactly
  like a destroyed one.
- UnlockPrompt tracks awaited collections in an explicit pending set,
  pre-registered before issuing any doUnlock so that synchronous
  completions (already-unlocked databases) cannot prematurely trigger
  the item unlock step. Retirement is accounted as a rejection and
  re-evaluates completion, so the prompt always terminates.
- Add regression test testServiceUnlockConcurrentDelete covering the
  unlock/delete race; verified to fail (hang detected via signal spy
  timeout) without this fix.

* FdoSecrets: clean up unlock dialog bookkeeping when the widget dies

Service::m_unlockingDb tracks databases with an unlock dialog shown to
prevent duplicate dialogs. If the DatabaseWidget is destroyed while
its dialog is open (e.g. the database is deleted via a concurrent
D-Bus call), dialogFinished never fires for it and the entry stayed
forever, keyed by a dangling pointer. The pointer was only ever
compared, not dereferenced, but the stale entry permanently blocked
doUnlockAnyDatabaseInDialog (used by unlock-before-search), and a
future widget allocated at the same address would have been refused an
unlock dialog as well.

Track a cleanup connection on the widget's destroyed signal alongside
the existing databaseUnlocked oneshot, covering both the per-database
and the unlock-any-database flows. Extend the
testServiceUnlockConcurrentDelete regression test to reopen the
database after the concurrent delete and verify the unlock dialog
still appears; without the fix the test times out in SearchItems
waiting for a dialog that never shows.

---------

Co-authored-by: Claude Fable 5 <[email protected]>
2026-08-23 22:45:29 -04:00
Sami Vänttinenandvarjolintu 0e1510d71a Browser: Do not allow using references when creating or updating credentials (#13580)
* Introduces EntryPlaceholders class and moves static code away from Entry class.

---------

Co-authored-by: varjolintu <[email protected]>
2026-08-12 15:03:33 -04:00
e590413544 Fix history items losing entry CustomData (#13573)
* Fix history items losing entry CustomData

Entry::beginUpdate() copied attributes, attachments and auto-type
associations into the temporary history item but not CustomData, unlike
clone() and copyDataFrom(). As a result every history item was created
with empty CustomData, and restoring an entry from history wiped its
CustomData, losing KeePassXC-Browser settings and other client metadata.

Copy CustomData into the history item like the other components and add
TestEntry::testHistoryItemCustomData covering creation and restore.

Co-Authored-By: Claude Fable 5 <[email protected]>

* Removed redundant code to ensure consistency

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Jonathan White <[email protected]>
2026-08-08 22:48:36 -04:00
Adrien Ollier 0b0b2938eb refactor(configure_file): change extension of configure_file input files
Input files of configure_file are traditionnally suffixed with .in.
.cmake extension is preferably reserved to scripts.
2026-08-02 13:29:36 -04:00
IgorandJonathan White 58a2919650 Fix #13073: Respect password generator settings for new entries (#13277)
* Fix #13073: Respect password generator settings for new entries

---------

Co-authored-by: Jonathan White <[email protected]>
2026-07-23 06:42:48 -04:00
Nikos Apostolakis 91461e1f86 Add tamper-detection tests for HmacBlockStream 2026-07-05 23:55:59 -04:00
Adrien Ollier ce28e2afb7 Refactor UrlTools to be a namespace
UrlTools does not need to inherit from QObject or even be a class.
It is a collection of regular functions.
refactor(urltools): Make regular expression static

domainHasIllegalCharacters() constructs a QRegularExpression on every call.
Since the pattern is constant, make it static const QRegularExpression
  to avoid repeated regex compilation in hot paths
  (e.g., domain validation during browsing/passkey operations).

refactor(urltools): Remove the unnecessary convertVariantToUrl function

format code

refactor(urltools): Include What You Use

refactor(urltools): Use URL_WILDCARD directly in implementation

refactor(urltools): some more inprovements

- code format
- use pure Qt functions for the string handling
- use chop to remove the last character of a QString
- make another QRegularExpression static const
2026-06-29 08:55:10 -04:00
Toni Spets 12bd15962e Bake Auto-Type plugins to the main binary
The plugin architecture wasn't very useful when we only had a single
plugin per platform before Wayland was added. Even with Wayland all the
dependencies are built into the main executable anyway making the plugin
a shim.

This fixes issues with the Wayland plugin that caused memory corruption
when allocations done from the plugin were free'd by the main
application. The plugin system was not meant to be used this way.
2026-06-29 07:10:43 +03:00
Arpit Jain ed0dc92fff Recognize {PGDN} Auto-Type placeholder
The {PGDN} placeholder is documented but only pgup/pgdown are registered
in g_placeholderToKey, so {PGDN} fails to resolve and aborts the rest of
the Auto-Type sequence.

Add pgdn as an alias for Qt::Key_PageDown, mirroring the existing
ins/insert and del/delete aliases (lookup already lowercases the
placeholder). Also assert {PGDN} in the syntax-check test.

Fixes #13379

Signed-off-by: Arpit Jain <[email protected]>
2026-06-28 23:55:15 -04:00
luo jiyin 003e7af49c Fix multiple spelling typos across codebase (#13424)
* fix(changelog,appdata,test): correct typos (ambigious→ambiguous, verticle→vertical, Localtion→Location, Bottons→Buttons, rectange→rectangle)

* fix(dbus,nixutils,keeshare,cr-recovery): correct typos (definiton→definition, executeable→executable, Certicate→Certificate, padd→pad)
2026-06-28 23:54:42 -04:00
Jess Sullivan b9bcbfc592 Fix: address #12631 2026-05-27 15:58:15 -04:00
Sami Vänttinen 7c7ca4575e WIP: Qt6 transition (#11651)
Update KeePassXC to use Qt 6.
2026-05-04 15:16:51 +03:00
Jonathan Whiteandvarjolintu aa0cac5c03 Refactor: move to simple default builds (#11003)
* Remove individual feature flags in favor of a single `KPXC_MINIMAL` flag that removes advanced features from the build. Basic features are no longer guarded by feature flags.
* Basic features: Auto-Type, Yubikey, KeeShare
* Advanced features include: Browser (and passkeys), SSH Agent, and Secret Service
* Networking, Documentation, and Update Checking remain as feature flags to accommodate various distro requirements.

This change also cleans up the main CMakeLists.txt by re-arranging some content and placing macros into a dedicated include file. The minimum CMake version was bumped to 3.16.0 to conform to our minimum Ubuntu support of Focal (20.04). This also allows us to default to C++20, we fall back to C++17 for Qt versions less than 5.15.0 due to lack of support.

Lastly this change removes the KEEPASSXC_BUILD_TYPE="PreRelease" which is never used. We only support "Snapshot" and "Release" now.

Additional cleanup of CMakeLists:

1. Removed always-true CMake version guard  if(CMAKE_VERSION >= 3.14.0)

2. Removed dead GCC 4.8 stack protector fallback; C++20 requires GCC 10+, and -fstack-protector-strong has been available since GCC 4.9.

3. Removed dead ASan LSan version guard for the same reason.

4. Converted set_target_properties( COMPILE_DEFINITIONS) to target_compile_definitions() on both keepassxc_core and keepassxc_gui. Both are now PRIVATE since the symbol is an internal build detail.

5. Scoped Qt5Gui_PRIVATE_INCLUDE_DIRS to keepassxc_gui preventing Qt-internal headers from leaking into every target in the build.

6. Use cmake_parse_arguments to cleanup test case definition macros. Remove test output formats as they are never used and can be controlled when tests are run.

* moved /fsanitize=address to compile options instead of definitions for MSVC builds

---------

Co-authored-by: varjolintu <[email protected]>
2026-04-18 22:37:30 -04:00
Jonathan White ad4a807e70 Fix the TOTP Gui test for Ubuntu Jammy
* For some reason the C locale setting is not respected in Jammy and the test fails due to attribute sorting
2026-04-13 06:04:12 -04:00
Jonathan White 379be00127 Add more entry types for Proton Pass importer
* Fixes #13130

* Add wifi and sshKey import types
* Add catch-all import type to prevent loss of data when Proton Pass introduces new things
2026-03-15 06:06:19 -04:00
Jonathan WhiteandJanek Bevendorff 56521023b8 Support TIMEOTP autotype and entry placeholder (#13117)
* Additional fix for #7263 to support KeePass2 placeholder for TOTP

---------

Co-authored-by: Janek Bevendorff <[email protected]>
2026-03-08 23:17:36 -04:00
Janek Bevendorff 5c91c9986a Mock datetime to avoid test failures on second lapse (#13115)
Fixes #13059
2026-03-08 22:26:10 +01:00
Sami Vänttinenandvarjolintu a1cddad37c Add support for nested folders with Bitwarden import (#13081)
Co-authored-by: varjolintu <[email protected]>
2026-03-08 16:18:22 +01:00
Sami Vänttinenandvarjolintu 2dd56c76cc Fix showing correct checkbox value in entry Browser Integration settings (#12980)
Co-authored-by: varjolintu <[email protected]>
2026-03-08 16:17:27 +01:00
Sami Vänttinenandvarjolintu 1ce2ce9bb8 Passkeys: Set BE and BS flags to true (#13042)
Passkeys: Set BE flag to true

---------

Co-authored-by: varjolintu <[email protected]>
2026-03-08 13:08:15 +01:00
Janek BevendorffandJonathan White ada379fddd Fix Linux test failures (#13113)
* Fix test failure introduced by ab31a748fa (#10993)

* Fix tray hiding test failure

Introduced by 43904d87b7 (#10928), but somehow hasn't posed an issue until now.

* Try to make attachment GUI test more robust

---------

Co-authored-by: Jonathan White <[email protected]>
2026-03-06 17:59:02 -05:00
Sami Vänttinen 01b49921fb Passkeys: Add publicKey to register response (#12757) 2026-01-17 14:01:13 +01:00
Jonathan White 97d4edd9b8 Take delays into account when Auto-Type TOTP values
* Fixes #12682
2025-11-23 16:13:26 -05:00
copilot-swe-agent[bot]anddroidmonkey a5c9ffbef7 Fix CSV import regression with root group names
Fix the issue where CSV export/import creates nested root groups when the database has a custom root group name.

Added comprehensive tests to verify the fix works for both custom and default root group names, and preserves existing behavior for single-level groups.

Implement heuristic approach for CSV import root group detection:

- Analyzes all CSV rows before processing to find consistent first path components
- Only skips the first component if it appears in 80% or more of paths
- Handles absolute paths (starting with "/") by ignoring them in analysis
- Preserves existing behavior when no clear common root is found

Co-authored-by: droidmonkey <[email protected]>
2025-11-23 13:09:23 +01:00
xboxones1 f39e0937b9 Fix markdown type for >= QT 5.15.18 (#12654) and advance vcpkg baseline
- Fix markdown type for >= QT 5.15.18 (#12654) 

- Fix deprecation warnings about implicit capturing of "this"

- Advance vcpkg baseline to fix macOS Qt building
  Fixes Qt build errors on macOS 26 Tahoe.
  See https://github.com/microsoft/vcpkg/pull/48298
2025-11-22 21:26:40 +01:00
Jonathan White e542070902 Allow for escape syntax to enable literal placeholders
* Fixes #11890
2025-11-09 10:45:07 -05:00
Sven Strickroth 44daca921a Escape accelerators
(fixes issue #12037)

Signed-off-by: Sven Strickroth <[email protected]>
2025-11-07 15:47:14 -05:00
592d553ff8 Add URL double-click action option to Settings (#12322)
* Closes #4717

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: juzu-o <[email protected]>
Co-authored-by: Jonathan White <[email protected]>
2025-11-02 12:32:11 -05:00
Jonathan White ebf0676661 Fix Auto-Type Empty Window Behavior
* Fixes #9282
* Also improve documentation for window title matching behavior
2025-11-02 10:16:41 -05:00
Siddhant ShekharandJonathan White d9ccf767d0 Sanitize username to prevent single-instance detection failure (#12559)
---------

Co-authored-by: Jonathan White <[email protected]>
2025-11-01 10:25:10 -04:00
682269f622 Bitwarden import: Add support for timestamps and password history (#12588)
* Closes #12587

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: droidmonkey <[email protected]>
Co-authored-by: Jonathan White <[email protected]>
2025-10-26 08:10:01 -04:00
5736c6379c Implement {UUID} placeholder and nested reference support (#12511)
* Closes #12509
* Implement the {UUID} placeholder
* Implement nested placeholder de-referencing when resolving entry references to support a reference like {REF:U@I:{UUID}} which is equivalent to {USERNAME} placeholder.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: droidmonkey <[email protected]>
Co-authored-by: Jonathan White <[email protected]>
2025-09-27 19:08:22 -04:00
Tamino BauknechtandJonathan White c0ea6f65f9 Database merge confirmation dialog (#10173)
* Add Entry::calculateDifference()

This new function contains the logic that was previously in
EntryHistoryModel::calculateHistoryModifications().
It allows the re-use to display the differences in case of a merge.

* Introduce Database Merge Confirmation Dialog

Adds a dialog allowing a user to review the changes of a merge operation.
This dialog displays the changes and allows the user to abort the merge
without modifying the database.

Fixes #1152

* Added dry run option to Merger
* Changed behavior when actual merge differs from dry run to just output a warning to console
* Fixed KeeShare conflicting with merge operations in the middle of a merge

---------

Co-authored-by: Jonathan White <[email protected]>
2025-09-14 12:02:22 -04:00
CopilotandJonathan White dd023ca157 Fix pre-release issues with attachment viewer (#12244)
* Fix translation issues for "FIT" and "New Attachment" in attachment editor

* Fix markdown preview persistence and enable external links in attachment editor

* Update preview panel if manually moved from collapsed position

* Match edit view scroll position (by percentage) when changed. This ensures the preview remains in relative sync with the edited document, for example when a large amount of HTML reduces down to a short preview document.

* Fix default preview size to be half the width of the edit widget.

* Set tab stop to 10 and remove base ui file

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Jonathan White <[email protected]>
2025-09-08 06:22:20 -04:00
Jonathan White 7ea141652e Update base translations and improve consistency (#12432)
* Improve confirmation prompts and tooltips for delete actions in the GUI

* Fixes #10543
2025-09-07 20:16:36 -04:00
Jessy LANGEandJonathan White 7ec0f1f5a8 Add "press enter to search" option (#12263)
* Also increase auto-search timeout to 500 ms to improve user experience, especially with large databases. The previous value of 100ms guaranteed a search was performed after every character entered, even when typing relatively fast. 

---------

Co-authored-by: Jonathan White <[email protected]>
2025-07-06 14:16:25 -04:00
Jonathan White 76b2f377df Enforce new-line at end of code files 2025-07-06 11:50:24 -04:00
Jonathan White 74326616c5 Fix two problems with URL wildcard matching
* Fixes #12255
* Periods were not being escaped in the url string before being used in a regex resulting in matching 'any character' between domain parts
* Wildcards entered as `*.` were being replaced with simply `*` resulting in unexpected matches to occur. Fixing this has a side effect of `https://*.github.com` NOT matching `https://github.com` which should be the expected behavior. Users can enter both url's if they desire to match the primary and all sub domains or leave out the wildcard entirely to use normal matching behavior.
2025-07-04 09:06:27 -04:00
Jonathan White f62ea95499 Don't add space to invalid TOTP strings
* Fixes #11357
* Introduces validity parameter to TOTP generator function for future use elsewhere in the code base
* Fixes this in preview panel and TOTP dialog
* Disable actions to copy/show TOTP if the settings are invalid
* Show an error message on the TOTP setup dialog if the settings are invalid
* Show a TOTP icon with an x if the settings are invalid
2025-06-19 16:22:17 -04:00