Skip to content
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

Eng | Add strong name validation to package validator #2802

Merged
merged 5 commits into from
Aug 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add official pipeline check
  • Loading branch information
JRahnama committed Aug 21, 2024
commit d774e712ca8ccc91944edf44ce3ffb89c8ea71bc
47 changes: 27 additions & 20 deletions eng/pipelines/common/templates/jobs/validate-signed-package-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,32 +107,39 @@ jobs:
displayName: 'Verify nuget signature'

- powershell: |
DavoudEshtehari marked this conversation as resolved.
Show resolved Hide resolved
# Recursively find all .dll files in TempFolder (installed nuget folder)
# Microsoft.Data.SqlClient.dll and Microsoft.Data.SqlClient.resources.dll (in localized folders) should have strong name
$dllFiles = Get-ChildItem -Path $(TempFolderName) -Recurse -Filter *.dll
$badDlls = @()
foreach ($file in $dllFiles)
if($env:CDP_BUILD_TYPE -eq 'Official')
{
# Run sn.k to verify the strong name on each dll
$result = & "C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\NETFX 4.8.1 Tools\sn.exe" -vf $file.FullName
Write-OutPut $result
# Recursively find all .dll files in TempFolder (installed nuget folder)
# Microsoft.Data.SqlClient.dll and Microsoft.Data.SqlClient.resources.dll (in localized folders) should have strong name
$dllFiles = Get-ChildItem -Path $(TempFolderName) -Recurse -Filter *.dll
$badDlls = @()
foreach ($file in $dllFiles)
{
# Run sn.k to verify the strong name on each dll
$result = & "C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\NETFX 4.8.1 Tools\sn.exe" -vf $file.FullName
Write-OutPut $result

# if thhe dll is not valid, it would be delay signed or test-signed which is not meant for production
if($result[$result.Length-1] -notlike "* is valid")
{
$badDlls += $result[$result.Length-1]
# if thhe dll is not valid, it would be delay signed or test-signed which is not meant for production
if($result[$result.Length-1] -notlike "* is valid")
{
$badDlls += $result[$result.Length-1]
}
}
if($badDlls.Count -gt 0 -gt 0)
{
Write-OutPut "Error: Invalid dlls are detected. Chek below list:"
foreach($dll in $badDlls)
{
Write-Output $dll
}
Exit -1
}
Write-Host "Strong name has been verified for all dlls"
}
if($badDlls.Count -gt 0 -gt 0)
else
{
Write-OutPut "Error: Invalid dlls are detected. Chek below list:"
foreach($dll in $badDlls)
{
Write-Output $dll
}
Exit -1
Write-OutPut "Strong name verification is not required for non-official builds"
}
Write-Host "Strong name has been verified for all dlls"
displayName: 'Verify strong name is generated for production'

- powershell: |
Expand Down
Loading