You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow saving command to history file if it reads a property with a sensitive name #3318
However, the command itself does not contain any passwords. I would like PSReadLine to save this command to the history file so that I can more easily run similar commands in future PowerShell sessions.
The existing implementation of [Microsoft.PowerShell.PSConsoleReadLine]::GetDefaultAddToHistoryOption considers Password a sensitive name and returns MemoryOnly, which prevents PSReadLine from saving the command to the history file. innerAst is a StringConstantExpressionAst with StringConstantType : BareWord. Its parent is a MemberExpressionAst, the grandparent is a CommandExpressionAst, and the great grandparent is a PipelineAst.
On the other hand, "12345" in $obj.SetPassword("12345") should be treated as a password. Does this likewise have a MemberExpressionAst in its parse tree?
@4cq2, it's already configurable. See #3243 (comment), Set-PSReadLineOption -AddToHistoryHandler. This issue is about changing the default behaviour to detect more cases in which the command line includes something sensitive-looking but can be analysed as safe.
Activity
KalleOlaviNiemitalo commentedon May 18, 2022
On the other hand, "12345" in
$obj.SetPassword("12345")should be treated as a password. Does this likewise have a MemberExpressionAst in its parse tree?H0R5E commentedon Feb 16, 2023
I have a similar issue calling a command that passes (the name of) environment variables that contain secrets, like so:
I don't see this as being a sensitive command as the secrets are not exposed.
KalleOlaviNiemitalo commentedon Mar 19, 2023
@4cq2, it's already configurable. See #3243 (comment), Set-PSReadLineOption -AddToHistoryHandler. This issue is about changing the default behaviour to detect more cases in which the command line includes something sensitive-looking but can be analysed as safe.