PowerShell / SecretManagement

PowerShell module to consistent usage of secrets through different extension vaults
MIT License
317 stars 46 forks source link

Interactive prompting breaks after tab completion #174

Closed PaulHigin closed 2 years ago

PaulHigin commented 2 years ago

SecretManagement Get-Secret using tab completion for the -Name parameter, before any command is run, then user interaction (writing to output or prompting) is disabled.

PS C:\> Get-Secret 'hello  <hit tab key here>
Get-Secret: A valid password is required to access the Microsoft.PowerShell.SecretStore vault.
Use the Unlock-SecretStore cmdlet to provide the required password to access the store.

Result:
Error message to provide password by running Unlock-SecretStore

Expected:
Prompt for password

This happens because the runspace created to run the tab completion Get-SecretInfo in has no host UI, since none is available at that time.

Fix is to detect this condition and recreate the runspace when a host with UI (non-Default host) is available.

PaulHigin commented 2 years ago

Fixed in v1.1.1 release.