-
Notifications
You must be signed in to change notification settings - Fork 4k
Update signature script for strong name and authenticode #4462
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
Conversation
function Check-StrongName { | ||
[CmdletBinding()] | ||
param([Parameter(ValueFromPipeline=$true)][string]$path) | ||
$output = & "sn.exe" -vf $path |
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.
We should check for the existence of sn.exe on the path and fail fast if it is not found at the beginning of the Check-All script.
tools/CheckSignature.ps1
Outdated
} | ||
elseif ($PSCmdlet.ParameterSetName -eq "GalleryInstall") | ||
{ | ||
$path = "$($env:ProgramFiles)\WindowsPowerShell\Modules" |
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.
We should probably use $PSModulePath entries to determine where to search
tools/CheckSignature.ps1
Outdated
|
||
if ($PSCmdlet.ParameterSetName -eq "MsiInstall") | ||
{ | ||
$path = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell" |
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.
This will be different on a 32-bit system (this variable is not defined, in that case). We should check for existence of the variable, or bitness of the OS before proceeding
@cormacpayne Used this to check the current release candidate in both installation types and it was really slick, excellent work! A few suggestions to make this work over all environments. |
…switch to find and check modules
|
||
$invalidList = @() | ||
|
||
$files = Get-ChildItem $path\* -Include *.dll -Recurse | Where-Object { $_.FullName -like "*Azure*" } |
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.
For the future, it would be useful to factor out this file test iterator into its own function, so that you're calling it twice here, rather than duplicating the code.
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.
Failures are not being bubbled up, otherwise, lgtm
build.proj
Outdated
@@ -381,7 +381,7 @@ | |||
<Output TaskParameter="AuthCodeSignTaskErrorsDetected" PropertyName="AuthTaskFailed" /> | |||
</VerifyAuthenticodeSignatureTask> | |||
|
|||
<Exec Command=""$(PowerShellCommand)" -NonInteractive -NoLogo -NoProfile -Command ". $(LibraryToolsFolder)\CheckStrongNameSignature.ps1 ""/> | |||
<Exec Command=""$(PowerShellCommand)" -NonInteractive -NoLogo -NoProfile -Command ". $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(LibrarySourceFolder)\Package\$(Configuration) ""/> |
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.
We need to ensure that execution continues but marks this as an error, right now it looks like errors are not being bubbled up to fail the ci job. We may need to change the setting of this task and look at the erroractionpreference in powershell (or explicitly throw an exception.
Description
Remove all
CheckStrongNameSignature.ps1
script and replace it withCheckSignature.ps1
script that will check for strong name signature fordll
files and authenticode signature fordll
,ps1
andpsm1
files.This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines