Skip to content

Fix *nix permissions and use certificate_logical_to_actual#27385

Merged
andyleejordan merged 3 commits into
masterfrom
andyleejordan/nix-permissions
May 5, 2026
Merged

Fix *nix permissions and use certificate_logical_to_actual#27385
andyleejordan merged 3 commits into
masterfrom
andyleejordan/nix-permissions

Conversation

@andyleejordan
Copy link
Copy Markdown
Member

PR Summary

Fixes #23968 (with regression tests) and finishes the certificate code abstraction.

Redux of #27354 which got merged too soon.

PR Context

In the pipelines we for reasons have to zip up the macOS and Linux builds on Windows which strips the executable permissions. We already had logic in the package scripts to correctly restore those permissions before building the RPM, DEB, and PKG packages, but not before packaging the tarball. Per the bug, it's been sadly broken for two years. You'd download the tarball, try to run ./pwsh and it wouldn't be executable. Now it is, with a regression test that checks the actual file in the tarball before we upload it.

PR Checklist

@andyleejordan andyleejordan requested review from a team and jshigetomi as code owners May 1, 2026 20:35
TravisEz13
TravisEz13 previously approved these changes May 1, 2026
Base automatically changed from andyleejordan/apple-notarization to master May 1, 2026 20:52
@andyleejordan andyleejordan dismissed TravisEz13’s stale review May 1, 2026 20:52

The base branch was changed.

andyleejordan and others added 2 commits May 1, 2026 13:52
The tarball staging path used `Copy-Item`, which on *nix doesn't preserve
the source file mode, so `pwsh` ended up 644 in the `.tar.gz`. The Debian,
RPM, and macOS PKG paths explicitly `chmod` everything to 644 and then bump
`pwsh` back to 755, which silently demoted `createdump` (the .NET helper
that produces crash minidumps) along with it. Now we `chmod 755` both
executables in all package staging paths, guarded by `Test-Path` since
fxdependent builds don't bundle `createdump`.

Also added regression tests which check the permissions of `pwsh` inside
the Linux and macOS tarballs before we upload them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… group

The `CP-…` key codes used for ESRP signing are now set from ADO via the
`certificate_logical_to_actual` variable group. The templates reference
the following variables instead of literal codes:

- `$(authenticode_cert_id)`
- `$(authenticode_test_cert_id)`
- `$(nuget_cert_id)`
- `$(apple_cert_id)`
- `$(pgp_linux_cert_id)`
- `$(pgp_release_cert_id)`

`nupkg.yml`, `mac-package-build.yml`, and `linux-package-build.yml` pick
up the new group import. `linux-package-build.yml` also now selects the
PGP signing profile based on whether `jobName` starts with `mariner`, so
`PowerShell-Packages-Stages.yml` no longer threads a `signingProfile`
parameter in for the two Mariner jobs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@andyleejordan andyleejordan force-pushed the andyleejordan/nix-permissions branch from 6bffb1b to 2237859 Compare May 1, 2026 20:53
It's been this way for a couple years which means we've been passing...something else?
Copilot AI review requested due to automatic review settings May 1, 2026 20:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates packaging and pipeline signing configuration to (1) restore executable permissions in *nix tarball outputs and (2) replace hardcoded certificate/key codes with values sourced from the certificate_logical_to_actual variable group.

Changes:

  • Restore +x on pwsh (and createdump when present) before producing tarball artifacts and in relevant Unix packaging flows.
  • Add pipeline regression checks that validate pwsh is executable inside produced .tar.gz artifacts.
  • Replace hardcoded signing cp_code/KeyCode/PGP profile values with variable-group-backed IDs (e.g., $(nuget_cert_id), $(apple_cert_id), $(pgp_linux_cert_id)).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/packaging/packaging.psm1 Ensures pwsh/createdump are marked executable in tarball + Unix packaging staging/targets.
.pipelines/templates/windows-hosted-build.yml Uses $(nuget_cert_id) instead of a hardcoded NuGet signing code.
.pipelines/templates/stages/PowerShell-Packages-Stages.yml Removes explicit Mariner signing profile parameter (now selected inside the linux package template).
.pipelines/templates/shouldSign.yml Switches authenticode/MSIX cert selection to variable-group-backed IDs.
.pipelines/templates/nupkg.yml Adds certificate_logical_to_actual group and uses $(nuget_cert_id) for signing.
.pipelines/templates/mac.yml Uses $(apple_cert_id) for mac signing KeyCode.
.pipelines/templates/mac-package-build.yml Adds tarball content check for pwsh executable bit; adds cert variable group for signing job.
.pipelines/templates/linux-package-build.yml Fixes signedDrop param name, selects PGP signing profile via variable group, and adds tarball permission regression check.

Comment thread .pipelines/templates/linux-package-build.yml
@andyleejordan andyleejordan added OS-Linux Compliance Related to compliance requirements CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log labels May 1, 2026
@andyleejordan
Copy link
Copy Markdown
Member Author

@TravisEz13 @jshigetomi this should also be good to go!

@andyleejordan andyleejordan enabled auto-merge (rebase) May 2, 2026 00:00
@andyleejordan
Copy link
Copy Markdown
Member Author

@adityapatwardhan any issues?

Comment thread .pipelines/templates/linux-package-build.yml
# Included .NET executable for producing crash dumps
$createdumpInStaging = Join-Path $Staging 'createdump'
if (Test-Path -LiteralPath $createdumpInStaging) {
Start-NativeExecution { chmod 755 $createdumpInStaging }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be chmod a+x, so we dont change other bits.

Copy link
Copy Markdown
Member Author

@andyleejordan andyleejordan May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed change is consistent with the existing choice to use numbered / explicit permissions in packaging.psm1 so I don't we should differ here until if and when we want to update the whole file (and run that through a barrage of testing). That said, I don't think I recommend that, because I posit that "don't change other bits" doesn't really apply here, since the root bug being addressed is that the pipeline moves the files from *nix where they were made (with correct permisison bits) to Windows which loses all sense of file permissions, that is, all the bits have already been changed, so updating them explicitly is I think more correct.

Screenshot 2026-05-05 at 12 33 38 PM

Comment thread tools/packaging/packaging.psm1
Comment thread tools/packaging/packaging.psm1
Comment thread tools/packaging/packaging.psm1
@microsoft-github-policy-service microsoft-github-policy-service Bot added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels May 5, 2026
@andyleejordan andyleejordan merged commit 36673f6 into master May 5, 2026
58 of 59 checks passed
@andyleejordan andyleejordan deleted the andyleejordan/nix-permissions branch May 5, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.4.x-Consider Backport-7.5.x-Approved Backport-7.6.x-Done CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log Compliance Related to compliance requirements OS-Linux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux release does not have +x set on various files in the tar.gz (7.4.3)

5 participants