Skip to content

Commit 2463620

Browse files
authored
Relax the sensitive words we filter (#1517)
1 parent 67f09a4 commit 2463620

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

PSReadLine/History.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public class HistoryItem
111111

112112
// Pattern used to check for sensitive inputs.
113113
private static readonly Regex s_sensitivePattern = new Regex(
114-
"password|asplaintext|token|key|secret",
114+
"password|asplaintext|token|apikey|secret",
115115
RegexOptions.Compiled | RegexOptions.IgnoreCase);
116116

117117
private void ClearSavedCurrentLine()

docs/Set-PSReadLineOption.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ This usually indicates the command line has sensitive content that should not be
215215
PSReadLine provides a default handler to this option:
216216
`[Microsoft.PowerShell.PSConsoleReadLine]::GetDefaultAddToHistoryOption(string line)`
217217
The default handler attempts to detect sensitive information in a command line by matching with a simple regex pattern:
218-
`"password|asplaintext|token|key|secret"`
218+
`"password|asplaintext|token|apikey|secret"`
219219
When successfully matched, the command line is considered to contain sensitive content, and `MemoryOnly` is returned.
220220
Otherwise, `MemoryAndFile` is returned.
221221

test/HistoryTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void SensitiveHistoryDefaultBehavior()
6262
"echo foo",
6363
"cmd1 /token abc",
6464
"echo bar",
65-
"cmd2 --key abc",
65+
"cmd2 --apikey abc",
6666
"echo zoo",
6767
"pki secret",
6868
"gcm p*"

0 commit comments

Comments
 (0)