Commit Graph

751 Commits

Author SHA1 Message Date
varjolintu
c0796d8fb1 Add option to use entry only for HTTP Basic Auth 2019-12-21 17:28:27 -05:00
varjolintu
c0f29cc790 Show UI warning for invalid URLs 2019-12-21 09:22:16 -05:00
Jonathan White
8e76c30dd1 Prevent reloading database while editing an entry or group
* Fix #3933 and  fix #3857. Interaction with entries and groups is disabled while the database is being reloaded or saved to prevent changes from occurring. Prevent the database from being reloading if an entry or group is currently being edited.

* Fix #3941 - Only notify components when the database file actually changes (determined by checksum). This prevents spurious merge requests when the file is merely touched by another service (e.g., DropBox).

* Fix code format of ElidedLabel.cpp
2019-12-14 21:26:12 -05:00
Jonathan White
f9cb2bd5df Correct multiple issues with database saving
* Mark the database as clean after fully completing the file save operation INSTEAD of when merely writing the database to a file.

* Stop the modified timer when marking the database as clean, this prevents latent erroneous modified signals from being emitted.

* Do not restart the modified timer after a new change is detected while it is still running.
2019-12-14 21:26:12 -05:00
Balazs Gyurak
c0b1c9e106 Run code formatter 2019-11-23 10:07:39 -05:00
Jonathan White
dc6c9186c9 Fix start minimized to tray for unix 2019-11-23 09:53:40 -05:00
Jonathan White
d3978980d2 Perform file hash checks asynchronously (#3815) 2019-11-09 14:02:34 +01:00
Janek Bevendorff
5996ba51c9 Use PasswordKey for storing transformed secrets.
The transformed secrets were stored in normal QByteArrays,
which are at risk of being swapped out. We now use secure
PasswordKey objects instead. There are still a few areas
where QByteArrays are used for storing secrets, but since
they are all temporary, they are less critical. It may be
worth hunting those down as well, though.
2019-11-09 11:33:32 +01:00
Janek Bevendorff
22af66e3b5 Ensure database contents are released right away.
When we lock a database, we reset the database pointer to
free its resources. Since various other widgets besides the
DatabaseWidget hold references to the shared pointer object,
however, it cannot be guaranteed that the actual database
object will be freed right away. This patch adds a releaseData()
method which is called upon database lock to ensure all
residual data is cleared without having to rely on the actual
database object being cleaned up.
2019-11-09 11:33:32 +01:00
Jonathan White
4edb623745 Prevent recursive loads using AutoOpen
* Fix #3334 - AutoOpen is now processed after the database widget is put into view mode to prevent infinite recursion of unlock attempts if two databases  auto open each other.
2019-11-09 00:53:40 +01:00
Aetf
b96c1e92a3 Expose EntrySearcher's SearchTerm for internal code usage 2019-11-08 17:37:50 -05:00
Aetf
329701a34e Secret Service Integration Fixes (#3761)
* FdoSecrets: create prompt object only when necessary

* FdoSecrets: negotiationOutput should always return a valid QVariant otherwise QDBus will fail to create a reply, causing timeout in client.

* FdoSecrets: include in debug info
2019-11-07 21:28:49 -05:00
Rafael Sadowski
38a663163d Check include malloc.h and malloc_usable_size(3)
One some operating systems  malloc(3) is not in malloc.h nor in
malloc_np.h, instead it is in stdlib.h.

In addition, not all systems support malloc_usable_size(3). You could
argue it's not safe.

This patch tries to be portable and it fix the build on OpenBSD.
2019-11-01 22:54:24 -04:00
asapelkin
98badfb4a2 some cppcheck and clang-tidy fixies 2019-11-01 22:53:28 -04:00
Jonathan White
36e14157be Significantly reduce impact of FileWatcher hashing (#3724)
* Fix #3699

Reduce file watch hashing of open database files from every second to every 30 seconds. Additionally, only hash the first 1024 bytes of the database file. This is valid since most of the header and the entire encrypted portion are changed significantly on every save.
2019-10-30 11:40:56 +01:00
Janek Bevendorff
6a25c8dc84
Force app exit if session manager signals a shutdown. (#3666)
Resolves #3410.

Additionally, "fix" main window toggling behaviour when
clicking the tray icon while the window is visible, but
not in focus (e.g. hidden by other windows). On platforms
other than Windows, the window is now brought to the front
if it does not already have focus or is toggled otherwise.

Remove obsolete Windows session end handling code.
2019-10-26 16:14:28 +02:00
Chih-Hsuan Yen
7c6c027d33 Fix building on Mac OS X 10.11 or older
* Add a missing include in src/core/Alloc.cpp

On Mac OS X 10.11 with Xcode 8.2.1, building fails with

/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_security_KeePassXC/KeePassXC-devel/work/keepassxc-f726d7501ff7e8a66ae974719042f23010716595/src/core/Alloc.cpp:44:10: error: no type named 'free' in namespace 'std'
    std::free(ptr);
    ~~~~~^

Per [1], std::free() needs #include <cstdlib>. That file is included
indirectly on newer systems.

* Avoid const Signature object in src/keeshare/ShareExport.cpp

After the above issue is resolved, building fails at

/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_security_KeePassXC/KeePassXC-devel/work/keepassxc-f726d7501ff7e8a66ae974719042f23010716595/src/keeshare/ShareExport.cpp:152:29: error: default initialization of an object of const type 'const Signature' without a user-provided default constructor
            const Signature signer;
                            ^

Apparently this is related to C++ defect 253 [2]. From the code,
creating a Signature is not needed as all methods in Signature are
static, so just call the method.

[1] https://en.cppreference.com/w/cpp/memory/c/free
[2] https://stackoverflow.com/a/47368753
2019-10-24 18:56:33 -04:00
Jonathan White
af263fd80d Prevent new entry loss on database file reload
* Fix #3651

* Correct data loss when the database reloads due to a file change while creating a new entry. The issue occurred due to the "new parent group" pointer being invalid after the database is reloaded following merge.

* Also fix re-selecting entries following database file reload. If the entry was moved out of the current group it would result in an assert hit. This fix prevents recursively looking for the entry.
2019-10-23 22:47:59 -04:00
Jonathan White
1e694271a3 Improve Database and CLI tests 2019-10-20 18:56:41 -04:00
Jonathan White
744b4abce8 Move FileWatcher into Database class
* Fix #3506
* Fix #2389
* Fix #2536
* Fix #2230

Every database that has been opened now watch's it's own file. This allows the database class to manage file changes and detect fail conditions during saving. Additionally, all stakeholders of the database can listen for the database file changed notification and respond accordingly.

Performed significant cleanup of the autoreload code within DatabaseWidget. Fixed several issues with handling changes due to merging, not merging, and other scenarios while reloading.

Prevent database saves to the same file if there are changes on disk that have not been merged with the open database.
2019-10-20 18:56:41 -04:00
Jonathan White
6b746913e4 Cleanup database save functions
* Make a clear distinction between saving to the existing file path and saving to a new file path
* Use proper save function calls in CLI
2019-10-20 18:56:41 -04:00
Mark Hakansson
a876b3b72f Prompt to delete recycle bin when disabling it
Fixes #3365

Add prompt to delete the recycle bin when disabling it. If the user chooses not to delete it, the recycle bin will be suffixed with "(old)" and the icon changed to the default group icon.

Also moved recycle bin creation within the database class where it belongs.
2019-10-20 17:58:15 -04:00
Jonathan White
99a2d66086 Correct issues with TOTP Setup
* Fix #3142 - Warn user when entering invalid TOTP secret key.
* Fix #773 - The TOTP dialog now listens for the copy shortcut without having to press the Copy button.

* Add ability to choose hash algorithm from the TOTP setup dialog
* Add upgrade to "otp" attribute when custom attributes are chosen to prevent data loss

Ran make format
2019-10-20 17:57:51 -04:00
varjolintu
f726d7501f Add support for multiple URLs in an entry
* Fixes #398

The new Browser Integration entry settings page has a list view with any additional URL's. These URL's are added to the entry attributes with KP2A_URL_<counter>, which means those are directly compatible with Keepass2Android.
2019-10-16 22:20:57 -04:00
Jacob Sachs
dbe15d32e5 CLI: Add Import XML command (#3572)
The CLI now contains an "import" command that creates a new database from the specified XML export. The new database is in kdbx 4 format, and does not currently accept a keyfile in database creation.

This change is required to create new databases from XML backups.

Fixes #2458
2019-10-15 22:10:45 -04:00
Wolfram Rösler
8afb1f17b4 Add "Statistics" page to Database Settings dialog (#2034)
Added new page "Statistics" to the Database Settings dialog that shows information like number of groups and entries, number of unique and re-used passwords, average password length, etc.
Show warnings for problematic values with explainations for the user in tooltips.

Fixes #2034

Database statistics icon:
Downloaded from: https://www.flaticon.com/authors/freepik
Original source: https://www.flaticon.com/free-icon/bars-chart_265733
2019-10-13 12:24:27 -04:00
libklein
058b4da954 Fix entry clone modification time update (#3602)
* Add test for (unwanted) history timeinfo update when cloning entries.
* Add timeInfo test for clone with rename.
* Fixed modification time update when cloning an entry with renaming.
2019-10-05 13:58:00 -04:00
louib
c19703c39f Merge custom data only when necessary (#3475) 2019-09-16 14:01:13 -04:00
Akinori MUSHA
41131ae48d Allow abbreviation of search field names
This allows `t:word` instead of `title:word` and `p:word` instead of `password:word`, and so on.  The rule is that an abbreviated name expands to the first field name that starts with it, with exceptions
`u:` expanding to `username:` instead of `url:` and `pw:` expanding to `password:`.
2019-09-04 22:31:15 -04:00
Frederic Linus Schulz
0a3b19edf2 Add checkbox to allow minimize after database unlock.
Default option is set to off
2019-09-02 21:53:16 -04:00
Gianluca Recchia
c12fd369d9 Save to canonical path when dealing with symlinks 2019-08-30 22:21:26 -04:00
Jonathan White
2aac83d03b
Improve handling of read-only files (#3408)
* Fix #3407
* Read-only files now disable auto-save and show as modified correctly. This allows the GUI to prompt to "save-as" instead of silently discarding changes when the read-only database is locked or closed.
2019-08-30 21:39:37 -04:00
Jonathan White
3b330ee2d1
Improve accessibility (#3409)
* Add application settings reset button
 - Corrects accessibility findings GP.2

* Use icons in addition to color to indicate password mismatch
 - Corrects accessibility finding CN.2

* Announce begin/end of list navigation
 - Corrects accessibility finding KF.4

* Fixes for keyboard navigation
 - Add Ctrl+F10 keyboard shortcut to show group/entry context menus. Fixes #3140
 - Improve movement between form fields

* Fix loading system-defined language in translator
 - Fixes #3202
 - Bypass built-in Qt loading of QLocale for translations. The order of loading languages doesn't consider all file names prior to moving to the next language in the list. This resulted in English being chosen no matter what language is the top priority.

* Improve message box defaults and fix documentation links

* Better support for screen readers

* Add accessible names on form fields

* Prevent changing values during settings widget scrolling
 - Add an event filter to combo boxes and spin boxes on the settings page to prevent the mouse wheel from changing the values without having focus
 - Add horizontal stretch to the security settings to make the spin boxes more manageable.
2019-08-30 20:18:41 -04:00
Ziah Jyothi
726dbc004d Add setting for search results timeout (#3411)
* Fix #3400
* Allow enabling/disabling search timeout
* Allow setting search timeout in minutes
2019-07-30 23:44:34 -04:00
Sami Vänttinen
6ae27fa47b Download all favicons (#3169)
* Selecting one or more entries to download icons always forces the download (ie, if a new URL exists the new icon will be downloaded and set)
* Instead of downloading for each entry, the web url's are scraped from the provided entries and only those urls are downloaded. The icon is set for all entries that share a URL. This is useful if a group contains many entries that point to the same url, only 1 download call will occur.
* The icon download dialog displays whether you are doing one entry, many entries, or an entire group. It is also modal so you have to dismiss it to use KeePassXC again.
* Moved DuckDuckGo fallback notice into the download dialog.
2019-07-07 15:29:11 -04:00
Jonathan White
aac76ad407 Add ability to export database as HTML for printing 2019-06-30 15:29:36 -04:00
Balazs Gyurak
8e248bbde6 Drop to background on copy feature 2019-06-29 07:34:41 -04:00
Jonathan White
d49e74c1f4 Add monospaced font option for Notes field 2019-06-28 22:23:57 -04:00
Jonathan White
0e0cba653f CLI: add 'analyze' subcommand for offline HIBP breach checks
This new subcommand checks all passwords in the given database against a given list of SHA-1 password hashes. Such lists are available from the "Have I Been Pwned" project at https://haveibeenpwned.com/Passwords.

Note that this support offline checking only. The HIBP project also provides a web API for checking specific hash ranges; this is not currently supported.
2019-06-25 15:37:40 -04:00
Matthias Drexler
f85642741d Autocomplete usernames based on most frequent in database
* Fixes #3126
* Limit autocompletion to the top ten used usernames
- Load common usernames when database is opened
- Transition from QLineEdit to QComboBox for usernames
- Dropdown menu of the combobox lets user choose a common username
- Common usernames are autocompleted via inline completion
- Common usernames are sorted by frequency (first) and name (second)
2019-06-23 22:22:57 -04:00
Jeff
a22e8a1f40 Add MinimizeOnUrlOpen feature 2019-06-23 12:04:24 -04:00
Tobias Kortkamp
ef3c2daef1 Unbreak build on FreeBSD (#3304)
* Unbreak build on FreeBSD

```
In file included from src/core/Alloc.cpp:24:
/usr/include/malloc.h:3:2: error: "<malloc.h> has been replaced by <stdlib.h>"
 ^
src/core/Alloc.cpp:65:28: error: use of undeclared identifier 'malloc_usable_size'
    ::operator delete(ptr, malloc_usable_size(ptr));
                           ^
2 errors generated.
```

Non-standard APIs like `malloc_usable_size()` [1] are defined in
`malloc_np.h` on FreeBSD, so use it instead of `malloc.h` there.

[1] https://man.freebsd.org/jemalloc(3)

* Allow Browser HostInstaller to work on FreeBSD and other OS's

* Drop custom GNUInstallDirs cmake module and use cmake's own module

It seems to be an outdated version and cmake generally provides it
itself, so there should be no need for keepassxc to provide its own
custom version.

On FreeBSD this fixes the issue that man pages were installed into
the wrong directory, i.e., `/usr/local/share/man` vs `/usr/local/man`
as per FreeBSD's current packaging policy.

Signed-off-by: Tobias Kortkamp <tobik@FreeBSD.org>
2019-06-22 08:18:47 -04:00
AndrolGenhald
e40f10657d Fix keepassxc-browser password entropy display (#3107)
* Pass correct entropy amount to keepassxc-browser instead of amount of bits for both password and passphrase.
* Rename json key from "login" to "entropy" (keeping "login" key for backwards compatibility).

* Also make some changes to entropy calculation methods:
  - Rename PassphraseGenerator::calculateEntropy to estimateEntropy
  - Rename PasswordGenerator::calculateEntropy to estimateEntropy
2019-06-19 20:40:41 -04:00
Matthias Drexler
bb8377ae6a Allow setting group icons to children groups/entries (#3273)
* Add combo menu button to apply an icon to children

- allow more options to apply icons (child groups, child entries)
- extend tests in TestGroup (applying icons for groups/entries only)
- prevent blue folder icon being set for entries (on entry creation only)

* Do not show the combo menu button for entries
2019-06-19 10:02:07 -04:00
louib
84eec03cb7 Add CLI --dry-run option for merge (#3254) 2019-06-18 21:45:24 -04:00
Balazs Gyurak
05c11d1b7c CLI: Add 'flatten' option to the 'ls' command (#3276)
* Fixes #925 
* Add 'flatten' option to CLI ls command
* Add test for Group::hierarchy() and man page for ls --flatten
* Rename group sort test to align with others
2019-06-18 20:42:19 -04:00
Balazs Gyurak
09181fab13 Add group sorting feature
* Enabling sorting of groups and their children in ascending and descending direction
2019-06-18 18:51:38 -04:00
shaneknysh
7ead8e7290 Add word case option to passphrase generator (#3172)
* Closes #1933
* Adds word case options for lower, UPPER, and Title Case to passphrase generation
2019-05-24 18:23:19 -04:00
Jonathan White
2ee97ed191 Code formatting 2019-05-19 18:21:34 -04:00
Aetf
d93f33f514 Improve existing code prior to implementing FDO Secrets
* DatabaseTabWidget::newDatabase returns the created DatabaseWidget
* Emit DatabaseTabWidget::databaseOpened signal before a new tab is added
* EntrySearcher can now search attribute values including custom ones
* Add Group::applyGroupIconTo to set the group icon on the supplied entry
* Implement desktop notifications through the system tray icon
* Add DatabaseWidget::deleteEntries to delete a list of entries
* Add Aes128 in SymmetricCipher::algorithmIvSize
* Add DatabaseWidget::databaseReplaced signal
* Add a helper class to override the message box's parent (prevent bugs)
2019-05-12 12:35:42 -04:00