Skip to content

👾 Open Computer Use – Open-Source Alternative to Codex Computer Use

test(release): diagnose hosted task signature validation

ifuryst7a86d98cd230
diff --git a/docs/histories/2026-10/20261014-0950-v1.1.0-release.md b/docs/histories/2026-10/20261014-0950-v1.1.0-release.md
index 6c8de0f..cd48f84 100644
--- a/docs/histories/2026-10/20261014-0950-v1.1.0-release.md
+++ b/docs/histories/2026-10/20261014-0950-v1.1.0-release.md
@@ -24,3 +24,5 @@ PR #92 合并后,从 main 发布 v1.1.0。
本地 release-package 全流程完成,三个 tgz、直接下载归档、skill 与校验和均已生成;准备提交与版本 bump 分开,接下来推 main / v1.1.0 并检查 CI 公证、npm 与 GitHub Release。
首次 CI 的 metadata 和 DMG job 成功,npm job 在组件签名阶段找不到临时 keychain 中的 identity,未进入 npm / GitHub 发布。组件签名 helper 现在与原主 App 一样临时加入签名 keychain 并恢复原搜索列表;模拟 CI keychain 的成功 / 失败路径回归通过,不修改本机真实 keychain。修复后更新尚未发布的 v1.1.0 tag 并重跑。
+
+修正搜索列表后 CI 完成组件签名与插件 ABI,随后 kernel verifier 正例被拒绝;本机同一正负例仍通过。新增仅链接到构建诊断程序的逐项 requirement 位图与签名用途输出,定位 CI 分类 / 标志差异;生产插件 verifier 不变。诊断运行不发布 npm 或 GitHub Release,待查明后再更新 tag。
diff --git a/experiments/LockedUse/AuthorizationPlugin/TaskVerifierDiagnostics.swift b/experiments/LockedUse/AuthorizationPlugin/TaskVerifierDiagnostics.swift
new file mode 100644
index 0000000..a9df42d
--- /dev/null
+++ b/experiments/LockedUse/AuthorizationPlugin/TaskVerifierDiagnostics.swift
@@ -0,0 +1,28 @@
+import Foundation
+import Security
+import LightweightCodeRequirements
+
+// Linked only into the build-time diagnostic executable, never the plugin.
+@_cdecl("ocu_diagnose_broker_task")
+public func diagnoseBrokerTask(_ bytes: UnsafeRawPointer?, _ teamBytes: UnsafePointer<CChar>?) -> Int32 {
+ guard #available(macOS 14.4, *), let bytes, let teamBytes else { return -1 }
+ var token = audit_token_t()
+ withUnsafeMutableBytes(of: &token) { $0.copyMemory(from: UnsafeRawBufferPointer(start: bytes, count: 32)) }
+ guard let task = SecTaskCreateWithAuditToken(nil, token) else { return -2 }
+ do {
+ let checks = try [
+ ProcessCodeRequirement.allOf { SigningIdentifier("dev.opencomputeruse.locked-use.broker") },
+ ProcessCodeRequirement.allOf { TeamIdentifier(String(cString: teamBytes)) },
+ ProcessCodeRequirement.allOf { ValidationCategory(.developerID) },
+ ProcessCodeRequirement.allOf { ProcessCodeSigningFlags.isSuperset(of: [.isDynamicallyValid]) },
+ ProcessCodeRequirement.allOf { ProcessCodeSigningFlags.isSuperset(of: [.isSigned]) },
+ ProcessCodeRequirement.allOf { ProcessCodeSigningFlags.isSuperset(of: [.isHardenedRuntimeEnforced]) },
+ ProcessCodeRequirement.allOf { ProcessCodeSigningFlags.isSuperset(of: [.isLibraryValidationRequired]) }
+ ]
+ var failed: Int32 = 0
+ for (index, check) in checks.enumerated() {
+ if try !SecTaskValidateForRequirement(task: task, requirement: check) { failed |= 1 << index }
+ }
+ return failed
+ } catch { return -3 }
+}
diff --git a/experiments/LockedUse/AuthorizationPlugin/TaskVerifierTests.c b/experiments/LockedUse/AuthorizationPlugin/TaskVerifierTests.c
index e9decbe..ea70854 100644
--- a/experiments/LockedUse/AuthorizationPlugin/TaskVerifierTests.c
+++ b/experiments/LockedUse/AuthorizationPlugin/TaskVerifierTests.c
@@ -4,6 +4,7 @@
#include <stdint.h>
#include <string.h>
extern int32_t ocu_verify_broker_task(const void *, const char *);
+extern int32_t ocu_diagnose_broker_task(const void *, const char *);
#ifndef OCU_SIGNING_TEAM
#error "Signing team required"
#endif
@@ -14,6 +15,9 @@ int main(int argc, char **argv) {
assert(task_info(mach_task_self(), TASK_AUDIT_TOKEN, (task_info_t)&token, &count) == KERN_SUCCESS);
int32_t result = ocu_verify_broker_task(&token, OCU_SIGNING_TEAM);
if (result == -1) { puts("Kernel task verifier unavailable; legacy verification remains required."); return 0; }
+ if (result != (strcmp(argv[1], "match") == 0 ? 1 : 0)) {
+ fprintf(stderr, "Task verifier result=%d failedChecks=%d (bits: id=1 team=2 developerID=4 dynamic=8 signed=16 hardened=32 library=64)\n", result, ocu_diagnose_broker_task(&token, OCU_SIGNING_TEAM));
+ }
assert(result == (strcmp(argv[1], "match") == 0 ? 1 : 0));
assert(ocu_verify_broker_task(&token, "AAAAAAAAAA") == 0);
assert(ocu_verify_broker_task(&token, "malformed") == -2);
diff --git a/scripts/build-locked-use-components.sh b/scripts/build-locked-use-components.sh
index 02ea36d..7ebbec6 100755
--- a/scripts/build-locked-use-components.sh
+++ b/scripts/build-locked-use-components.sh
@@ -90,10 +90,19 @@ xcrun clang -std=c11 -Wall -Wextra -Werror -mmacosx-version-min=14.0 -framework
test_output="$(mktemp -d "$output/task-verifier-checks.XXXXXX")"
xcrun clang -Wall -Wextra -Werror -mmacosx-version-min=14.0 "-DOCU_SIGNING_TEAM=\"$team\"" -c \
experiments/LockedUse/AuthorizationPlugin/TaskVerifierTests.c -o "$test_output/task-verifier-tests.o"
-xcrun swiftc -target "$native_arch-apple-macos14.0" "$test_output/task-verifier-tests.o" "$output/plugin-$native_arch/task-verifier.o" \
+xcrun swiftc -parse-as-library -emit-object -target "$native_arch-apple-macos14.0" \
+ -module-name OCUTaskVerifierDiagnostics experiments/LockedUse/AuthorizationPlugin/TaskVerifierDiagnostics.swift \
+ -o "$test_output/task-verifier-diagnostics.o"
+xcrun swiftc -target "$native_arch-apple-macos14.0" "$test_output/task-verifier-diagnostics.o" "$test_output/task-verifier-tests.o" "$output/plugin-$native_arch/task-verifier.o" \
-o "$test_output/task-verifier-tests"
locked_use_sign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.broker \
--sign "$identity" "$test_output/task-verifier-tests"
+authority="$(codesign -dv --verbose=4 "$test_output/task-verifier-tests" 2>&1 | sed -n 's/^Authority=//p' | head -n 1)"
+if [[ "$authority" == 'Developer ID Application:'* ]]; then
+ echo 'Task verifier diagnostic signer: Developer ID Application'
+else
+ echo 'Task verifier diagnostic signer: not Developer ID Application'
+fi
"$test_output/task-verifier-tests" match
rm -f "$test_output/task-verifier-wrong-id"
cp "$test_output/task-verifier-tests" "$test_output/task-verifier-wrong-id"