Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Warn users that "Add-JournalEntryContent" could store sensitive content in PSReadLine history #63

Open
refactorsaurusrex opened this issue Jun 23, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@refactorsaurusrex
Copy link
Owner

refactorsaurusrex commented Jun 23, 2020

Summary

By default, when Add-JournalEntryContent is used, the command text is persisted to PSReadLine history. Given that this text could easily contain sensitive information, users should be warned about this risk and advised how to configure PSReadLine to avoid storing this command in history.

Tasks

  • When Add-JournalEntryContent is run, warn users that this command is persisted to history.
  • Allow users to disable this warning going forward.
  • Provide a link to the documentation website where it describes how to configure PSReadLine to skip logging this command.
  • Add this information to the documentation website.

Solution

This should be added to the user's PS profile

Set-PSReadLineOption -AddToHistoryHandler {
  param($line) 
  "Add-JournalEntryContent*","aje*" | ForEach-Object { 
    if ($line -like $_) {
      return $false
    }
  }
}

https://docs.microsoft.com/en-us/powershell/module/psreadline/about/about_psreadline?view=powershell-7

@refactorsaurusrex refactorsaurusrex changed the title Prevent "Add-JournalEntryContent" commands from being stored in PSReadLine history Warn users that "Add-JournalEntryContent" could store sensitive content in PSReadLine history Jun 24, 2021
@refactorsaurusrex refactorsaurusrex added the enhancement New feature or request label Jun 24, 2021
@refactorsaurusrex refactorsaurusrex self-assigned this Jun 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant