Support macOS signatures in nonofficial pipelines - #27976
Open
Justin Chung (jshigetomi) wants to merge 3 commits into
Open
Justin Chung (jshigetomi) wants to merge 3 commits into
Justin Chung (jshigetomi) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 282853d0-d027-4558-9425-624a244cb9a3
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 282853d0-d027-4558-9425-624a244cb9a3
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 282853d0-d027-4558-9425-624a244cb9a3
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Justin Chung (jshigetomi)
September 4, 2026 18:14
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new macOS signing helper should align with established repo conventions for native command execution and verbosity control to ensure consistent diagnostics and log behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds support for validating and (when allowed) repairing macOS Mach-O signatures in nonofficial coordinated-build packaging pipelines, while keeping official builds verification-only and requiring Developer ID signatures.
Changes:
- Introduces
Update-MacOSCodeSignature.ps1to verify signatures and (for nonofficial builds) apply ad-hoc signing + strict re-verification. - Updates macOS packaging pipeline templates to pass
OfficialBuildthrough and invoke the new helper. - Extends macOS coordinated-build signature validation to accept either the Microsoft Developer ID signature (official) or an ad-hoc CodeDirectory (nonofficial).
File summaries
| File | Description |
|---|---|
| tools/packaging/Update-MacOSCodeSignature.ps1 | New helper to verify codesign output and repair nonofficial artifacts with ad-hoc signatures before packaging. |
| .pipelines/templates/stages/PowerShell-Packages-Stages.yml | Plumbs OfficialBuild into macOS package template invocations. |
| .pipelines/templates/mac.yml | Adjusts coordinated-build signature validation to accept Developer ID or ad-hoc CodeDirectory depending on officialness. |
| .pipelines/templates/mac-package-build.yml | Adds OfficialBuild parameter and uses the new helper to apply/verify codesign on macOS package agents. |
Review details
Suppressed comments (2)
tools/packaging/Update-MacOSCodeSignature.ps1:35
- The initial
codesign --verifycall is handled via$LASTEXITCODE, which losescodesignstderr and is inconsistent with the repo’sStart-NativeExecutionerror handling. Wrapping verification inStart-NativeExecution(with a try/catch to allow the nonofficial repair path) provides better diagnostics without changing behavior.
& codesign --verify --deep --strict --verbose=4 $binary.FullName
if ($LASTEXITCODE -eq 0) {
continue
}
if ($OfficialBuild) {
throw "codesign verification failed for '$($binary.FullName)'."
}
tools/packaging/Update-MacOSCodeSignature.ps1:54
- The ad-hoc signing and post-sign verification use manual
$LASTEXITCODEchecks, which drops native output and duplicates error handling logic. UsingStart-NativeExecution -VerboseOutputOnErrorhere will surfacecodesign’s diagnostics in verbose logs on failure and keeps error handling consistent with the rest of the repo.
& codesign @signArguments
if ($LASTEXITCODE -ne 0) {
throw "Ad-hoc codesign failed for '$($binary.FullName)'."
}
& codesign --verify --deep --strict --verbose=4 $binary.FullName
if ($LASTEXITCODE -ne 0) {
throw "codesign verification failed for '$($binary.FullName)' after applying an ad-hoc signature."
}
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+17
to
+18
|
|
||
| $binaries = @( |
|
|
||
| # Nonofficial signing can leave only one slice of a universal binary signed. | ||
| # Re-signing on macOS applies an ad-hoc signature across every architecture. | ||
| Write-Verbose -Message "Applying an ad-hoc signature to '$($binary.FullName)' for the nonofficial package." -Verbose |
Dongbo Wang (daxian-dbw)
approved these changes
Sep 4, 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
codesignverification before packaging.PR Context
The nonofficial signing service can return a universal
libpsl-native.dylibwith only one architecture slice signed. The coordinated Windows check found an ad-hoc CodeDirectory, but native macOS verification rejected the unsigned x86_64 slice. Nonofficial package jobs now repair only binaries that fail verification and then verify every Mach-O binary withcodesign --verify --deep --strict.Validation:
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header