fix(signing): timestamp all Release executables

This commit is contained in:
Qiu Yuzhou
2026-10-22 16:28:27 +08:00
parent 48aa04b0a2
commit 0101366096
3 changed files with 23 additions and 4 deletions
@@ -10,3 +10,5 @@
// 发布身份改成 ad-hoc 或开发证书——Release 基线在这里是硬约束,后赋值者胜。
#include? "Signing.local.xcconfig"
CODE_SIGN_IDENTITY = Developer ID Application
// 普通 Release build 也必须为主程序和两个原生工具请求公证所需的安全时间戳。
OTHER_CODE_SIGN_FLAGS = $(inherited) --timestamp
+20 -4
View File
@@ -3,8 +3,9 @@
#
# Standalone assertion over a built app bundle; exits nonzero on any failure:
# 1. Nested code signatures pass strict verification (incl. every helper).
# 2. The main app is Developer ID signed with Hardened Runtime and carries
# NO App Sandbox entitlement (and no network.server entitlement).
# 2. The main app and native tools are Developer ID signed with Hardened
# Runtime and secure timestamps. The app carries NO App Sandbox
# entitlement (and no network.server entitlement).
# 3. Every Vendor manifest binary is embedded at Contents/<bundleSubpath>,
# is arm64-only, and is re-signed by our Developer ID with Hardened
# Runtime, a secure timestamp and the pinned code-signing identifier
@@ -72,6 +73,11 @@ check_devid_and_runtime() {
*runtime*) pass "$1: Hardened Runtime" ;;
*) fail "$1: Hardened Runtime (flags: ${flags:-none})" ;;
esac
if [ -n "$(dv_value "$2" Timestamp)" ]; then
pass "$1: secure timestamp present"
else
fail "$1: secure timestamp present"
fi
}
# --- 1. strict nested signature verification -------------------------------
@@ -100,6 +106,18 @@ else
fail "main app TeamIdentifier is $EXPECTED_TEAM_ID (got: ${app_team:-none})"
fi
check_devid_and_runtime "main app" "$app_dv"
for binary in ShadowsocksX-NG2Agent ShadowsocksX-NG2SystemProxyHelper; do
target="$CONTENTS/MacOS/$binary"
if [ ! -f "$target" ]; then
fail "$binary: embedded in Contents/MacOS"
continue
fi
native_dv=$(dv_of "$target")
check_devid_and_runtime "$binary" "$native_dv"
native_team=$(dv_value "$native_dv" TeamIdentifier)
[ "$native_team" = "$app_team" ] ||
fail "$binary: TeamIdentifier matches the app (got: ${native_team:-none})"
done
case "$app_authority" in
"Developer ID Application:"*) ;;
*)
@@ -172,10 +190,8 @@ for manifest in $manifests; do
dv=$(dv_of "$target")
team=$(dv_value "$dv" TeamIdentifier)
actual_identifier=$(dv_value "$dv" Identifier)
timestamp=$(dv_value "$dv" Timestamp)
check_devid_and_runtime "$name" "$dv"
[ -n "$timestamp" ] || fail "$name: secure timestamp present"
[ "$team" = "$app_team" ] ||
fail "$name: TeamIdentifier matches the app (got: ${team:-none})"
[ "$actual_identifier" = "$identifier" ] ||
+1
View File
@@ -34,6 +34,7 @@
- 测试 target(单测与冒烟)身份随同一基线:去宿主化(ADR-0021)后 xctest 包不再注入宿主 app,ad-hoc 也能加载执行(实测),因此测试无需证书。
- 注意 `project.yml` 一旦重新设置这两个键,pbxproj 构建设置会盖掉 xcconfig(`Tests/Architecture/SigningConfigurationTests.swift` 守卫该约束)。
- Release 配置关闭 `CODE_SIGN_INJECT_BASE_ENTITLEMENTS`,保证发布产物 entitlements 只来自项目文件。
- Release 配置通过 `OTHER_CODE_SIGN_FLAGS = $(inherited) --timestamp` 为 Xcode 签名的主程序和两个原生工具请求安全时间戳。打包门槛在上传公证前检查这些时间戳;DMG 的时间戳不能替代包内可执行文件的时间戳。
## 发布门槛