Windows Authenticode 签名¶
Windows 版本使用 Anomaly 的 Azure Artifact Signing(前身为 Trusted Signing)账户,通过 GitHub Actions 进行 Authenticode 签名。签名与发布服务是分开的:Authenticode 是 Windows 和 SmartScreen 检查的内容,Hex 的更新程序在安装更新之前还会再次检查它(连同清单的 SHA-256)。
流水线¶
.github/workflows/release.yml,与 OpenCode 的发布流程一样拆分:
build (build-desktop.yml; x64 and ARM64 runners) // compiles; no environment or secrets
└── build-windows-<arch>: hex-<v>-windows-<x64|arm64>.exe (+ SHA256SUMS, digest output)
sign-windows (release env, .github/release only)
├── verify the artifacts' digests
├── azure/login (OIDC, no client secret)
├── artifact-signing-action: both hex.exe // SHA-256, RFC 3161 timestamp
└── verify-authenticode.ps1 // every exe Valid + timestamped
installers (windows-installers.yml) // no secrets
├── build-windows-installer.ps1 x64 + arm64 // Inno embeds the signed bytes
└── test-windows-installer.ps1 on native x64 and ARM64
sign-windows-installers (release env) // signs and checks both hex-setup-*.exe
publish // stable requires the signatures
- 编译任务从不持有签名凭据。只有两个签名任务进入
release环境,并且它们不运行任何仓库代码。测试构建从不签名。 - 当任何 Azure 值缺失时,签名会被跳过。该次运行随后会发出警告,并在其摘要中写入“not Authenticode-signed”;其余一切照常运行,包括安装程序测试。
- Inno Setup 卸载程序(
hex\uninstall\unins000.exe)在安装时写入,并且未签名。它在本地创建,不带有 Mark of the Web,因此 SmartScreen 不会检查它。 - 自动更新通过 Hex 自身下载
hex.exe,因此 SmartScreen 也不会介入其中。清单的 SHA-256 和 Authenticode 检查为其提供保护。
配置¶
该工作流使用 OpenCode 的命名。在 anomalyco/hex 中,这些是 release 环境机密:
AZURE_CLIENT_ID、AZURE_TENANT_ID、AZURE_SUBSCRIPTION_ID:GitHub OIDC 登录时使用的 Entra 应用或托管身份。AZURE_TRUSTED_SIGNING_ENDPOINT:区域终结点,例如https://eus.codesigning.azure.net/。AZURE_TRUSTED_SIGNING_ACCOUNT_NAME、AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE:签名账户及其 Public Trust 证书配置文件。
该身份需要具有以下条件的联合凭据:颁发者 https://token.actions.githubusercontent.com,主题 repo:anomalyco/hex:environment:release,受众 api://AzureADTokenExchange。它还需要该配置文件上的 Artifact Signing Certificate Profile Signer 角色。Luke(Hona)负责 Anomaly 的 Azure 自助服务设置。
SmartScreen 信誉¶
- Artifact Signing 会为每次签名会话颁发有效期较短的证书(约三天)。如果没有时间戳,签名将随其证书一同过期,因此
verify-authenticode.ps1会拒绝任何缺少时间戳的签名。 - SmartScreen 按发布者身份(而非按证书)建立信誉。每日证书轮换不会重置该信誉。新发布者在早期下载时仍可能看到“Windows protected your PC”提示,直到足够的安装量建立起信誉。之后警告会显示 Anomaly Innovations, Inc.,而不是“Unknown publisher”。
- 在所有地方保持签名后的字节一致:R2 发布、GitHub 镜像和安装程序都提供相同的文件。重新签名会产生没有信誉的新文件。
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 hex19/hex