Lightweight coding agent that runs in your terminal
Rust
Sign the PowerShell installer in Windows releases (#51158)
chess7c2ce9071633
diff --git a/.github/actions/windows-code-sign/action.yml b/.github/actions/windows-code-sign/action.ymlindex 24f8632979..bbfca8c268 100644--- a/.github/actions/windows-code-sign/action.yml+++ b/.github/actions/windows-code-sign/action.yml@@ -1,5 +1,5 @@name: windows-code-sign-description: Sign Windows binaries with Azure Trusted Signing.+description: Sign Windows release files with Azure Trusted Signing.inputs:target:description: Target triple for the artifacts to sign.@@ -7,6 +7,9 @@ inputs:binaries:description: Space-delimited binary basenames to sign.default: "codex codex-responses-api-proxy codex-windows-sandbox-setup codex-command-runner"+ additional-files:+ description: Newline-delimited absolute paths to additional files to sign.+ default: ""client-id:description: Azure Trusted Signing client ID.required: true@@ -42,6 +45,7 @@ runs:env:TARGET: ${{ inputs.target }}BINARIES: ${{ inputs.binaries }}+ ADDITIONAL_FILES: ${{ inputs.additional-files }}run: |set -euo pipefail@@ -50,10 +54,13 @@ runs:for binary in ${BINARIES}; doecho "${CARGO_TARGET_DIR}/${TARGET}/release/${binary}.exe"done+ if [[ -n "$ADDITIONAL_FILES" ]]; then+ printf '%s\n' "$ADDITIONAL_FILES"+ fiecho "EOF"} >> "$GITHUB_OUTPUT"- - name: Sign Windows binaries with Azure Trusted Signing+ - name: Sign Windows release files with Azure Trusted Signinguses: azure/trusted-signing-action@1d365fec12862c4aa68fcac418143d73f0cea293 # v0.5.11with:endpoint: ${{ inputs.endpoint }}diff --git a/.github/workflows/rust-release-windows.yml b/.github/workflows/rust-release-windows.ymlindex 20490c5ec5..516d31754a 100644--- a/.github/workflows/rust-release-windows.yml+++ b/.github/workflows/rust-release-windows.yml@@ -384,11 +384,13 @@ jobs:ls -lh "$CARGO_TARGET_DIR/${{ matrix.target }}/release/${binary}.exe"done- - name: Sign Windows binaries with Azure Trusted Signing+ - name: Sign Windows release files with Azure Trusted Signinguses: ./.github/actions/windows-code-signwith:target: ${{ matrix.target }}binaries: ${{ env.WINDOWS_BINARIES }}+ # The installer is architecture-independent; sign it only in the x64 job.+ additional-files: ${{ matrix.target == 'x86_64-pc-windows-msvc' && format('{0}/scripts/install/install.ps1', github.workspace) || '' }}client-id: ${{ secrets.AZURE_ARTIFACT_SIGNING_CLIENT_ID }}tenant-id: ${{ secrets.AZURE_ARTIFACT_SIGNING_TENANT_ID }}subscription-id: ${{ secrets.AZURE_ARTIFACT_SIGNING_SUBSCRIPTION_ID }}@@ -617,6 +619,18 @@ jobs:"${GITHUB_WORKSPACE}/.github/workflows/zstd" -T0 -19 "$dest/$base"' _+ - name: Verify and stage signed PowerShell installer+ if: matrix.target == 'x86_64-pc-windows-msvc'+ shell: powershell+ run: |+ $installer = Join-Path $env:GITHUB_WORKSPACE 'scripts/install/install.ps1'+ $signature = Get-AuthenticodeSignature $installer+ if ($signature.Status -ne 'Valid' -or $null -eq $signature.TimeStamperCertificate) {+ throw "Installer signature is invalid or missing a timestamp: $($signature.Status)"+ }+ # Stage after compression so the installer remains a plain script.+ Copy-Item $installer 'dist/${{ matrix.target }}/install.ps1'+- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0with:name: ${{ matrix.target }}diff --git a/.github/workflows/rust-release.yml b/.github/workflows/rust-release.ymlindex c542015cfd..13e58ee28e 100644--- a/.github/workflows/rust-release.yml+++ b/.github/workflows/rust-release.yml@@ -1674,7 +1674,7 @@ jobs:- name: Stage installer scriptsrun: |cp scripts/install/install.sh dist/install.sh- cp scripts/install/install.ps1 dist/install.ps1+ mv dist/x86_64-pc-windows-msvc/install.ps1 dist/install.ps1- name: Create GitHub Releaseuses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3