* 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]>
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]
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
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.
* 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]>
* 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]>
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
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.
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]>
* 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]>
* 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]>
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]>
- 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
* 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]>
* 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]>
* 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]>
* 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]>
* 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.
* 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