Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 295af9e

Browse files
committed
Automatically dismiss decryption screen after 60 seconds (#1216)
* Automatically dismiss decryption screen after 60 seconds Fixes #1215 Signed-off-by: Harsh Shandilya <[email protected]> * Update changelog Signed-off-by: Harsh Shandilya <[email protected]> (cherry picked from commit a9c73f1) Signed-off-by: Harsh Shandilya <[email protected]>
1 parent cf9a009 commit 295af9e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
99
- Cancelling the Autofill "Generate password" action now correctly returns you to the original app.
1010
- If multiple username fields exist in the password, we now ensure the later ones are not dropped from extra content.
1111
- Icons in Autofill suggestions are no longer black on almost black in dark mode.
12+
- Decrypt screen would stay in memory infinitely, allowing passwords to be seen without re-auth
1213

1314
## [1.13.1] - 2020-10-23
1415

app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,18 @@ class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
113113
e(e)
114114
}
115115

116+
/**
117+
* Automatically finishes the activity 60 seconds after decryption succeeded to prevent
118+
* information leaks from stale activities.
119+
*/
120+
@OptIn(ExperimentalTime::class)
121+
private fun startAutoDismissTimer() {
122+
lifecycleScope.launch {
123+
delay(60.seconds)
124+
finish()
125+
}
126+
}
127+
116128
/**
117129
* Edit the current password and hide all the fields populated by encrypted data so that when
118130
* the result triggers they can be repopulated with new data.
@@ -155,6 +167,7 @@ class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
155167
api?.executeApiAsync(data, inputStream, outputStream) { result ->
156168
when (result?.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
157169
OpenPgpApi.RESULT_CODE_SUCCESS -> {
170+
startAutoDismissTimer()
158171
runCatching {
159172
val showPassword = settings.getBoolean(PreferenceKeys.SHOW_PASSWORD, true)
160173
val showExtraContent = settings.getBoolean(PreferenceKeys.SHOW_EXTRA_CONTENT, true)

0 commit comments

Comments
 (0)