Skip to content

Commit f075566

Browse files
authored
Merge pull request Azure#9758 from isra-fel/yeliu/check-psd1-signature
[ADO pipeline] check signature for scripts
2 parents 79d8e15 + e50a7ea commit f075566

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

tools/CheckSignature.ps1

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,21 @@ function Check-All {
7171

7272
# -------------------------------------
7373

74-
$files = Get-ChildItem $path\* -Include *.dll, *.ps1, *.psm1 -Recurse | Where-Object { $_.FullName -like "*Azure*" }
75-
$files = $files | Where-Object { ($_.FullName -notlike "*Newtonsoft.Json*") -and `
76-
($_.FullName -notlike "*AutoMapper*") -and `
77-
($_.FullName -notlike "*Security.Cryptography*") -and `
74+
$thirdParty = Get-ChildItem $path\* -Include *.dll -Recurse | Where-Object {
75+
($_.Name -ilike "*Newtonsoft.Json*") -or `
76+
($_.Name -ilike "*AutoMapper*") -or `
77+
($_.Name -ilike "*YamlDotNet*")
78+
}
79+
$exts = "*.ps1", "*.psm1", "*.ps1xml"
80+
if ($Env:CheckPsd1 -ieq "True") {
81+
$exts += "*.psd1"
82+
}
83+
$files += $thirdParty + (Get-ChildItem $path\* -Include $exts -Recurse)
84+
$files = $files | Where-Object { ($_.FullName -notlike "*Security.Cryptography*") -and `
7885
($_.FullName -notlike "*NLog*") -and `
79-
($_.FullName -notlike "*YamlDotNet*") -and `
8086
($_.FullName -notlike "*BouncyCastle.Crypto*") -and `
8187
($_.FullName -notlike "*System.Management.Automation*")}
82-
Write-Host "Checking the authenticode signature of $($files.Count) files (.dll, .ps1, .psm1)" -ForegroundColor Yellow
88+
Write-Host "Checking the authenticode signature of $($files.Count) files (*.dll, $($exts -Join ', '))" -ForegroundColor Yellow
8389

8490
$invalidAuthenticodeList = @()
8591

@@ -94,7 +100,7 @@ function Check-All {
94100
Write-Host "Found $($invalidAuthenticodeList.Count) files with an invalid authenticode signature." -ForegroundColor Red
95101
}
96102
else {
97-
Write-Host "All files (.dll, .ps1, .psd1) have a valid authenticode signature." -ForegroundColor Green
103+
Write-Host "All files (*.dll, $($exts -Join ', ')) have a valid authenticode signature." -ForegroundColor Green
98104
}
99105

100106
if ($invalidList.Length -gt 0) {

0 commit comments

Comments
 (0)