Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically dismiss decryption screen after 60 seconds #1216

Merged
merged 2 commits into from Nov 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
- Cancelling the Autofill "Generate password" action now correctly returns you to the original app.
- If multiple username fields exist in the password, we now ensure the later ones are not dropped from extra content.
- Icons in Autofill suggestions are no longer black on almost black in dark mode.
- Decrypt screen would stay in memory infinitely, allowing passwords to be seen without re-auth

### Changed

Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt
Expand Up @@ -113,6 +113,18 @@ class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
e(e)
}

/**
* Automatically finishes the activity 60 seconds after decryption succeeded to prevent
* information leaks from stale activities.
*/
@OptIn(ExperimentalTime::class)
private fun startAutoDismissTimer() {
lifecycleScope.launch {
delay(60.seconds)
finish()
}
}

/**
* Edit the current password and hide all the fields populated by encrypted data so that when
* the result triggers they can be repopulated with new data.
Expand Down Expand Up @@ -155,6 +167,7 @@ class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
api?.executeApiAsync(data, inputStream, outputStream) { result ->
when (result?.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
OpenPgpApi.RESULT_CODE_SUCCESS -> {
startAutoDismissTimer()
runCatching {
val showPassword = settings.getBoolean(PreferenceKeys.SHOW_PASSWORD, true)
val showExtraContent = settings.getBoolean(PreferenceKeys.SHOW_EXTRA_CONTENT, true)
Expand Down