[release/v7.6.2] Add macOS binary code signing and package notarization#27434
Merged
daxian-dbw merged 1 commit intoMay 13, 2026
Conversation
Uses codesign in the macOS build step to apply entitlements from a plist. This is required for the hardened runtime (which is required for notarization). See: https://learn.microsoft.com/en-us/dotnet/core/install/macos-notarization-issues#default-entitlements Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR (backport of #27347) starts introducing macOS hardened runtime preparation by adding an entitlements plist and applying those entitlements to the built pwsh binary in the macOS build pipeline via codesign.
Changes:
- Add a new
assets/macos-entitlements.plistentitlements file intended for hardened runtime. - Update
.pipelines/templates/mac.ymlto runcodesignon the builtpwshwith--options runtimeand the new entitlements.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| assets/macos-entitlements.plist | Introduces an entitlements plist to be applied during macOS signing/hardening. |
| .pipelines/templates/mac.yml | Applies the entitlements to pwsh during the macOS build job via codesign. |
Comment on lines
+72
to
+76
| $entitlements = "$(PowerShellRoot)/assets/macos-entitlements.plist" | ||
| $pwshBin = "$(OB_OUTPUTDIRECTORY)/pwsh" | ||
| Write-Verbose -Verbose "Applying entitlements to $pwshBin" | ||
| codesign --sign - --force --options runtime --entitlements $entitlements $pwshBin | ||
| if ($LASTEXITCODE -ne 0) { |
Comment on lines
+72
to
+79
| $entitlements = "$(PowerShellRoot)/assets/macos-entitlements.plist" | ||
| $pwshBin = "$(OB_OUTPUTDIRECTORY)/pwsh" | ||
| Write-Verbose -Verbose "Applying entitlements to $pwshBin" | ||
| codesign --sign - --force --options runtime --entitlements $entitlements $pwshBin | ||
| if ($LASTEXITCODE -ne 0) { | ||
| throw "codesign failed with exit code $LASTEXITCODE" | ||
| } | ||
Comment on lines
+8
to
+12
| <true/> | ||
| <key>com.apple.security.cs.allow-dyld-environment-variables</key> | ||
| <true/> | ||
| <key>com.apple.security.cs.disable-library-validation</key> | ||
| <true/> |
SeeminglyScience
approved these changes
May 13, 2026
Member
Author
|
Andy's two PRs below were "rebase merged", which is unexpected and caused all commits from those PRs to get into the master branch without squashing. The backport logic assumes squashing merge always, so it only picks up the last commit.
Therefore, a commit was missed for this backport PR. I manually backported the missing commits into #27439, even though it doesn't really belong there. |
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.
Backport of #27347 to release/v7.6.2
Triggered by @daxian-dbw on behalf of @andyleejordan
Original CL Label: CL-BuildPackaging
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Adds Apple notarization for macOS packages: signs and hardens binaries using ESRP/OneBranch signing tasks, notarizes the PKG installer, and applies entitlements required for the hardened runtime.
Customer Impact
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Verified via the original PR. The signing and notarization flow was validated interactively. No automated tests added as this can only be tested through the full pipeline run.
Risk
REQUIRED: Check exactly one box.
Significant pipeline changes to add Apple notarization support, but all changes are confined to build/signing pipeline templates and tooling. No runtime code changes.