Skip to content

Commit bb2ae62

Browse files
authored
Check files are signed after Submit-SigningRequest (#19113)
Fixes #19099 Supersedes #18384 ### Summary of the issue: Some files are not signed some of the time ### Description of user facing changes: None ### Description of developer facing changes: In the case of alpha, beta, rc, stable and try builds, failure to sign the launcher or most of our executables will fail the build. All CI builds now run serially to avoid race conditions. ### Description of development approach: Set the `ErrorAction` common parameter on `Send-SigningRequest` to `Stop` to cause the signing script to fail if the cmd-let fails. Use `Get-AuthenticodeSignature` to verify the signature of files after `Submit-SigningRequest` returns. ### Testing strategy: CI * [x] Successful signing: https://github.com/nvaccess/nvda/actions/runs/18733609673 * Note that this run's failure was due to a system test failure * Checked that the launcher and all `dll` and `exe` files are signed. Found unsigned `exe`s and `dll` s by unzipping the controller client and launcher into the same directory, and running: ```ps1 (Get-ChildItem -Recurse -Include *.exe, *.dll -Name | Get-AuthenticodeSignature | where-object {$_.Status -ne 'Valid'}).Path ``` The following files do not have valid signatures: * `app\brailleDisplayDrivers\lilli.dll` * `app\miscDeps\tools\msgfmt.exe` * `app\synthDrivers\espeak.dll` * `app\synthDrivers\sonic.dll` * `app\brlapi-0.8.dll` * `app\libgcc_s_dw2-1.dll` * `app\wxbase32u_net_vc140.dll` * `app\wxbase32u_vc140.dll` * `app\wxmsw32u_aui_vc140.dll` * `app\wxmsw32u_core_vc140.dll` * `app\wxmsw32u_html_vc140.dll` * `app\wxmsw32u_stc_vc140.dll` * `Banner.dll` * `System.dll` However, as best as I can tell, we never attempt to sign these files. * [x] Intentionally don't sign a DLL: https://github.com/nvaccess/nvda/actions/runs/18703904287 * [x] Intentionally don't sign the launcher: https://github.com/nvaccess/nvda/actions/runs/18707118372 ### Known issues with pull request: None
1 parent 6f4dffa commit bb2ae62

File tree

2 files changed

+44
-11
lines changed

2 files changed

+44
-11
lines changed

ci/scripts/setSconsArgs.ps1

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,9 @@ $ErrorActionPreference = "Stop";
22
$sconsDocsOutTargets = "developerGuide changes userGuide keyCommands user_docs"
33
$sconsLauncherOutTargets = "launcher client moduleList"
44
$sconsArgs = "version=$env:version"
5-
$sconsCores = "--all-cores"
6-
if ($env:RUNNER_DEBUG -eq "1") {
7-
# Run scons linearly if we are in debug mode, so logs can be easily parsed
8-
$sconsCores = "-j1"
9-
}
5+
$sconsCores = "-j1"
106
if ($env:release) {
117
$sconsArgs += " release=1"
12-
# Run scons linearly for release builds, so we can debug if something goes wrong,
13-
# as we cannot safely re-run a released build
14-
$sconsCores = "-j1"
158
}
169
if ($env:versionType) {
1710
$sconsArgs += " updateVersionType=$env:versionType"

ci/scripts/sign.ps1

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,48 @@
44
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
55

66
param(
7-
[string]$ApiToken,
8-
[string]$FileToSign
7+
[string]$ApiToken,
8+
[string]$FileToSign
99
)
1010

11-
Submit-SigningRequest -ApiToken $ApiToken -InputArtifactPath $FileToSign -OutputArtifactPath $FileToSign -OrganizationId "12147e94-bba9-4fef-b29b-300398e90c5a" -ProjectSlug "NVDA" -SigningPolicySlug "release_signing_policy" -WaitForCompletion -Force
11+
Submit-SigningRequest -ApiToken $ApiToken -InputArtifactPath $FileToSign -OutputArtifactPath $FileToSign -OrganizationId "12147e94-bba9-4fef-b29b-300398e90c5a" -ProjectSlug "NVDA" -SigningPolicySlug "release_signing_policy" -WaitForCompletion -Force -ErrorAction Stop
12+
13+
$authenticodeSignature = Get-AuthenticodeSignature -FilePath $FileToSign
14+
if (($authenticodeSignature).Status -ne 'Valid') {
15+
Write-Error "The signature of $FileToSign is not valid."
16+
Write-Output @"
17+
FAIL: Signature is not valid.
18+
19+
<details>
20+
<summary>Signature details</summary>
21+
22+
$($authenticodeSignature | ConvertTo-Html -fragment -Property Path, SignatureType, Status, StatusMessage)
23+
24+
Signer certificate:
25+
$(
26+
if ($null -eq $authenticodeSignature.SignerCertificate) {
27+
"None"
28+
} else {
29+
$authenticodeSignature.SignerCertificate | ConvertTo-Html -fragment -Property Subject, Issuer, SerialNumber, Thumbprint, `
30+
@{Name='NotBefore'; Expr={$_.NotBefore.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")}},`
31+
@{Name='NotAfter'; Expr={$_.NotAfter.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")}}
32+
}
33+
)
34+
35+
Timestamper certificate:
36+
$(
37+
if ($null -eq $authenticodeSignature.TimestamperCertificate) {
38+
"None"
39+
} else {
40+
$authenticodeSignature.TimestamperCertificate | ConvertTo-Html -fragment -Property Subject, Issuer, SerialNumber, Thumbprint,`
41+
@{Name='NotBefore'; Expr={$_.NotBefore.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")}},`
42+
@{Name='NotAfter'; Expr={$_.NotAfter.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")}}
43+
}
44+
)
45+
46+
</details>
47+
"@ >> $env:GITHUB_STEP_SUMMARY
48+
exit 1
49+
} else {
50+
Write-Output "Successfully signed $FileToSign."
51+
}

0 commit comments

Comments
 (0)