Implement machine fingerprint hashing (T-501)

This commit is contained in:
ila
2026-07-20 00:19:13 +08:00
parent 94ea334d1c
commit 8d81276fd9
16 changed files with 465 additions and 9 deletions
+5 -3
View File
@@ -3,12 +3,12 @@ id: T-501
title: 机器指纹 machine_hash
phase: 5
deps: [T-001]
status: TODO
status: DONE
created: 2026-07-19
issue: null
context_ref: null
context_ref: 94ea334487d7180b4af0fb59c129ff678d2c4ad0
claim_branch: null
work_branch: null
work_branch: agent/codex/T-501
write_paths:
- docs/tasks/T-501.md
- core/licensing/
@@ -55,3 +55,5 @@ MVP 许可证必须在离线验签前可靠地比较 `machine_hash`,但仓库
## 执行记录
- 2026-07-19:正式落成。冻结 machine_hash v1 的两个必需来源、严格规范化和带域分隔的 SHA-256 输入;拒绝单来源/加权回退,避免后续许可证签发端与双客户端生成不一致的摘要。确认两套现有 `x/sys/windows` 版本均提供 Win7 可用的 `GetWindowsDirectory` 和 `GetVolumeInformation`。
- 2026-07-19:领取任务,基于 `94ea334487d7180b4af0fb59c129ff678d2c4ad0` 在 `agent/codex/T-501` 执行;先重跑基线,再实现纯 core 算法和双端受限采集边界。
- 2026-07-19:完成。新增 Go 1.20 兼容的 `core/licensing.DeriveMachineHash`,以严格 ASCII GUID 规范化、固定域分隔和卷序列号生成小写 SHA-256;无效输入只返回无敏感值 sentinel。双端 `platform/windows.MachineHash` 短暂读取注册表和 Windows 目录所在卷,所有采集/规范化失败均折叠为不泄漏原始值的错误;非 Windows stub 保持 `ErrUnsupported`。局部 core/双端平台测试、完整 core/双端 app 测试和 Windows amd64 构建、`./scripts/verify_phase0.ps1`、上下文与治理校验均通过。