Repository navigation
fix(lock): lock at launch once the auto-lock time has passed (#510) - #593
Merged
Merged
Conversation
The idle timer only lived in memory, so force-closing the app and reopening it after the timeout signed straight back in. The last activity is now written to `<config_dir>/last-active` (on change, at most every 5 s, and when the app is hidden). A fresh launch past the timeout, or any launch with Immediately, applies the configured lock before auto-login. Reloads of the running app are not launches. With no recorded activity the launch fails closed. A local account that never wrote a secret had no secrets.enc. Lock vault then landed on onboarding, and with no file to check, any password would have opened it. Unlocking now writes the empty vault when it is missing, and the splash treats any local or cloud account as one to unlock. Closes #592
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #510, from the reporter's comment: force-closing the app and reopening it after the auto-lock timeout did not lock.
Cause
useSessionExpirationkept the last activity only in memory and reset it at mount. A cold start went straight to auto-login, so the timeout was never checked across a restart. #591 hides this on Android once the key is sealed, because every launch prompts. It still applies before the first seal, to no-password accounts, with system authentication off, and on desktop.Change
LastActivestores the last user activity in<config_dir>/last-active(app_lock_touch/app_lock_last_active), written synchronously so a kill right after backgrounding keeps it.lockOnLaunchIfIdle()runs once per process (a sessionStorage flag, solocation.reload()is skipped). It locks when the effective timeout (including the org policy) has passed, when Immediately is set, or when no activity was ever recorded (fails closed). It uses the same lock kind and action aslockApp, now shared throughlockKind()/engage().#592: Lock vault on a local account with no secrets.enc
SecretsStore::unlockwrites the empty vault when the file is missing (best-effort, logged). From then on there is always a file to check a password against. Before this, with no file,keyThatOpensVaultaccepted any password.hasAccountToUnlocknow usescanLockVault(mode), generalising feat(lock): org-enforced lock policy (#510) #581's server-mode check, so an account locked before this fix gets the unlock page, not onboarding.Closes #592
Behaviour changes
Testing
app_lock10/10,storage::secrets42/42 (new: an unlocked vault with no file writes one that only its key opens).tsc --noEmitclean.