Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,36 @@ jobs:
done
exit $found

# The exact set, not only "no INTERNET": a library that starts asking for a permission, or a new
# <uses-permission> in the app, must be a decision. Change the list below on purpose, in the same commit.
- name: Check merged manifest permission set
run: |
set -euo pipefail
manifests=$(find app/build/intermediates/merged_manifest app/build/intermediates/merged_manifests \
-name AndroidManifest.xml -path '*fdroidRelease*' 2>/dev/null || true)
if [ -z "$manifests" ]; then
echo "::error::No merged fdroidRelease manifest found to check"
exit 1
fi
expected=$(printf '%s\n' \
android.permission.HIDE_OVERLAY_WINDOWS \
android.permission.USE_BIOMETRIC \
android.permission.USE_FINGERPRINT \
com.pasich.encly.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION | sort)
status=0
for m in $manifests; do
actual=$(grep -oE '<uses-permission[^>]*android:name="[^"]+"' "$m" \
| sed -E 's/.*android:name="([^"]+)"/\1/' | sort -u)
echo "Permissions in $m:"
echo "$actual"
if [ "$actual" != "$expected" ]; then
echo "::error file=$m::Merged release permissions differ from the pinned set"
diff <(echo "$expected") <(echo "$actual") || true
status=1
fi
done
exit $status

- name: Upload reports on failure
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
Expand Down
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@ IzzyOnDroid) and used as the GitHub Release notes.
- Encly for Windows, macOS and Linux (MSI, DMG, DEB and a Flatpak bundle): the same vault, notes and security as on the phone, with list and note side by side, note tabs, several windows, keyboard shortcuts and a menu bar, export to PDF and print, and the PIN's device key in the system's secret store ([#85](https://github.com/pasichDev/Encly/issues/85), [#106](https://github.com/pasichDev/Encly/issues/106)).
- Encly for iPhone: each PIN attempt needs the Secure Enclave, Face ID and Touch ID unlock, the vault locks when the app leaves the screen, and the app is hidden in the app switcher ([#107](https://github.com/pasichDev/Encly/issues/107)).

## [3.0.1] - 2026-11-20

versionCode 30001.

### Security

- Lengthening the auto-lock delay, turning strict keyboard privacy off, showing note previews and turning biometric unlock on now ask for your PIN first, so someone holding your unlocked phone cannot weaken your protection. Changes that make it stricter still apply at once ([#133](https://github.com/pasichDev/Encly/issues/133)).

### Added

- After an update from a version before 3.0.0, a one-time notice tells you that the trash now deletes notes 28 days after they were moved there, how many notes are in it, and opens the trash for you ([#126](https://github.com/pasichDev/Encly/issues/126)).

### Changed

- The note's long-press sheet is easier to use with TalkBack and a finger: TalkBack announces "Tap again to delete", tag chips have a larger touch target, and hidden tags are marked so you can tell that tapping one hides the note from the main list ([#124](https://github.com/pasichDev/Encly/issues/124)).

### Fixed

- The gap between a checkbox or bullet and its text no longer gets wider once a list reaches ten items, and tighter again when it drops below ([#129](https://github.com/pasichDev/Encly/issues/129)).
- Ukrainian: tags are called «мітки» everywhere; some screens and the backup text said «теги».

## [3.0.0] - 2026-11-19

versionCode 30000.
Expand Down Expand Up @@ -70,6 +91,12 @@ versionCode 30000.
- The decoy vault no longer shows the date of the real vault's last backup.
- A temporary failure of the device's key storage no longer offers to erase the vault, and the lock screen says the key storage did not respond instead of that the database could not be opened.

### ⚠️ Compatibility

- The database moves to version 8 (the trash date, then several tags per note), migrated in place. Installing an older Encly over this version is not supported: it cannot open the newer database. Export a backup first if you might go back.
- A backup made with this version is schema 6 (it carries your settings and several tags per note). Older Encly versions refuse it with "This backup was made by a newer version of Encly. Update the app and try again."
- A note with a table or a code block opens read-only in versions before 3.0.0.

## [2.3.1] - 2026-10-27

versionCode 20301.
Expand Down Expand Up @@ -409,7 +436,10 @@ The last release of the old storage format (versionCode 30): the SQLCipher key w
Keystore-sealed seed hash, with an optional 4-digit PIN. It had no public users; superseded by
2.0.0.

[Unreleased]: https://github.com/pasichDev/Encly/compare/v2.3.0...HEAD
[Unreleased]: https://github.com/pasichDev/Encly/compare/v3.0.1...HEAD
[3.0.1]: https://github.com/pasichDev/Encly/compare/v3.0.0...v3.0.1
[3.0.0]: https://github.com/pasichDev/Encly/compare/v2.3.1...v3.0.0
[2.3.1]: https://github.com/pasichDev/Encly/compare/v2.3.0...v2.3.1
[2.3.0]: https://github.com/pasichDev/Encly/compare/v2.2.1...v2.3.0
[2.2.1]: https://github.com/pasichDev/Encly/compare/v2.2.0...v2.2.1
[2.2.0]: https://github.com/pasichDev/Encly/releases/tag/v2.2.0
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ upload this key instead of letting Google generate one).
those platforms ship.
Add the version to `<releases>` in `desktopApp/packaging/flatpak/io.github.pasichdev.Encly.metainfo.xml`
too; the Flatpak build in CI refuses a version that is not listed there.
4. Test the release APK on a device.
4. Test the release APK on a device. If a dependency or the app added or dropped a permission, the
"Check merged manifest permission set" step of CI fails: update its list on purpose and say why
in the pull request.
5. Merge to `main`, then tag the merge commit `vX.Y.Z` and push the tag. The
[release workflow](.github/workflows/release.yml) refuses a tag that does not match
`version.properties`, fails when a signing secret or `ENCLY_CERT_SHA256` is missing, builds
Expand Down
20 changes: 20 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,26 @@ generic Markdown/TXT (Obsidian, Markor).
- **Limits.** Like the editor and the backup import, parsed text passes through JVM strings that
cannot be zeroized.

## Settings that ask for re-authentication

A phone left unlocked for a moment must not be able to weaken the protection of the vault. These
changes on Settings → Security ask for the PIN first (or a Class 3 biometric confirmation when
biometric unlock is on), through the same re-authentication as export and import:

- lengthening the auto-lock delay;
- turning strict keyboard privacy off;
- turning "Show note previews" on;
- turning biometric unlock on (the PIN is asked before the enrolment; turning it off keeps its
own strong-biometric confirmation);
- "Allow screenshots until the app locks".

Changes that strengthen protection (a shorter or equal delay, strict keyboard on, previews off,
screenshots blocked again) never ask. The switch keeps its old value until the change is applied,
so a cancel or a wrong PIN leaves it. The change is held in memory only and is discarded, not
applied, by a cancel and by any lock between the request and the PIN, as for the screenshots
allowance. A full backup restore applies the stored settings without asking: it already needs
the recovery phrase and the same re-authentication.

## Session lifecycle

- The database is not considered committed until mandatory PIN setup succeeds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.pasich.encly.core.di.appGraph
import com.pasich.encly.core.locale.AppLocales
Expand Down Expand Up @@ -118,7 +118,7 @@ class ImportFromMyNotesActivity : AppCompatActivity() {

setContent {
if (!themeReady) return@setContent
val strictKeyboard by keyboardPrivacy.strict.collectAsState()
val strictKeyboard by keyboardPrivacy.strict.collectAsStateWithLifecycle()
hostServices.Provide(this, strictKeyboard) {
AppTheme {
Box(
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/pasich/encly/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import android.view.WindowManager
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.pasich.encly.core.di.appGraph
import com.pasich.encly.core.locale.AppLocales
Expand Down Expand Up @@ -103,7 +103,7 @@ class MainActivity : AppCompatActivity() {

setContent {
// Auto re-lock and the navigation guards live in the shared UI (EnclyApp).
val strictKeyboard by keyboardPrivacy.strict.collectAsState()
val strictKeyboard by keyboardPrivacy.strict.collectAsStateWithLifecycle()
hostServices.Provide(this, strictKeyboard) {
EnclyApp(
startStatus = initialStatus,
Expand Down
96 changes: 69 additions & 27 deletions app/src/main/java/com/pasich/encly/core/security/BiometricTexts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ import com.pasich.encly.core.security.BiometricManager.PromptConfig
import dev.zacsweers.metro.AppScope
import dev.zacsweers.metro.Inject
import dev.zacsweers.metro.SingleIn
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import org.jetbrains.compose.resources.getString
import java.util.concurrent.atomic.AtomicBoolean

/** The texts of the system biometric prompts, as plain strings in the in-app language. */
class BiometricTexts(
Expand All @@ -27,7 +31,29 @@ class BiometricTexts(
val masterKey: PromptConfig,
val settings: PromptConfig,
val general: PromptConfig,
)
) {
companion object {
/**
* English texts, shown only while the real ones (in the in-app language) are still being read: a prompt
* must never open with an empty title or button.
*/
val Default = BiometricTexts(
unavailable = "Biometric authentication is unavailable",
cancel = "Cancel",
unlock = PromptConfig(
title = "Unlock Encly",
subtitle = "Confirm your biometrics to access the encrypted key",
negativeButtonText = "Use PIN",
),
masterKey = PromptConfig(title = "Key access", subtitle = "Confirm your biometrics"),
settings = PromptConfig(
title = "Security confirmation",
subtitle = "Confirm your biometrics to change protection",
),
general = PromptConfig(title = "Authentication", subtitle = "Confirm your identity"),
)
}
}

/**
* Holds the [BiometricTexts] for [KeystoreBiometricManager], which builds the system prompt outside any
Expand All @@ -40,40 +66,56 @@ class BiometricTextSource {
@Volatile
private var texts: BiometricTexts? = null

private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
private val loading = AtomicBoolean(false)

/** Reads the texts in the current language. */
suspend fun refresh() {
texts = BiometricTexts(
unavailable = getString(Res.string.biometric_unavailable),
cancel = getString(Res.string.cancel),
unlock = PromptConfig(
title = getString(Res.string.biometric_prompt_unlock_title),
subtitle = getString(Res.string.biometric_prompt_unlock_subtitle),
negativeButtonText = getString(Res.string.biometric_prompt_use_pin),
),
masterKey = PromptConfig(
title = getString(Res.string.biometric_prompt_key_title),
subtitle = getString(Res.string.biometric_prompt_key_subtitle),
),
settings = PromptConfig(
title = getString(Res.string.biometric_prompt_settings_title),
subtitle = getString(Res.string.biometric_prompt_settings_subtitle),
),
general = PromptConfig(
title = getString(Res.string.biometric_prompt_general_title),
subtitle = getString(Res.string.biometric_prompt_general_subtitle),
),
)
texts = read()
}

private suspend fun read() = BiometricTexts(
unavailable = getString(Res.string.biometric_unavailable),
cancel = getString(Res.string.cancel),
unlock = PromptConfig(
title = getString(Res.string.biometric_prompt_unlock_title),
subtitle = getString(Res.string.biometric_prompt_unlock_subtitle),
negativeButtonText = getString(Res.string.biometric_prompt_use_pin),
),
masterKey = PromptConfig(
title = getString(Res.string.biometric_prompt_key_title),
subtitle = getString(Res.string.biometric_prompt_key_subtitle),
),
settings = PromptConfig(
title = getString(Res.string.biometric_prompt_settings_title),
subtitle = getString(Res.string.biometric_prompt_settings_subtitle),
),
general = PromptConfig(
title = getString(Res.string.biometric_prompt_general_title),
subtitle = getString(Res.string.biometric_prompt_general_subtitle),
),
)

/** Uses [texts] as they are (tests, or a caller that resolved them itself). */
fun set(texts: BiometricTexts) {
this.texts = texts
}

/**
* The texts of the last [refresh]. A process started by another entry point than MainActivity
* (the My Notes hand-off) may reach a prompt before any refresh: then they are read here, once,
* so the unlock never fails over a missing title.
* The texts of the last [refresh], without ever blocking the caller (it may be the main thread). A process
* started by another entry point than MainActivity (the My Notes hand-off) may reach a prompt before any
* refresh: the first such call starts reading them in the background and answers with
* [BiometricTexts.Default] until they are ready, so the unlock never fails over a missing title.
*/
fun current(): BiometricTexts = texts ?: runBlocking { refresh() }.let { checkNotNull(texts) }
fun current(): BiometricTexts {
texts?.let { return it }
if (loading.compareAndSet(false, true)) {
scope.launch {
runCatching { read() }
.onSuccess { loaded -> if (texts == null) texts = loaded }
loading.set(false)
}
}
return texts ?: BiometricTexts.Default
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.pasich.encly.core.security

import android.app.Application
import android.content.Context
import android.security.keystore.KeyProperties
import androidx.fragment.app.FragmentActivity
import androidx.test.core.app.ApplicationProvider
import com.pasich.encly.testutil.FakeAndroidKeyStore
import com.pasich.encly.testutil.tempVaultStore
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.Robolectric
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import org.robolectric.shadow.api.Shadow
import org.robolectric.shadows.ShadowBiometricManager
import android.hardware.biometrics.BiometricManager as PlatformBiometricManager

/**
* The biometric slot's Keystore key is made per use, and from Android 11 (R) its parameters name the strong class.
* The prompt itself needs a device, so what is checked is the spec the key was asked for. The branch below R
* (validity duration -1) is not reached here: Robolectric's androidx.biometric reports no strong biometrics on
* Android 10, so the enrolment stops before a key is made; that branch is left to the device smoke test (issue #17).
*/
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [30, 35], application = Application::class)
class BiometricKeyGenerationTest {
private val context: Application get() = ApplicationProvider.getApplicationContext()
private val store = tempVaultStore()
private val texts = BiometricTextSource().apply {
val prompt = BiometricManager.PromptConfig("title", "subtitle")
set(BiometricTexts("unavailable", "cancel", prompt, prompt, prompt, prompt))
}
private lateinit var manager: KeystoreBiometricManager

@Before
fun setUp() {
FakeAndroidKeyStore.install()
manager = KeystoreBiometricManager(context, store, texts)
val platform = context.getSystemService(Context.BIOMETRIC_SERVICE) as PlatformBiometricManager
Shadow.extract<ShadowBiometricManager>(platform).setCanAuthenticate(true)
}

@After
fun tearDown() = FakeAndroidKeyStore.uninstall()

@Test
fun enrollingAsksForAPerUseStrongBiometricAesKey() {
val activity = Robolectric.buildActivity(FragmentActivity::class.java).setup().get()

// The prompt cannot be answered here; the key is made before it is shown.
manager.enroll(ActivityBiometricHost(activity), ByteArray(32)) { }

val spec = FakeAndroidKeyStore.specs.single()
assertEquals(256, spec.keySize)
assertEquals(KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT, spec.purposes)
assertTrue(spec.isUserAuthenticationRequired)
assertTrue(spec.isInvalidatedByBiometricEnrollment)
assertEquals(0, spec.userAuthenticationValidityDurationSeconds)
assertEquals(KeyProperties.AUTH_BIOMETRIC_STRONG, spec.userAuthenticationType)
}
}
Loading
Loading