Repository navigation
Conversation
Prepared by Codex security review. Original local review commit: c289f020c7ca50c5c3192f310cbf18e368e28bc4
Owner
Author
|
Reopening to trigger CI checks on the fork (Actions were not enabled when this draft was opened, so no checks have run yet). |
…test - seedWords() returns the cached recovery mnemonic and was the one Account private-key entry point left ungated. - The default keyAccessCheck read requireUnlockedDevice before async settings load landed, so the gate ran on a default-valued guess in the startup window; mirror WebDavService's check(isSettingsLoaded). - AccountCachedKeyLockTest was missing io.mockk.Called for the wasNot Called verification and now also covers the seedWords gate.
Owner
Author
|
Fixup commit
|
Prepared by Codex security review. Preserve the existing security fix and follow-up commits; add the missing validation gates without changing app code.
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.
Published as a draft for owner review. Local Android project validation remains blocked; do not merge until checks pass.
Finding: AMB-003 / Med. Branch:
sec/amb-003-cached-key-lock. Commit:a7fb4867149c46d6ee3a3e1bc69292e84c66ad45.Problem and threat model
After an account is cached while unlocked, a previously authorized local app or NIP-46 client can sign/decrypt after the device locks despite requireUnlockedDevice=true. Keystore gating of initial unwrap does not gate cached private bytes.
Source: Account.kt:73; LocalPreferences.kt:530. Shared with pinned upstream master; no fork-only regression.
Fix
Check the device-lock policy at Account private-key entry points and the backup derived-signer entry point.
User behavior and risk
When the existing option is enabled, cached-key operations reject while the device is locked. The default permits authorized background signing as before; this does not turn the separate UI PIN/biometric lock into a per-operation gate.
This is an application-level check at operation entry. It neither removes cached bytes from memory nor hardware-binds Schnorr operations, and cannot stop an operation that began before lock.
Tests and validation
Added regression coverage:
app/src/test/java/com/greenart7c3/nostrsigner/models/AccountCachedKeyLockTest.ktapp/src/test/java/com/greenart7c3/nostrsigner/service/DeviceUnlockPolicyTest.ktAccountCachedKeyLockTest.kt and DeviceUnlockPolicyTest.kt were added. The pure policy was included in the 17-case portable policy harness; the Account/MockK Gradle test was not executed.
git diff --checkpasses. Patch applies cleanly to upstream43bb743f6523676c942bba1c0790a80294f53a86.Attempted
./gradlew ktlintCheck test lint :app:assembleFreeRelease --no-daemon: blocked before tasks, AGP 9.3.2 plugin resolution fails. GitHub CI status is tracked on this draft PR. Project lint/tests/build must pass before merging. For Android instrumentation, run the connected free-debug tests with a device once a build is available.Migration and release notes
No storage migration. Existing requireUnlockedDevice preference is used.
No version bump. Repository changelogs are version-based; add accepted user-visible behavior to the next release notes at release preparation.