AdhocAdam / smletsexchangeconnector

SMLets PowerShell based Exchange Connector for controlling Microsoft System Center Service Manager 2016+
https://adhocadam.github.io/smletsexchangeconnector/
GNU General Public License v3.0
29 stars 19 forks source link

usage, isVerifiedSig #407

Closed AdhocAdam closed 2 years ago

AdhocAdam commented 2 years ago

Per MimeKit documentation, the output of the following is of type DigitalSignatureCollection:

$isVerifiedSig = $decryptedBody.Verify($certStore, [ref]$decryptedBody)

And documentation per DigitalSignatureCollection states:

When verifying a digitally signed MIME part such as a MultipartSigned or a ApplicationPkcs7Mime, you will get back a collection of digital signatures. Typically, a signed message will only have a single signature (created by the sender of the message), but it is possible for there to be multiple signatures.

As a result, $isVerifiedSig is not the best choice of variable naming and as such is moving to $digitalSignatures along with a couple logging events.

github-actions[bot] commented 2 years ago

PSScriptAnalyzer results:

:stop_sign: [0] Errors, :warning: [15] Warnings, :information_source: [2] Information

``` RuleName : PSReviewUnusedParameter Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3210 Message : The parameter 'MessageClass' has been declared but not used. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 192 Message : Function 'New-SMEXCOEvent' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 883 Message : Function 'New-WorkItem' has verb that could change system state. Th erefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 1464 Message : Function 'Update-WorkItem' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 2633 Message : Function 'Set-AssignedToPerSupportGroup' has verb that could change system state. Therefore, the function has to support 'ShouldProces s'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 2712 Message : Function 'New-CMDBUser' has verb that could change system state. Th erefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3111 Message : Function 'Remove-CiresonWatchListUser' has verb that could change s ystem state. Therefore, the function has to support 'ShouldProcess' . RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3145 Message : Function 'Set-WorkItemScheduledTime' has verb that could change sys tem state. Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3595 Message : Function 'Set-CoreSCSMAnnouncement' has verb that could change syst em state. Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3660 Message : Function 'Set-CiresonPortalAnnouncement' has verb that could change system state. Therefore, the function has to support 'ShouldProces s'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4170 Message : Function 'Update-SCSMPropertyCollection' has verb that could change system state. Therefore, the function has to support 'ShouldProces s'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4204 Message : Function 'Set-SCSMTemplate' has verb that could change system state . Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4223 Message : Function 'Remove-PII' has verb that could change system state. Ther efore, the function has to support 'ShouldProcess'. RuleName : PSUseUsingScopeModifierInNewRunspaces Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4287 Message : The variable '$appName' is not declared within this ScriptBlock, an d is missing the 'Using:' scope modifier. RuleName : PSUseUsingScopeModifierInNewRunspaces Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4311 Message : The variable '$unhealthySCOMApp' is not declared within this Script Block, and is missing the 'Using:' scope modifier. RuleName : PSAvoidTrailingWhitespace Severity : Information ScriptName : smletsExchangeConnector.ps1 Line : 4903 Message : Line has trailing whitespace RuleName : PSUseOutputTypeCorrectly Severity : Information ScriptName : smletsExchangeConnector.ps1 Line : 3056 Message : The cmdlet 'Get-CiresonSuggestionURL' returns an object of type 'Sy stem.Object[]' but this type is not declared in the OutputType attr ibute. ```

github-actions[bot] commented 2 years ago

PSScriptAnalyzer results:

:stop_sign: [0] Errors, :warning: [15] Warnings, :information_source: [1] Information

``` RuleName : PSReviewUnusedParameter Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3210 Message : The parameter 'MessageClass' has been declared but not used. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 192 Message : Function 'New-SMEXCOEvent' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 883 Message : Function 'New-WorkItem' has verb that could change system state. Th erefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 1464 Message : Function 'Update-WorkItem' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 2633 Message : Function 'Set-AssignedToPerSupportGroup' has verb that could change system state. Therefore, the function has to support 'ShouldProces s'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 2712 Message : Function 'New-CMDBUser' has verb that could change system state. Th erefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3111 Message : Function 'Remove-CiresonWatchListUser' has verb that could change s ystem state. Therefore, the function has to support 'ShouldProcess' . RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3145 Message : Function 'Set-WorkItemScheduledTime' has verb that could change sys tem state. Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3595 Message : Function 'Set-CoreSCSMAnnouncement' has verb that could change syst em state. Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 3660 Message : Function 'Set-CiresonPortalAnnouncement' has verb that could change system state. Therefore, the function has to support 'ShouldProces s'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4170 Message : Function 'Update-SCSMPropertyCollection' has verb that could change system state. Therefore, the function has to support 'ShouldProces s'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4204 Message : Function 'Set-SCSMTemplate' has verb that could change system state . Therefore, the function has to support 'ShouldProcess'. RuleName : PSUseShouldProcessForStateChangingFunctions Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4223 Message : Function 'Remove-PII' has verb that could change system state. Ther efore, the function has to support 'ShouldProcess'. RuleName : PSUseUsingScopeModifierInNewRunspaces Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4287 Message : The variable '$appName' is not declared within this ScriptBlock, an d is missing the 'Using:' scope modifier. RuleName : PSUseUsingScopeModifierInNewRunspaces Severity : Warning ScriptName : smletsExchangeConnector.ps1 Line : 4311 Message : The variable '$unhealthySCOMApp' is not declared within this Script Block, and is missing the 'Using:' scope modifier. RuleName : PSUseOutputTypeCorrectly Severity : Information ScriptName : smletsExchangeConnector.ps1 Line : 3056 Message : The cmdlet 'Get-CiresonSuggestionURL' returns an object of type 'Sy stem.Object[]' but this type is not declared in the OutputType attr ibute. ```