Skip to content

Commit

Permalink
Restore backwards compatibility for SecureDesktopNVDAObject (#14116)
Browse files Browse the repository at this point in the history
Follow up to #14105
Fixes issue described in #14111 (comment)

Summary of the issue:
SecureDesktopNVDAObject is an API end point used to indicate to the user and to API consumers (including NVDA remote), that the user has switched to a secure desktop.
This is triggered when Windows notification EVENT_SYSTEM_DESKTOPSWITCH notifies that the desktop has changed.
The switch is handled via a gainFocus event.
The gainFocus event causes the user instance of NVDA to enter sleep mode as the secure mode NVDA instance starts on the secure screen.

Information from SecureDesktopNVDAObject should not be accessible to the user, as it is backed by a valid MSAA desktop running on a secure profile, that NVDA can report information from.
This should generally be handled by NVDA entering sleep mode.
In #14105, SecureDesktopNVDAObject became based on NVDAObject to improve security for the object, by breaking it's connection to a valid window.
This was to decrease the theoretical risk of information leakage.

However, it was discovered that NVDA core event tracking and API consumers rely on SecureDesktopNVDAObject inheriting from Window (a parent class of Desktop).

As such, SecureDesktopNVDAObject must remain a Desktop subclass to retain backwards compatibility.

However we can prevent neighbouring objects from being accessed.

Description of user facing changes
Fixes bug in NVDA alpha with handling SecureDesktopNVDAObject.
Fixes API breakage.

Description of development approach
Reverts the change in #14105, making SecureDesktopNVDAObject inherit from Desktop.

Prevents neighbouring objects to SecureDesktopNVDAObject from being accessed by overriding relevant methods.
  • Loading branch information
seanbudd authored Sep 9, 2022
1 parent b168269 commit 8eac659
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
37 changes: 20 additions & 17 deletions source/IAccessibleHandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import keyboardHandler
from logHandler import log
import mouseHandler
from NVDAObjects import NVDAObject
import NVDAObjects.IAccessible
import NVDAObjects.window
import winUser
Expand Down Expand Up @@ -772,7 +771,7 @@ def processFocusNVDAEvent(obj, force=False):
return True


class SecureDesktopNVDAObject(NVDAObject):
class SecureDesktopNVDAObject(NVDAObjects.window.Desktop):
"""
Used to indicate to the user and to API consumers (including NVDA remote),
that the user has switched to a secure desktop.
Expand All @@ -781,23 +780,12 @@ class SecureDesktopNVDAObject(NVDAObject):
The gainFocus event causes NVDA to enter sleep mode as the secure mode
NVDA instance starts on the secure screen.
This object is not backed by a valid MSAA object as the Secure Desktop
object should not be accessed via NVDA.
The minimal functionality has been added to support backwards compatibility.
This object is backed by a valid MSAA object.
However, as information from the Secure Desktop object should not be accessed via this instance of NVDA,
getting related objects returns None.
This object must remain a Desktop subclass to retain backwards compatibility.
"""

def __init__(self, windowHandle: int):
"""
@param windowHandle: to retain backwards compatibility,
unused as this object is not backed by a valid MSAA object.
This object just serves as a minimal API endpoint.
"""
self._windowHandle = windowHandle
super().__init__()

def _get_processID(self) -> int:
return 0

def findOverlayClasses(self, clsList):
clsList.append(SecureDesktopNVDAObject)
return clsList
Expand All @@ -814,6 +802,21 @@ def event_gainFocus(self):
# After handling the focus, NVDA should sleep while the secure desktop is active.
self.sleepMode = self.SLEEP_FULL

def _get_next(self) -> None:
return None

def _get_previous(self) -> None:
return None

def _get_firstChild(self) -> None:
return None

def _get_lastChild(self) -> None:
return None

def _get_parent(self) -> None:
return None


def processDesktopSwitchWinEvent(window, objectID, childID):
if isMSAADebugLoggingEnabled():
Expand Down
8 changes: 0 additions & 8 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ This is a patch release to fix an accidental API breakage introduced in 2022.2.1
This caused NVDA remote to not recognize secure desktops. (#14094)
-

== Changes for Developers ==
This release contains a technical breakage in API backwards compatibility.
It is expected that this change does not affect any add-ons.
Please open a GitHub issue if your add-on becomes incompatible as a result of this release.

- ``SecureDesktopNVDAObject`` is no longer a subclass of ``Desktop`` or ``Window``. (#14105)
-

= 2022.2.2 =
This is a patch release to fix a bug introduced in 2022.2.1 with input gestures.

Expand Down

0 comments on commit 8eac659

Please sign in to comment.