| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR aims to fail fast on macOS ESRP “successful but unsigned output” cases by verifying Apple code signatures immediately after expanding the ESRP-returned zip in the Sign_macOS_* jobs, mirroring the verification already performed later in mac-package-build.yml.
Changes:
Sorry, something went wrong.
The Sign_macOS_* jobs run on a Windows pool, so we cannot call `codesign`. Scan each Mach-O for the certificate-subject string `Developer ID Application: Microsoft Corporation` that ESRP embeds into the CMS signature blob; if it is absent, ESRP did not actually sign the file and we fail the job. This catches silent ESRP no-ops (statusCode=pass with byte-identical output) in the job that owns the signing rather than one stage later in packaging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Updated to work on Windows. I hand checked the script: > cat ./verify-step.ps1
param([string]$signedDir)
$expected = 'Developer ID Application: Microsoft Corporation'
$missing = @()
Get-ChildItem $signedDir -Recurse -Include 'pwsh', '*.dylib' | ForEach-Object {
$bytes = [System.IO.File]::ReadAllBytes($_.FullName)
$text = [System.Text.Encoding]::Latin1.GetString($bytes)
if (-not $text.Contains($expected)) {
$missing += $_.FullName
Write-Host "##[error]Missing '$expected' signature in $($_.FullName)"
} else {
Write-Host "OK: $($_.FullName)"
}
}
if ($missing.Count -gt 0) {
throw "ESRP did not apply a Developer ID signature to $($missing.Count) file(s): $($missing -join ', ')"
}
> ./verify-step.ps1 /tmp/sign76out/
OK: /tmp/sign76out/drop_macos_sign_x64/Signed-x64/libcoreclr.dylib
OK: /tmp/sign76out/drop_macos_sign_x64/Signed-x64/libpsl-native.dylib
OK: /tmp/sign76out/drop_macos_sign_x64/Signed-x64/libSystem.Native.dylib
> ./verify-step.ps1 /tmp/sign74out/
##[error]Missing 'Developer ID Application: Microsoft Corporation' signature in /tmp/sign74out/drop_macos_sign_x64/Signed-x64/libcoreclr.dylib
##[error]Missing 'Developer ID Application: Microsoft Corporation' signature in /tmp/sign74out/drop_macos_sign_x64/Signed-x64/libpsl-native.dylib
##[error]Missing 'Developer ID Application: Microsoft Corporation' signature in /tmp/sign74out/drop_macos_sign_x64/Signed-x64/libSystem.Native.dylib
##[error]Missing 'Developer ID Application: Microsoft Corporation' signature in /tmp/sign74out/drop_macos_sign_x64/Signed-x64/libSystem.Security.Cryptography.Native.OpenSsl.dylib
##[error]Missing 'Developer ID Application: Microsoft Corporation' signature in /tmp/sign74out/drop_macos_sign_x64/Signed-x64/pwsh
Exception: /private/tmp/verify-step.ps1:15
Line |
15 | throw "ESRP did not apply a Developer ID signature to $($missing.Co …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ESRP did not apply a Developer ID signature to 5 file(s):
| /tmp/sign74out/drop_macos_sign_x64/Signed-x64/libcoreclr.dylib,
| /tmp/sign74out/drop_macos_sign_x64/Signed-x64/libpsl-native.dylib,
| /tmp/sign74out/drop_macos_sign_x64/Signed-x64/libSystem.Native.dylib,
| /tmp/sign74out/drop_macos_sign_x64/Signed-x64/libSystem.Security.Cryptography.Native.OpenSsl.dylib,
| /tmp/sign74out/drop_macos_sign_x64/Signed-x64/pwsh
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
Add an equivalent of codesign --verify --deep --strict step in the Sign_macOS_* jobs immediately after expanding the zip returned by ESRP. This is similar to the verification already run downstream in mac-package-build.yml, but running it inside the sign job means we fail fast in the producing pipeline instead of discovering the problem later in packaging. And it uses PowerShell to just look at the files so it can run on Windows.
Motivation
In a release build, the Sign_macOS_x64 job's ESRP submission returned statusCode: pass with "1 files signed successfully!", but the returned zip contained byte-identical Mach-O entries with no Developer ID Application signature applied. ESRP silently no-op'd. The failure only surfaced in the downstream packaging pipeline's verify step (added in #27347), one stage later, after we had already published the bad drop_macos_sign_x64 artifact.
Running the same verify here surfaces this class of silent ESRP no-op in the job that owns the signing, so:
PR Context
Defense-in-depth follow-up to #27347.
PR Checklist
[Job-specific change to .pipelines/templates/mac.yml only]