-
-
Notifications
You must be signed in to change notification settings - Fork 803
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
Add-PoshGitToProfile should not modify signed prof #428
Conversation
Forgot to address this issue before shipping 0.7.0 - #328 (comment) Merge to develop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question.
Merge to develop.
We can periodically open PRs from master
into develop
.
src/Utils.ps1
Outdated
# If the profile script exists and is signed, then we should not modify it | ||
if (Test-Path -LiteralPath $profilePath) { | ||
$sig = Get-AuthenticodeSignature $profilePath | ||
if ($sig.Status -eq [System.Management.Automation.SignatureStatus]::Valid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we warn/abort if $sig.Status
is anything other than NotSigned
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. I'll make that change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that turned out to be a little ugly as there are three values that can represent an unsigned file (NotValid, UnknownError, IncompatibleFileType) and four values that can represent a signed file. Switching to testing the SignatureType field.
@@ -82,18 +82,32 @@ function Invoke-Utf8ConsoleCommand([ScriptBlock]$cmd) { | |||
.OUTPUTS | |||
None. | |||
#> | |||
function Add-PoshGitToProfile([switch]$AllHosts, [switch]$Force, [switch]$WhatIf) { | |||
function Add-PoshGitToProfile { | |||
[CmdletBinding(SupportsShouldProcess)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Always forget about this.
SignatureStatus appears to have four enum values that correspond to a signed file vs three for not signed. Switching to check the SignatureType value as it will indicate Authenticode when file is Authenticode signed even if the hash doesn't match (been modified previously) or the cert is not trusted / incompatible.
Forgot to address this issue before shipping 0.7.0 - #328 (comment)
Merge to develop.