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
Redact connection credentials from persisted command history - #291
Prevent recognized connection credentials from being written to command history while preserving the command being executed.
Replace AccountKey, SharedAccessKey, ResourceToken, and recognized bearer/JWT/SAS signature values with [REDACTED] in history.
Mask existing entries on load and clean legacy on-disk entries during the next successful atomic history save, including merges from other writers.
Decode shell string literals when filtering escaped credential names and values so Unicode escapes and escaped quotes cannot expose keys.
Keep history filtering separate from broad diagnostic filtering so ordinary query predicates on fields such as token, password, and secret remain unchanged.
Update history and MCP documentation. Changelog left unchanged.
User-visible behavior and limitations
Recalled key-based connections require a fresh key or Entra ID authentication. Existing backups and copies are not cleaned. Command echoes and output are not masked by history filtering, and arbitrary secrets under unrelated names may not be recognized.
Validation
App and test builds passed with zero warnings and errors.
Full offline regression suite: 5,104 passed, 6 skipped.
Mask new and legacy history while preserving execution values and ordinary query predicates. Handle escaped credentials using decoded shell string literals.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Credential redaction still allows complete secrets into persisted history through doubled-apostrophe strings and escaped object-property names, while token rewriting can also alter or invalidate recalled commands.
This PR adds credential filtering to Cosmos DB shell history while preserving the commands being executed. It also masks legacy entries when loaded and rewrites them during successful history saves.
Changes:
Add shared redaction logic with separate history and diagnostic filtering.
Cover history persistence, concurrent writers, save retries, escaped credentials, and unchanged execution values.
Document masked history, replay requirements, and security limitations.
File
Description
README.md
Summarizes history masking and replay limitations.
docs/navigation.md
Explains credential filtering, legacy cleanup, and history security.
docs/mcp.md
Clarifies history masking versus visible command echoes.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical redaction gaps expose plaintext credentials in saved history through multiline properties, interpolated expressions, and recognized credential variable assignments.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Critical redaction gaps leave interpolated bearer tokens and parenthesized credential assignments exposed in saved history, and the assignment fallback also corrupts recalled syntax.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Redact grouped credential values without breaking assignments
For the valid assignment $AccountKey = ('example-key=='), the preceding ( prevents the string from being recognized as a credential value, leaving the complete key in saved history. The raw fallback masks only the opening parenthesis, also making the recalled assignment malformed. Track and redact complete value expressions for recognized credential assignments and properties, including grouped literals, and add a saved-history regression for this case.
echo $"Bearer $('example-token')" is saved unchanged because the bearer pattern rejects $ at the start of the value; a literal prefix before the interpolation is masked only partially. Recognize bearer values with interpolation and mask the complete credential expression while preserving non-secret text. Add regression cases for both expression-only and mixed literal/interpolated values.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A critical redaction flaw leaves complete credential values exposed in saved history when grouped credential properties appear inside interpolation expressions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevent recognized connection credentials from being written to command history while preserving the command being executed.
[REDACTED]in history.User-visible behavior and limitations
Recalled key-based connections require a fresh key or Entra ID authentication. Existing backups and copies are not cleaned. Command echoes and output are not masked by history filtering, and arbitrary secrets under unrelated names may not be recognized.
Validation
git diff --checkpassed.