Skip to content

Commit 85b9407

Browse files
authored
Eng | Add strong name validation to package validator (#2802)
1 parent cc144a8 commit 85b9407

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

eng/pipelines/common/templates/jobs/validate-signed-package-job.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,42 @@ jobs:
106106
}
107107
displayName: 'Verify nuget signature'
108108
109+
- powershell: |
110+
if($env:CDP_BUILD_TYPE -eq 'Official')
111+
{
112+
# Recursively find all .dll files in TempFolder (installed nuget folder)
113+
# Microsoft.Data.SqlClient.dll and Microsoft.Data.SqlClient.resources.dll (in localized folders) should have strong name
114+
$dllFiles = Get-ChildItem -Path $(TempFolderName) -Recurse -Filter *.dll
115+
$badDlls = @()
116+
foreach ($file in $dllFiles)
117+
{
118+
# Run sn.k to verify the strong name on each dll
119+
$result = & "C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\NETFX 4.8.1 Tools\sn.exe" -vf $file.FullName
120+
Write-OutPut $result
121+
122+
# if thhe dll is not valid, it would be delay signed or test-signed which is not meant for production
123+
if($result[$result.Length-1] -notlike "* is valid")
124+
{
125+
$badDlls += $result[$result.Length-1]
126+
}
127+
}
128+
if($badDlls.Count -gt 0)
129+
{
130+
Write-OutPut "Error: Invalid dlls are detected. Chek below list:"
131+
foreach($dll in $badDlls)
132+
{
133+
Write-Output $dll
134+
}
135+
Exit -1
136+
}
137+
Write-Host "Strong name has been verified for all dlls"
138+
}
139+
else
140+
{
141+
Write-OutPut "Strong name verification is not required for non-official builds"
142+
}
143+
displayName: 'Verify strong name is generated for production'
144+
109145
- powershell: |
110146
# Checks the expected folder names such as lib, ref, runtimes
111147
Get-ChildItem -Path $(extractedNugetPath) -Directory | select Name | foreach {
@@ -208,7 +244,6 @@ jobs:
208244
}
209245
}
210246
displayName: 'Verify all DLLs unzipped match "expected" hierarchy'
211-
212247
- powershell: |
213248
# Verify all dlls status are Valid
214249

0 commit comments

Comments
 (0)