KeePassXC offers to rename the default database on non-English locales
Hello,
By default, when creating a new password database, KeePassXC offers to save it using a localized file name by default (e.g., if Tails was started with the French language, Mots de passe.kdbx
):
oldFilePath =
QDir::toNativeSeparators(config()->get(Config::LastDir).toString() + "/" + tr("Passwords").append(".kdbx"));
(from src/gui/DatabaseWidget.cpp:1872-1873
)
However, the default database name configured as LastOpenedDatabases
in /etc/skel/.config/keepassxc/keepassxc.ini
is always Passwords.kdbx
, whatever the selected language. The same goes for the /usr/local/bin/keepassxc
script.
This discrepancy can lead to a warning message, which can be reproduced as follows:
- Start Tails with a non-English locale (at least, a non-English language; e.g., French).
- Start KeePassXC, create a new password database, and save it using the default name suggested by KeePassXC (e.g.,
Mots de passe.kdbx
), under the persistent volume. - Close KeePassXC and start it again.
Upon starting KeePassXC again, the keepassxc
script will then open a dialog window and offer to rename the newly created database to Passwords.kdbx
(“Do you want to rename your KeePassXC database?”, etc.). I'm afraid that this may be slightly confusing for a new user, who followed the default steps and is then told that the name they used for the database wasn't, in fact, the default one.
Unfortunately, I couldn't think of any simple and satisfying way to solve this:
-
One could patch the KeePassXC translation files so that
tr("Passwords")
always translates to"Passwords"
, so that KeePassXC always offers to save the new database toPasswords.kdbx
. However, this would require a binary patch, and this might also prevent other instances ofPasswords
in KeePassXC from being properly translated. -
Alternatively, one could patch the default KeePassXC configuration file
/etc/skel/.config/keepassxc/keepassxc.ini
and the launcher script/usr/local/bin/keepassxc
so that they always use the localized name for the default database. However, if a user doesn't always use the same language localization when starting Tails, thekeepassxc
script will offer to rename the database file after each switch from one language to another; and even if the user chooses to stop the script from prompting for this option, the defaultkeepassxc.ini
will not always be in sync with the actual name of the database, and KeePassXC will not always be able to automatically open the database, which might also be confusing for the user. -
Maybe a third possibility would be for the launcher script to check if the
~amnesia/.config/keepassxc/keepassxc.ini
is the default one (i.e., that it actually comes from the/etc/skel
, and that it wasn't overwritten by a previous KeePassXC session) and, if so, tries to find whether there is a.kbdx
file in thePersistent
folder whose name is one of the possible KeePassXC-localized versions ofPasswords.kdbx
(maybe with a higher priority for the current language locale if there are several matches), and patch the~amnesia/.config/keepassxc/keepassxc.ini
file to have theLastOpenedDatabases
setting point to this file instead. However, the behavior of KeePassXC would still depend on the session's language locale. -
Along the same lines, the
LastOpenedDatabases
setting for KeePassXC can specify a comma-separated list of several database files. Each existing file in the list is then opened, and missing files are ignored silently (seesrc/core/Bootstrap.cpp:118-123
). Therefore, if the default configuration file/etc/skel/.config/keepassxc/keepassxc.ini
was to specify all possible localized versions ofPasswords.kdbx
in theLastOpenedDatabases
setting, KeePassXC would automatically open any database file whose name corresponds to a localized name for the default database in KeePassXC. However, if the user has several matching database files in theirPersistent
folder (e.g., if they have bothPasswords.kdbx
andMots de passe.kdbx
), KeePassXC would then open them all. -
Maybe a simpler solution would be to update the translations of the KeePassXC documentation in the Tails wiki (such as here, for the French translation) and to advise users to save their password database as
Passwords.kdbx
, regardless of the default name suggested by KeePassXC? Of course, this would only fix the issue for users following the Tails documentation, but that may be an acceptable middle ground.
In any case, whatever the retained solution, I'm OK to try and work on a patch and propose a merge request along the lines you would deem to be the best.
Also, apologies for this overly long report and for the absence of a proper solution to such a tiny issue!
Thanks a lot in advance!
snip