Skip to content

fix: prevent bypassing lock screens - #247

Merged
wernrab merged 1 commit into
opencloud-eu:mainfrom
wernrab:prevent-bypassing-lock-screens
Nov 2, 2026
Merged

wernrab merged 1 commit into
opencloud-eu:mainfrom
wernrab:prevent-bypassing-lock-screens

Conversation

@wernrab

@wernrab wernrab commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
  • A user could bypass the lock screens by simply pressing Escape. Hint for testing: The Escape key might send KEYCODE_BACK, but you can send a real Escape keypress by using this adb command:
    adb shell input keyevent KEYCODE_ESCAPE

  • Running Apps targeting API 36 on Android 16 lead to a different behaviour regarding back navigation. onBackPressed and KeyEvent.KEYCODE_BACK are no longer used. See here

Reported by CyberNative AI LLC (https://cybernative.ai), thank you

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Security-sensitive dismissal behavior lacks regression coverage and still needs verification on Android 16 and earlier supported versions.

2 open issues
What changed in this PR

This PR closes Escape-key dismissal paths in the passcode and pattern lock screens and moves back handling to the AndroidX dispatcher for Android 16 compatibility.

Changes:

  • Replace legacy Back interception with lifecycle-aware callbacks.
  • Route Escape and toolbar navigation through the same cancellation guards.
  • Preserve cancellation for optional setup and removal while blocking dismissal of mandatory locks.
File Description
opencloudApp/​src/​main/​java/​eu/​opencloud/​android/​presentation/​security/​pattern/​PatternActivity.kt Adds guarded Back callbacks and routes Escape through the dispatcher.
opencloudApp/​src/​main/​java/​eu/​opencloud/​android/​presentation/​security/​passcode/​PassCodeActivity.kt Applies guarded dispatcher handling to Back, Escape, and toolbar navigation.

Review effort: Balanced

Comment on lines +84 to +86
if ((ACTION_CREATE == intent.action && intent.extras?.getBoolean(EXTRAS_LOCK_ENFORCED) != true) || ACTION_REMOVE == intent.action) {
PassCodeManager.onActivityStopped(this@PassCodeActivity)
finish()
Comment on lines +354 to +356
KeyEvent.KEYCODE_ESCAPE -> {
onBackPressedDispatcher.onBackPressed()
true
@wernrab
wernrab force-pushed the prevent-bypassing-lock-screens branch from 3b411ae to 687e31e Compare October 27, 2026 09:53
@wernrab wernrab self-assigned this Oct 27, 2026
@wernrab
wernrab requested a balanced review from Copilot October 27, 2026 12:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

These security-sensitive navigation changes need regression coverage and device-level validation of Escape and Android 16 predictive back.

3 open issues

Review effort: Balanced

Comment on lines +74 to +77
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if ((ACTION_REQUEST_WITH_RESULT == intent.action && intent.extras?.getBoolean(EXTRAS_LOCK_ENFORCED) != true) ||
ACTION_CHECK_WITH_RESULT == intent.action) {
@github-project-automation github-project-automation Bot moved this to Qualification in OpenCloud Team Board Oct 27, 2026
@kulmann kulmann moved this from Qualification to In Progress in OpenCloud Team Board Oct 27, 2026
@wernrab
wernrab force-pushed the prevent-bypassing-lock-screens branch from b91a05c to 0d3431e Compare October 27, 2026 14:21
@wernrab
wernrab marked this pull request as ready for review October 28, 2026 09:59
@wernrab
wernrab marked this pull request as draft October 28, 2026 14:17
@wernrab
wernrab force-pushed the prevent-bypassing-lock-screens branch from 5254188 to 230b1fd Compare October 30, 2026 11:42
@wernrab
wernrab requested review from guruz and kulmann October 30, 2026 12:19
@wernrab
wernrab marked this pull request as ready for review October 30, 2026 12:20
@wernrab wernrab moved this from In Progress to Needs Review in OpenCloud Team Board Oct 30, 2026
@wernrab
wernrab force-pushed the prevent-bypassing-lock-screens branch from 230b1fd to 37e8e74 Compare November 2, 2026 11:45
@wernrab
wernrab force-pushed the prevent-bypassing-lock-screens branch from 37e8e74 to 55fd26a Compare November 2, 2026 11:46
@wernrab
wernrab merged commit e375b56 into opencloud-eu:main Nov 2, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in OpenCloud Team Board Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants