IconDownloader::setUrl resolved the entry's host name with the blocking QHostInfo::fromName on the GUI thread, only to find out whether the host is an IP address. When the DNS servers are slow or unreachable, the whole window stopped responding until the lookup timed out.
Check the host with UrlTools::isIpAddress instead, which parses the literal address without any network access. Also add IPv6 literal cases to the icon downloader tests.
Fixes#13989
Botan 3.14 randomizes ECDSA signatures by default, even when RFC 6979
is available, so the exact signature bytes are no longer reproducible
and the EC passkey tests fail. Verify the signatures produced by
buildSignature() against the public key embedded in the signing key's
PEM instead, which validates both deterministic and randomized
signatures.
Reject KeeShare references without a UUID and prevent synchronous reentry during import. A missing UUID previously got assigned a random UUID on each parse, causing equality checks to evaluate to false. During the merge, group removal signals could then trigger a nested import, leading to recursive destruction and use-after-free.
References without a <Group> are now rejected, nested imports are blocked by reentrance guards, and regression tests are added.
Additionally fixes file change updates arriving during a running import being silently dropped. These updates are now queue for later execution.
Sometimes KeePassXC did not restore the window geometry properly. This change moves the geometry restoration to before showing the window. That should fix issues especially when the window is moved to another monitor on Wayland, but it may also resolve other strange quirks that can happen when the window starts in the tray.
* 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