-
Notifications
You must be signed in to change notification settings - Fork 187
Binary cmdlets spam the information stream inappropriately and logs sensitive information to that stream #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I set Running inside PowerShell ISE, latest version of all Microsoft.Graph modules. This is not intended behavior I hope? Command outputPS C:\Users\birola> $MgDevices = [array](Get-MgDevice -All)
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
PS C:\Users\birola> $PSVersionTableName Value
---- -----
PSVersion 5.1.19041.1151
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1151
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1 Get-ModuleModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0.0.0 ISE {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}
Script 1.7.0 Microsoft.Graph.Authentication {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, Get-MgContext...}
Script 1.7.0 Microsoft.Graph.DeviceManagement {Get-MgDeviceManagement, Get-MgDeviceManagementAdvancedThreatProtectionOnboardingStateSummary, Get-MgDeviceManage...
Script 1.7.0 Microsoft.Graph.Identity.Directo... {Confirm-MgAdministrativeUnitMemberGroup, Confirm-MgAdministrativeUnitMemberObject, Confirm-MgContactMemberGroup,...
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest 3.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Manifest 3.0.0.0 Microsoft.WSMan.Management {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...} |
For reference, these are the decoded eventdata messages. These should be emitted the typical method the host uses for
|
Such detail should only be visible in the debug stream in my opinion, or behind a parameter or setting for the module. I use the information stream for human readable script output without generating output objects (which Write-Output does). Which is how I interperate what that stream should be used for. Shouldn't be debug information AFAIK. |
Yeah this should be written to the debug or verbose stream IMHO. |
This is related to #371, which calls out the need to replace the use of
Write-Information
withWrite-Verbose
in your auto-generated PowerShell script (psm1 and ps1) files.Your auto-generated binary cmdlets are spamming the information stream, which results in a lot of undesirable information for end users if a script is run using the PowerShell SDK.
Consider the following simple example:
This command outputs the following on my system:
None of that information is useful to a scripter, but the information stream cannot be easily silenced this way without workarounds (see PowerShell/PowerShell/issues/13631). The end result is just noise.
Worse, looking more closely at that data I see some auth token information in there, which I most certainly would not want captured in a log file, so this needs to be off by default in all execution paths. To get that, you're going to have to move away from using the information stream. Plus, you're currently writing your information output as text in tags??? That doesn't make sense. Tags is to tag an information stream entry with something that can be used to categorize or process the message in that stream. Tags is not for the messages themselves. That is just wrong.
You really need to re-think your message handling in your binary cmdlets, because you're not doing something right. At best I would log the
Microsoft.Graph.PowerShell.Runtime.EventData
as debug messages (not verbose, please -- don't spam end users who want just a little more information to troubleshoot a command that they are trying to use), but you need to be careful because in Windows PowerShell 5.1, the Debug stream acts as a dynamic breakpointer (sort of -- it is used to enter nested prompts on demand), and that behavior was not corrected until PowerShell 7.x.My recommendation: Move all of this text to a conditional invocation of WriteDebug, that is only invoked if DebugPreference is not set to Inquire (this sufficiently gets around the dynamic breakpointer behavior that was corrected in PowerShell/PowerShell/pull/8195).
AB#6781
The text was updated successfully, but these errors were encountered: