Skip to content

fix(security): require auth for key reveal and block screen capture o… - #62

Open
Letdown2491 wants to merge 1 commit into
barrydeen:mainfrom
Letdown2491:fix/key-reveal-security
Open

Letdown2491 wants to merge 1 commit into
barrydeen:mainfrom
Letdown2491:fix/key-reveal-security

Conversation

@Letdown2491

Copy link
Copy Markdown
Contributor

Two security hardening fixes for screens that handle the private key:

Require authentication for "Reveal Private Key"

The Keys screen previously fell through to revealing the nsec without any authentication when canAuthenticate(DEVICE_CREDENTIAL) didn't return success. That hits two real cases:

  • devices with no screen lock configured
  • any device on API 28–29, even with a lock set. androidx.biometric doesn't support DEVICE_CREDENTIAL-only prompts on those API levels (minSdk is 26)

The reveal flow now checks and prompts with BIOMETRIC_STRONG or DEVICE_CREDENTIAL, which:

  • closes the unauthenticated fallback. if no auth method is available, the key stays hidden and a toast asks the user to set up a screen lock
  • lets fingerprint/face users authenticate instead of PIN/pattern only
  • works on all supported API levels

Block screen capture on key-exposing screens (FLAG_SECURE)

New SecureWindow() composable sets FLAG_SECURE on the activity window while it's in composition and clears it on dispose. Applied to:

  • KeysScreen displays the revealed nsec
  • AuthScreen nsec can be typed and toggled visible

This blocks screenshots, screen recording / media-projection capture, and the recents-screen thumbnail while key material can be on screen.

…n key screens

- Reveal Private Key no longer falls through to an unauthenticated reveal
  when device-credential auth is unavailable (no lock screen, or the
  androidx.biometric DEVICE_CREDENTIAL-only gap on API 28-29); it now
  requires BIOMETRIC_STRONG or DEVICE_CREDENTIAL and prompts the user to
  set up a screen lock otherwise
- New SecureWindow composable sets FLAG_SECURE while in composition;
  applied to KeysScreen (nsec reveal) and AuthScreen (nsec entry) to
  block screenshots, screen recording, and recents thumbnails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant