android / android/security-samples

method encryptFile() has bug

Open
#57 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
1k
Forks
450
PR merge metrics
No merged PRs in 30d

Description

```
private fun encryptFile() {
val title = binding.titleEditText.text.toString()
val body = binding.bodyEditText.text.toString()

if (title.isBlank()) return

try {
deleteFile(existingFileTitle)
val encryptedFile = getEncryptedFile(title)
encryptedFile.openFileOutput().use { output ->
output.write(body.toByteArray())
}
} catch (e: Exception) {
e.printStackTrace()
showSnackbar(R.string.error_unable_to_save_file)
}
}
```

should change deleteFile(existingFileTitle) to deleteFile(title )

Contributor guide

Open the contributing guide

Research direction

Locate encryptFile() in the Android sample and inspect the surrounding save or rename flow. Verify the deletion call against the title used to create the encrypted file, then exercise saving an edited file to confirm the obsolete file is removed and the new file remains.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile-dev, security
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.