This is a Windows only feature that uses policies set in the registry to control settings in KeePassXC. Overrides are set in HKLM\Software\Policies\KeePassXC and uses the same structure as the ini settings file. Overridden settings are disabled in the user interface and their values are not written to the user's own settings file.
Under QT_QPA_PLATFORM=offscreen the X11 native interface exists but has no
display, and DefaultRootWindow() dereferenced the null pointer at startup.
The global shortcut code already checks for a null display.
DatabaseWidget::lock() returned early when its autosave failed and a reload
began, without clearing m_attemptingLock. Every later lock() then returned at
the m_attemptingLock check, so the database could not be locked again until
KeePassXC was restarted.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
QDBusAbstractInterface::isValid() can latch an empty service owner
cached while xdg-desktop-portal is still activating, permanently
disabling auto-type and the global shortcut. Use the interfaces'
version() property reads instead: real blocking calls that trigger
activation if needed and return 0 only on failure.
* Fixes a specific warning that spams the console due to a deprecated signal that was used to indicate checkboxes state changed.
* Converted all QCheckBox::stateChanged(int) to QCheckBox::toggled(bool). All functionality still works as intended.
* Fix Secret Service message being null in some cases when unlocking a database
* Update changelog
---------
Co-authored-by: Janek Bevendorff <[email protected]>
* 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]>
parseGroupTreeState() retrieves the number of record tree states from a 32-bit integer. It then calculates the number of bytes to read as num * 5, which is checked against the actual buffer length. The multiplication occurs as quint32, which wraps at 2^32. An attacker could craft a 32-bit value that wraps to match the observed buffer length. The following loop, however, uses num directly and may thus loop millions of times, reading beyond the end of the buffer.
No bytes are written and the minimum number that wraps is 2^32 / 5, which is well beyond any reasonable buffer size. Hence this is exploitable only as a denial of service. Given that this requires a crafted KDB file, there are easier ways to make the contents of a file unreadable.
Previously KDE Plasma implicitly bound them on session start but this
behavior was recently changed so it is now always required to bind them
which is correct according to spec. Our workaround was only needed for
fairly old KDE releases.
Because depending on the version and type of the desktop portal the
behavior might be all over the place we will always list the shortcuts
first as they might be active on session start and calling BindShortcuts
might fail and not give us the list back making our UI stale.
Docs have been updated to indicate version support for both KDE and
GNOME.
* Use C++ allocation in zlib
Marginally reduces the chances of decrypted database fragments remaining in memory.
Addresses CVE-2024-33901, but does not fix the main issue. For a proper solution, we need to replace QXmlStreamReader with something else.
* Fix Linux build always falling back to std::free() branch due to undefined HAVE_MALLOC_USABLE_SIZE
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]>
CSV files exported by KeePassXC always use English canonical headers.
When the UI locale translated field labels, only untranslated names
(URL, TOTP) matched. Also match the English export headers so
re-import works regardless of UI language.
Fixes#13523
* refactor(LineReader): Make use of the LineReader class in a much simpler way
The LineReader is made a concrete class whose declaration is independent of the readline library. Only its implementation depends on the presence or absence of the readline library. The LineReader code is embedded in a new library : line_reader, to make the cli library independant of the USE_READLINE definition.
* refactor(readline): better FindReadline module
The readline library is now searched with pkg-config first. If pkg-config is not installed, the search is manual. In both cases, the Readline::readline target is created, embedding transitive requirements.
FindReadline module was written with the help of Le Chat AI (https://chat.mistral.ai/chat)
---------
Co-authored-by: Jonathan White <[email protected]>