Skip to content

Commit 0689e21

Browse files
Merge commit from fork
* Clear braille when the session is locked * Updated changes * Fix spelling error in docstring. Co-authored-by: Sean Budd <sean@nvaccess.org> * Refactor * Use _dismissMessage instead of manually resetting message buffer * Update changes --------- Co-authored-by: Sean Budd <sean@nvaccess.org>
1 parent e2d464f commit 0689e21

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

source/braille.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
import queueHandler
6666
import brailleViewer
6767
from autoSettingsUtils.driverSetting import BooleanDriverSetting, NumericDriverSetting
68-
from utils.security import objectBelowLockScreenAndWindowsIsLocked
68+
from utils.security import objectBelowLockScreenAndWindowsIsLocked, post_sessionLockStateChanged
6969
from textUtils import isUnicodeNormalized, UnicodeNormalizationOffsetConverter
7070
import hwIo
7171
from editableText import EditableText
@@ -2412,6 +2412,7 @@ def __init__(self):
24122412
self.queuedWriteLock = threading.Lock()
24132413
self.ackTimerHandle = winKernel.createWaitableTimer()
24142414

2415+
post_sessionLockStateChanged.register(self._onSessionLockStateChanged)
24152416
brailleViewer.postBrailleViewerToolToggledAction.register(self._onBrailleViewerChangedState)
24162417
# noqa: F401 avoid module level import to prevent cyclical dependency
24172418
# between speech and braille
@@ -2435,6 +2436,7 @@ def terminate(self):
24352436
self._cursorBlinkTimer.Stop()
24362437
self._cursorBlinkTimer = None
24372438
config.post_configProfileSwitch.unregister(self.handlePostConfigProfileSwitch)
2439+
post_sessionLockStateChanged.unregister(self._onSessionLockStateChanged)
24382440
if self.display:
24392441
self.display.terminate()
24402442
self.display = None
@@ -2445,6 +2447,21 @@ def terminate(self):
24452447
self.ackTimerHandle = None
24462448
louisHelper.terminate()
24472449

2450+
def _clearAll(self) -> None:
2451+
"""Clear the braille buffers and update the braille display."""
2452+
self.mainBuffer.clear()
2453+
if self.buffer is self.messageBuffer:
2454+
self._dismissMessage(False)
2455+
self.update()
2456+
2457+
def _onSessionLockStateChanged(self, isNowLocked: bool):
2458+
"""Clear the braille buffers and update the braille display to prevent leaking potentially sensitive information from a locked session.
2459+
2460+
:param isNowLocked: True if the session is now locked; false if it is now unlocked.
2461+
"""
2462+
if isNowLocked:
2463+
self._clearAll()
2464+
24482465
table: brailleTables.BrailleTable
24492466
"""Type definition for auto prop '_get_table/_set_table'"""
24502467

user_docs/en/changes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ Prefix matching on command line flags, e.g. using `--di` for `--disable-addons`
6969
* By default, "Speak typed characters" is now set to "Only in edit controls".
7070
* The silence at the beginning of speech will now be trimmed when using OneCore voices, SAPI5 voices, and some third-party voice add-ons to improve their responsiveness. (#17614, @gexgd0419)
7171

72+
### Security Fixes
73+
74+
Please responsibly disclose security issues following NVDA's [security policy](https://github.com/nvaccess/nvda/blob/master/security.md).
75+
76+
* Prevents showing potentially sensitive information on braille displays when the device is locked.
77+
([GHSA-8f8q-2jc3-6rf4](https://github.com/nvaccess/nvda/security/advisories/GHSA-8f8q-2jc3-6rf4))
78+
7279
### Bug Fixes
7380

7481
* NVDA will no longer crash when selecting all text in certain source files in Android Studio or IntelliJ Idea. (#17418, @thgcode)

0 commit comments

Comments
 (0)