Verify Apple codesign immediately after ESRP signing#27486
Merged
daxian-dbw merged 1 commit intoMay 20, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
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:
- Add a
codesign --verify --deep --strictverification loop overpwshand*.dylibin.pipelines/templates/mac.ymlright after expanding the ESRP-signed zip.
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 <[email protected]>
69e866f to
d7c0ee0
Compare
Member
Author
|
Updated to work on Windows. I hand checked the script: |
daxian-dbw
approved these changes
May 20, 2026
9 tasks
9 tasks
9 tasks
JustinGrote
pushed a commit
to JustinGrote/PowerShell
that referenced
this pull request
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Add an equivalent of
codesign --verify --deep --strictstep in theSign_macOS_*jobs immediately after expanding the zip returned by ESRP. This is similar to the verification already run downstream inmac-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_x64job's ESRP submission returnedstatusCode: passwith"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 baddrop_macos_sign_x64artifact.Running the same verify here surfaces this class of silent ESRP no-op in the job that owns the signing, so:
drop_macos_sign_*artifact is never published.PR Context
Defense-in-depth follow-up to #27347.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header — N/A (pipeline YAML)[Job-specific change to .pipelines/templates/mac.yml only]