feat(catalog): 增加带完整审核门控的客户端通知与纯数据延续规则 (#400)

## 概述 / Summary

在**保留完整自动化审核门控**的前提下,为两类高频重复产生 Draft 的场景增加「可审计延续(Audited
Carry-Forward)」规则,减少无风险波动导致的重复草稿:

1.
**客户端根通知附带的可审计延续(`acceptedClientAttachedNotices.allowCarryForwardWhenUnchanged:
true`)**
- 适用于已验证客户端自动附带根 `LICENSE` 的条目(如
`last30days`、`addy-agent-skills`、`mattpocock-skills`)。
   - **必须同时满足全部审核门控才会放行**:
1. 必须绑定已发布的正式客户端版本标签 `clientReleaseTag`(如 `v10.0.214`)及已核验的
`clientCommit` / `clientTree`;
2. 新快照的根 `LICENSE` 字节必须与 `noticeSha256` 逐字节一致,且 MIT 声明须完整通过 `mit_grant`;
     3. 安装范围 `scopes` 集合完全未变;
     4. 每个安装范围目录顶层在新快照中**未出现**同名 `LICENSE` / `NOTICE` / `COPYING` 冲突文件;
     5. 依赖清单、frontmatter、文件预算、嵌套许可及合并前人工无扩张审核等所有其他门控全部照常执行。

2. **纯数据更新的许可例外可审计延续(`acceptedDataOnlyLicenseException`)**
- 适用于无独立 `LICENSE` 但每日自动刷新数据文件的条目(如 `follow-builders` 的 4 个 JSON feed
文件)。
   - **必须同时满足全部审核门控才会放行**:
1. 必须显式声明 `evidencePath`、`evidenceSha256` 和精确的
`allowedDataPaths`(禁止通配符,禁止列入
`LICENSE`/`NOTICE`/`COPYING`/依赖清单/`SKILL.md`);
     2. `evidencePath` 在旧/新快照间逐字节一致且匹配 `evidenceSha256`;
3. 旧/新快照安装范围内的**全部变更文件**必须严格落在 `allowedDataPaths`
内,任何脚本、`SKILL.md`、配置或新增文件变化立即阻断;
4. 默认开启 `requireValidJson: true`,要求每个变更数据文件在旧/新快照均能解析为合法 JSON
对象且**顶层字段集合完全一致**。

## 变更 / Changes
- `schemas/special-review.v1.schema.json`:向后兼容地新增
`allowCarryForwardWhenUnchanged` 与 `acceptedDataOnlyLicenseException`
- `scripts/catalog/audit_skill_update.py`:在
`accept_client_attached_notices` 增加带碰撞检测与 `clientReleaseTag`
强制校验的延续逻辑;新增 `accept_data_only_license_exception` 并在 `audit_snapshots`
挂钩
- `scripts/catalog/update_diagnostics.py`:接入
`accept_data_only_license_exception`,核验通过时将
`pin-bound-license-exception` 与安装内 `installed-project-notice` 记为
`info`,任何违规直接记为 `blocked`
- `docs/verified-update-automation.md`:补充两条可审计延续规则及其审核边界说明
- `scripts/catalog/test_audit_skill_update.py`:新增 2 组单测覆盖合法延续、缺
`clientReleaseTag` 拦截、顶层冲突通知拦截、JSON 字段结构变化拦截及越界代码变更拦截

## 验证 / Validation
- `uv run --quiet scripts/catalog/test_audit_skill_update.py`
- `uv run --quiet scripts/catalog/test_update_diagnostics.py`
- `uv run --quiet scripts/catalog/test_validate_catalog_metadata.py`
- `uv run --quiet scripts/catalog/validate_catalog_metadata.py
--require-complete`
- `uv run --quiet scripts/i18n/validate-i18n.py`
- `uv run --quiet scripts/i18n/translate.py --check`
- `git diff --check`
This commit is contained in:
mashagua authored and GitHub committed 2026-11-29 22:02:43 +08:00
1 parent f1505887ee
commit e5f31b4c37
5 files changed
+249 -9

No files matched your search

+26 -1
View File
@@ -83,9 +83,13 @@
"clientTree": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
"clientReleaseTag": {
"type": "string",
"description": "Optional shipped official DesireCore release tag (e.g. v10.0.214) verified to include clientCommit without unverified staging/install drift.",
"description": "Optional shipped official DesireCore release tag (e.g. v10.0.214) verified to include clientCommit without unverified staging/install drift. Required when allowCarryForwardWhenUnchanged is true.",
"pattern": "^v\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$"
},
"allowCarryForwardWhenUnchanged": {
"type": "boolean",
"description": "When true (requires clientReleaseTag), allows the verified client-attached notice proof to carry forward to newer pins ONLY when the root notice bytes at the new pin are byte-identical to noticeSha256, install scopes are unchanged, and no colliding top-level LICENSE/NOTICE/COPYING file exists in any install scope. All other audits still run in full."
},
"observedAt": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$" },
"noticeRootPath": { "type": "string", "minLength": 1 },
"noticeSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
@@ -186,6 +190,23 @@
"items": { "type": "string", "minLength": 1 }
}
}
},
"acceptedDataOnlyLicenseException": {
"type": "object",
"description": "Audited carry-forward of a catalog-specific one-line license exception (e.g. README.md MIT declaration) ONLY for updates whose entire installed-scope diff is restricted to explicit allowedDataPaths. Every non-allowlisted file (including evidencePath, SKILL.md, scripts, manifests) must be byte-identical, and when requireValidJson is true (default) every changed data file must parse as a JSON object with an identical top-level key set.",
"additionalProperties": false,
"required": ["evidencePath", "evidenceSha256", "allowedDataPaths"],
"properties": {
"evidencePath": { "type": "string", "minLength": 1 },
"evidenceSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
"allowedDataPaths": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": { "type": "string", "minLength": 1 }
},
"requireValidJson": { "type": "boolean", "default": true }
}
}
},
"allOf": [
@@ -212,6 +233,10 @@
{
"if": { "required": ["acceptedBehavioralSecurityReview"] },
"then": { "required": ["reviewedBy", "reviewedAt", "notes"] }
},
{
"if": { "required": ["acceptedDataOnlyLicenseException"] },
"then": { "required": ["reviewedBy", "reviewedAt", "notes"] }
}
]
}