-
Notifications
You must be signed in to change notification settings - Fork 0
P2: Code signing for exe + installer (CI integration) #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,21 @@ jobs: | |||||||||||||||
| with: | ||||||||||||||||
| ref: ${{ env.RELEASE_TAG }} | ||||||||||||||||
|
|
||||||||||||||||
| - name: Prepare signing certificate | ||||||||||||||||
| shell: pwsh | ||||||||||||||||
| env: | ||||||||||||||||
| CLOUDSQLCTL_SIGN_CERT_B64: ${{ secrets.CLOUDSQLCTL_SIGN_CERT_B64 }} | ||||||||||||||||
| CLOUDSQLCTL_SIGN_PWD: ${{ secrets.CLOUDSQLCTL_SIGN_PWD }} | ||||||||||||||||
| run: | | ||||||||||||||||
| if (-not $env:CLOUDSQLCTL_SIGN_CERT_B64) { | ||||||||||||||||
| Write-Host "Signing cert not provided; skipping signing setup." | ||||||||||||||||
| exit 0 | ||||||||||||||||
| } | ||||||||||||||||
| $certPath = Join-Path $env:RUNNER_TEMP "cloudsqlctl-signing.pfx" | ||||||||||||||||
| [IO.File]::WriteAllBytes($certPath, [Convert]::FromBase64String($env:CLOUDSQLCTL_SIGN_CERT_B64)) | ||||||||||||||||
| "CLOUDSQLCTL_SIGN_CERT=$certPath" | Out-File -FilePath $env:GITHUB_ENV -Append | ||||||||||||||||
| "CLOUDSQLCTL_SIGN_PWD=$env:CLOUDSQLCTL_SIGN_PWD" | Out-File -FilePath $env:GITHUB_ENV -Append | ||||||||||||||||
|
|
||||||||||||||||
| - name: Use Node.js 22.x | ||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||
| with: | ||||||||||||||||
|
|
@@ -54,6 +69,13 @@ jobs: | |||||||||||||||
| - name: Build Installer | ||||||||||||||||
| run: npm run installer | ||||||||||||||||
|
|
||||||||||||||||
| - name: Sign artifacts | ||||||||||||||||
| if: ${{ env.CLOUDSQLCTL_SIGN_CERT != '' }} | ||||||||||||||||
| shell: pwsh | ||||||||||||||||
| run: | | ||||||||||||||||
| powershell -ExecutionPolicy Bypass -File tools/sign-exe.ps1 -ExePath "bin/cloudsqlctl.exe" | ||||||||||||||||
| powershell -ExecutionPolicy Bypass -File tools/sign-exe.ps1 -ExePath "dist/cloudsqlctl-setup.exe" | ||||||||||||||||
|
Comment on lines
+76
to
+77
|
||||||||||||||||
| powershell -ExecutionPolicy Bypass -File tools/sign-exe.ps1 -ExePath "bin/cloudsqlctl.exe" | |
| powershell -ExecutionPolicy Bypass -File tools/sign-exe.ps1 -ExePath "dist/cloudsqlctl-setup.exe" | |
| & tools/sign-exe.ps1 -ExePath "bin/cloudsqlctl.exe" | |
| & tools/sign-exe.ps1 -ExePath "dist/cloudsqlctl-setup.exe" |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The certificate file should be explicitly deleted after signing completes to minimize the time sensitive credentials exist on disk. While RUNNER_TEMP is automatically cleaned up after the job finishes, explicitly removing the certificate immediately after use follows security best practices for credential handling.
Consider adding cleanup after the signing step, either:
- Add a cleanup command at the end of the "Sign artifacts" step
- Add a separate cleanup step with
if: always()to ensure cleanup even if signing fails
For example, at the end of the signing step:
Remove-Item -Path $env:CLOUDSQLCTL_SIGN_CERT -Force -ErrorAction SilentlyContinue| - name: Cleanup signing certificate | |
| if: ${{ always() && env.CLOUDSQLCTL_SIGN_CERT != '' }} | |
| shell: pwsh | |
| run: | | |
| Remove-Item -Path $env:CLOUDSQLCTL_SIGN_CERT -Force -ErrorAction SilentlyContinue |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # Cloud SQL Proxy CLI Reference | ||
|
|
||
| **Version:** 0.4.14 | ||
| **Version:** 0.4.15 | ||
| **Generated:** 2025-12-22 | ||
|
|
||
| ## Overview | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 suggestion (security): Avoid broadening the exposure of the signing password by putting it into GITHUB_ENV.
Writing
CLOUDSQLCTL_SIGN_PWDtoGITHUB_ENVmakes it available to all later steps in the job, unnecessarily widening exposure if any of those steps are compromised or misconfigured. Since the secret is already available in this step’s environment, prefer passing it only to the signing step (e.g., viaenv:on that step or as an argument to the signing script) instead of promoting it to a job-wide variable.Suggested implementation: