Repository: nvaccess/nvda

Issue:
Passwords spoken in WSL
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->

### Steps to reproduce:

1. If not already enabled and installed, enable WSL, and install and setup a distro (I am using Ubuntu 20.04 on WSL2, but I observed this issue on WSL1).
2. Make sure "Speak typed characters" is enabled in NVDA.
3. Within the WSL distro, try to do something that requires a password (EG run a command via `sudo`).

### Actual behavior:

The password is spoken by NVDA, even though it is not displayed on screen.

### Expected behavior:

The password should not be spoken, or, a masking symbol (such as "*") should be spoken instead.

### System configuration
#### NVDA installed/portable/running from source:

Installed

#### NVDA version:

2020.2

#### Windows version:

Microsoft Windows [Version 10.0.19041.450]

#### Name and version of other software in use when reproducing the issue:

Windows Subsystem for Linux with Ubuntu 20.04.

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your computer?

Yes.

#### Have you tried any other versions of NVDA? If so, please report their behaviors.

I believe this issue occurs in prior versions of NVDA, but am going from memory.

#### If addons are disabled, is your problem still occurring?

Yes.

#### Did you try to run the COM registry fixing tool in NVDA menu / tools?

Yes. Same result before and after.


Discussion:
Hi, I can’t reproduce this on the same exact configuration as you described, although I’m using NVDA alpha build to test this. Can you check if UIA is used to access consoles (NVDA menu/Preferences/Settings/Advanced)? Thanks.

 
Try: NVDA+n, p, s, a, tab, space, Alt+P.

That will take you to the "Speak passwords in UIA consoles (may improve 
performance)" option of the Advanced settings panel.

Uncheck that (space), then press enter.

Is your problem resolved?

Yes, it works when we enable the UIA checkbox.

However, when we are into SSH session, then NVDA responds very, very 
slowly. Although this is altogether a new issue.

On 9/4/2020 10:35 AM, Joseph Lee wrote:
> Hi, I can’t reproduce this on the same exact configuration as you 
> described, although I’m using NVDA alpha build to test this. Can you 
> check if UIA is used to access consoles (NVDA 
> menu/Preferences/Settings/Advanced)? Thanks.
>
>
>
> From: Sascha Cowley <notifications@github.com>
> Sent: Thursday, September 3, 2020 9:56 PM
> To: nvaccess/nvda <nvda@noreply.github.com>
> Cc: Subscribed <subscribed@noreply.github.com>
> Subject: [nvaccess/nvda] Passwords spoken in WSL (#11554)
>
>
>
>
> Steps to reproduce:
>
>
> 1. If not already enabled and installed, enable WSL, and install and 
> setup a distro (I am using Ubuntu 20.04 on WSL2, but I observed this 
> issue on WSL1).
> 2. Make sure "Speak typed characters" is enabled in NVDA.
> 3. Within the WSL distro, try to do something that requires a password 
> (EG run a command via sudo).
>
>
> Actual behavior:
>
>
> The password is spoken by NVDA, even though it is not displayed on screen.
>
>
> Expected behavior:
>
>
> The password should not be spoken, or, a masking symbol (such as "*") 
> should be spoken instead.
>
>
> System configuration
>
>
> NVDA installed/portable/running from source:
>
>
> Installed
>
>
> NVDA version:
>
>
> 2020.2
>
>
> Windows version:
>
>
> Microsoft Windows [Version 10.0.19041.450]
>
>
> Name and version of other software in use when reproducing the issue:
>
>
> Windows Subsystem for Linux with Ubuntu 20.04.
>
>
> Other information about your system:
>
>
> Other questions
>
>
> Does the issue still occur after restarting your computer?
>
>
> Yes.
>
>
> Have you tried any other versions of NVDA? If so, please report their 
> behaviors.
>
>
> I believe this issue occurs in prior versions of NVDA, but am going 
> from memory.
>
>
> If addons are disabled, is your problem still occurring?
>
>
> Yes.
>
>
> Did you try to run the COM registry fixing tool in NVDA menu / tools?
>
>
> Yes. Same result before and after.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/11554> , or unsubscribe 
> <https://github.com/notifications/unsubscribe-auth/AB4AXEG3WK36RJTRKC4HVDDSEBXMTANCNFSM4QXEMJ4A> 
> .
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/11554#issuecomment-686908899>, 
> or unsubscribe 
> <https://github.com/notifications/unsubscribe-auth/ABQWBM5Z5HB4YRNJONKEDKLSEBYRBANCNFSM4QXEMJ4A>.
>

> Can you check if UIA is used to access consoles (NVDA menu/Preferences/Settings/Advanced)?

UIA was not being used. Enabling it fixed the issue.
UIA slugs everything in many command settings, and so perhaps its  a 
Microsoft issue?

By default, on Windows 10 version 1607 and later, NVDA currently speaks all characters typed in consoles, whether they appear onscreen or not. Technical: I disabled typed character queuing/dispatch on `textChange` in `EnhancedTermTypedCharSupport` on legacy console since it takes about 250 ms to detect text changes (severely slowing down speaking of typed characters).

Your options:

* Use UIA console. @carlos-zamora and I have been doing a lot of work to improve the experience in the console for the next version of Windows.
    * Use [Windows Terminal](https://github.com/microsoft/terminal). Terminal has a good UIA implementation (which is always used, regardless of the user setting).
    * Test the new 21H1 UIA console. You can test the new console separately, or replace your existing console with the new version. See #10618.
    * Install an insider build of Windows 10. The inbox console on insider dev builds has many of the latest accessibility fixes, and should have all of them by the end of November or so.
    * Alternatively, wait for the next version of Windows (21H1) in the first half of 2021.
* Disable "use the new typed character support in legacy Windows Console" in NVDA advanced settings. This will suppress passwords, but re-introduce #513.
* When typing passwords in untrusted environments, disable "speak typed characters" and "speak typed words".
I think this issue should probably be closed (if not now, then definitely when #10964 is merged).

Resolving patch:
diff --git a/source/UIAHandler/utils.py b/source/UIAHandler/utils.py
--- a/source/UIAHandler/utils.py
+++ b/source/UIAHandler/utils.py
@@ -305,9 +305,7 @@ def _shouldUseUIAConsole(hwnd: int) -> bool:
 	else:
 		# #7497: the UIA implementation in old conhost is incomplete, therefore we
 		# should ignore it.
-		# When the UIA implementation is improved, the below line will be replaced
-		# with a check that _getConhostAPILevel >= FORMATTED.
-		return False
+		return _getConhostAPILevel(hwnd) >= WinConsoleAPILevel.FORMATTED
 
 
 @lru_cache(maxsize=10)
diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py
--- a/source/gui/settingsDialogs.py
+++ b/source/gui/settingsDialogs.py
@@ -2688,10 +2688,7 @@ def __init__(self, parent):
 			# Translators: A choice in a combo box in the advanced settings
 			# panel to have NVDA determine its Windows Console implementation
 			# automatically.
-			# This option is currently equivalent to "legacy", but in a future
-			# version of NVDA, UIA will be used in known good implementations
-			# when this option is selected.
-			_("Automatic (legacy)"),
+			_("Automatic (prefer UIA)"),
 			# Translators: A choice in a combo box in the advanced settings
 			# panel to have NVDA use UIA in the Windows Console when available.
 			_("UIA when available"),


Test patch: