Open lopopolo opened 7 years ago
Yep.
The issue is with MainWindow::lockDatabasesAfterInactivity()
, which is called by MainWindow::handleScreenLock()
: it doesn't lock DBs if there's an open modal dialog.
Making it always lock is an easy fix, but maybe the lockDatabasesAfterInactivity()
should be changed instead, so it doesn't consider the About dialog as a reason not to lock.
Additionally it doesn't lock if you have unsaved changes. I don't know how that should be handled.
Save to a temporary file and lock both databases? Does it need its own issue or can it be discarded as intended behavior?
Additionally it doesn't lock if you have unsaved changes. I don't know how that should be handled.
We can avoid this by disabling setting "lock databases" settings if "autosave db" is not enable. Not the best option for user experience but better for security.
@sainaen
Making it always lock is an easy fix, but maybe the lockDatabasesAfterInactivity() should be changed instead, so it doesn't consider the About dialog as a reason not to lock.
I agree with that. Here's the original reason for not locking when a modal is open (from commit 721bec97949):
Make sure we don't lock the database while a dialog is open.
This can happen when
- the user is picking out a file to save the database as
- a dialog asking the user to save/discard/cancel the current database
changes is active
It is dangerous to lock the databases while these actions are still
in progress.
MainWindow::lockDatabasesAfterInactivity()
could prevent locking for the cases deemed dangerous, but proceed with locking for the other cases (including the about window, for example).
@keepassxreboot/core-developers what do you think? I don't know how easy that fix would be.
MainWindow::lockDatabasesAfterInactivity() could prevent locking for the cases deemed dangerous, but proceed with locking for the other cases (including the about window, for example).
I think it's the right thing to do. Maybe using a flag to prevent locking, setting the flag to true when a dangerous action is being made. Can someone look into this?
I'm available for this task!
On 12 Sep 2017 1:22 pm, "TheZ3ro" notifications@github.com wrote:
MainWindow::lockDatabasesAfterInactivity() could prevent locking for the cases deemed dangerous, but proceed with locking for the other cases (including the about window, for example).
I think it's the right thing to do. Maybe using a flag to prevent locking, setting the flag to true when a dangerous action is being made. Can someone look into this?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/keepassxreboot/keepassxc/issues/721#issuecomment-328823250, or mute the thread https://github.com/notifications/unsubscribe-auth/AMqpZPKVGmFg7S6R8IQAWR6U73xGVOEPks5shmmCgaJpZM4OJ1uD .
I am moving this to 2.3.0 because it may require refactoring how saving and other settings are handled.
Is this fixed in v2.3.0? Or will it be tackled in #1234 ?
It's not fixed and #1234 won't fix it
Thanks, I was confused because the milestone still says 2.3.0.
v2.3.0 is still in development (ie not released)
Sorry, my bad. I read the release 2.2.4 as 2.4.2.
I had locked the desktop by Win+L, but when came back there was the following window. It was expected the database would have been mandatory saved then locked (disclosure: longtime Keepass user). There are internal history and recycle bin along with external backups to roll back if something wrong happens. I am glad this was caught with the test database, outside the production environment. Perhaps we should create a Pitfalls section on the front page to warn about “known but so far unresolved sensitive issues”?
Could it be a solution to make an option in settings: "Autosave changes (if nessecary) when auto-locking KeePass"?
The auto-lock is very unusefull when it doesn't lock the database sure. Because when notebook is closed f.E. and KeePass is forgotten, then an open database with security data is in system. This is -in my opinion- the worst case.
Best regards Andreas
(using KPXC 2.3.4)
Yes there should be a setting that the user can toggle which would be something like:
"When automatically locking databases, perform the following action:"
Option 2 would save the database to a temporary file (eg, passwords.kdbx.temp). When this database is next unlocked, the user would be prompted to merge changes from passwords.kdbx.temp. Ideally this would be coupled with the ability to actually see what those changes are. This is covered by a different issue.
https://github.com/keepassxreboot/keepassxc/issues/721#issuecomment-474123157 seems the right way to go from the UX-point of view, but IMHO option 2 should be the default!
...i still don't get it why auto-save got the default, but that's another story. :confused:
(continuing from #6593)
It does deserve some attention though. It's been marked high priority, but has been put off since version 2.2.
Not put off, we have been fixing this per-dialog as we find problems. That issue mainly centers around what to do with a modified database on lock.
Wouldn't this comment be the general solution that should be applied to all dialogs except the few dangerous cases that were outlined in this earlier comment?
Rather than chasing this bug one dialog at a time, identify which specific cases are dangerous, and then apply the general solution everywhere else.
Actually, I'd even argue that the middle option of the proposed solution (save to temporary file, then merge) is still safe even for the two cases already identified as dangerous:
- the user is picking out a file to save the database as
- a dialog asking the user to save/discard/cancel the current database changes is active
In both cases, the changes are saved to a temporary file, and both DBs are locked. Thus, both the changes and the original DB are safely preserved, and the process can be resumed when appropriate.
So I propose the following extended solution:
Anyway, the MVP is still just to add that setting and apply the selected action to all safe dialogs. The above extra handling of the dangerous dialogs can be implemented separately.
Not sure if this is the right place but as all the other lock issues got linked here and closed elsewhere, I'd like to add my lock issue here too: I'm on Ubuntu 20 and always keep KeePassXC in the background, but no other dialog is open and no changes have been made. When locking the desktop and coming back later, the database of KeePassXC is locked too, as expected. But it seems, that only works for a period of time (locking once per day for a couple of days) and then suddenly doesn't work anymore. As if a service or system status wasn't functioning properly after a while.
I know, this is such a vague issue description, that it's impossible to help based on this. I'd be happy to dig into the logs, if I only knew what I should be looking for. Anyone with an idea, what component could possibly influence that behavior for that matter?
Locking keepassxc when the computer locks depends on a dbus signal that is sent out by your screen lock program. No signal, no lock. Check that dbus signal is being emitted every time your desktop locks.
There is this signal when locking:
signal time=1631695790.794009 sender=:1.33 -> destination=(null destination) serial=15758 path=/org/gnome/SessionManager; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.gnome.SessionManager"
array [
dict entry(
string "SessionIsActive"
variant boolean false
)
]
array [
]
and that one when coming back:
signal time=1631695790.794009 sender=:1.33 -> destination=(null destination) serial=15758 path=/org/gnome/SessionManager; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.gnome.SessionManager"
array [
dict entry(
string "SessionIsActive"
variant boolean false
)
]
array [
]
What's interesting: having a radio stream on, that gets properly interrupted when locking this way, but KeePassXC doesn't.
Yah that isn't going to cut it, here is the code which is very readable that shows the signals listened for. This is decidedly another issue then this one but had also come up before.
As lock issues have been linked and discussed here, I'm commenting here.
Beside the other aspects already brought up in this thread, it seems necessary to decide:
what actions should enable the save button, like:
whether the user should be able to select these/some of these via options in settings. Currently there is only an option to auto-save non-data changes.
Expected Behavior
When the setting "lock databases when session is locked or lid is closed" is enabled, the database should be locked on sleep even if the about menu is showing
Current Behavior
Database remains unlocked with about menu active
Possible Solution
Steps to Reproduce (for bugs)
Context
Debug Info
KeePassXC - Version 2.2.0 Revision: caa49a8ef3ee28ed478192389b21d61107b3b8e0
Libraries:
Operating system: macOS Sierra (10.12) CPU architecture: x86_64 Kernel: darwin 16.6.0
Enabled extensions: