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

+25
View File
@@ -160,3 +160,28 @@ now encoded in `schemas/special-review.v1.schema.json` and
A read-only behavioral review document under `docs/reviews/` must be committed and
bound to the exact `fromRef`→`toRef` pair and `reviewedPaths` in `special-review.v1.json`.
This remains a read-only review boundary, not a security certification or runtime acceptance.
### Audited carry-forward rules (reducing repetitive Drafts without skipping checks)
To prevent routine updates from repeatedly falling back to Draft when the underlying
risk surface has not changed, two opt-in carry-forward hooks are supported in
`special-review.v1.json` — **both still run full automated audits on every new commit**:
1. **Client-attached notice carry-forward (`acceptedClientAttachedNotices.allowCarryForwardWhenUnchanged: true`)**:
- Requires a valid shipped `clientReleaseTag` (e.g. `v10.0.214`) in addition to the
verified `clientCommit`/`clientTree`.
- On every new upstream commit, the auditor still verifies: (a) the root notice file
is byte-identical to `noticeSha256` and passes `mit_grant` when MIT; (b) install
scopes match `scopes` exactly; and (c) no install scope introduced a colliding
top-level `LICENSE`/`NOTICE`/`COPYING` file.
- All other audits (dependencies, frontmatter/description, file budget, nested licenses)
and merge-time human no-expansion reviews for substantive code changes remain active.
2. **Data-only license exception carry-forward (`acceptedDataOnlyLicenseException`)**:
- For entries such as `follow-builders` that refresh JSON feed files daily without a
standalone `LICENSE`, allows specifying explicit exact `allowedDataPaths` (no globs,
no `SKILL.md`, no scripts/manifests/licenses).
- On every new upstream commit, the auditor verifies: (a) `evidencePath` is byte-identical
to `evidenceSha256`; (b) **zero** files outside `allowedDataPaths` were added, removed,
or modified; and (c) every changed data file parses as a JSON object with an identical
top-level key set (`requireValidJson: true`, default). Any deviation immediately blocks
for human review.
+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"] }
}
]
}
+75 -1
View File
@@ -252,13 +252,16 @@ def accept_client_attached_notices(review: dict, repo: Path, new: str, install_s
client_commit = accepted.get('clientCommit')
client_tree = accepted.get('clientTree')
client_release_tag = accepted.get('clientReleaseTag')
carry_forward = bool(accepted.get('allowCarryForwardWhenUnchanged', False))
observed_at = accepted.get('observedAt')
notice_path = accepted.get('noticeRootPath')
notice_sha = accepted.get('noticeSha256')
if not isinstance(source_ref, str) or not re.fullmatch(r'[0-9a-f]{40}', source_ref):
raise AuditBlocked('客户端附加通知专项复核未绑定完整上游 pin')
if source_ref != new:
if source_ref != new and not carry_forward:
raise AuditBlocked('客户端附加通知专项复核未绑定当前固定快照')
if carry_forward and not client_release_tag:
raise AuditBlocked('客户端附加通知跨快照延续必须绑定正式发行版标签 clientReleaseTag')
if client_release_tag is not None and not (
isinstance(client_release_tag, str)
and re.fullmatch(r'v\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?', client_release_tag)
@@ -335,9 +338,78 @@ def accept_client_attached_notices(review: dict, repo: Path, new: str, install_s
raise AuditBlocked('客户端附加通知专项复核未证明该子项安装副本携带完整根通知')
if seen != required:
raise AuditBlocked('客户端附加通知专项复核与安装范围不一致或缺少子项安装回读')
if carry_forward:
# Audited carry-forward: ensure no scope introduced a colliding top-level notice file at new.
for scope in sorted(required):
spec = f'{new}:{scope}' if scope else new
for record in git(repo, 'ls-tree', '-z', spec).split(b'\0'):
if not record:
continue
_, raw_name = record.split(b'\t', 1)
entry_name = raw_name.decode()
if is_root_notice_filename(entry_name):
raise AuditBlocked(f'安装范围 {scope or "."} 顶层出现同名许可/通知文件 {entry_name},需重新人工复核')
return seen
def accept_data_only_license_exception(review: dict, repo: Path, old: str, new: str,
old_files: dict, new_files: dict) -> bool:
"""Audit and allow a data-only delta under an explicit one-line license exception.
Every non-allowlisted file in the installed scope (including evidencePath,
SKILL.md, scripts, and dependency 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.
"""
accepted = review.get('acceptedDataOnlyLicenseException')
if not accepted:
return False
if not isinstance(accepted, dict):
raise AuditBlocked('纯数据更新许可例外记录无效')
if not all(isinstance(review.get(key), str) and review[key].strip()
for key in ('reviewedBy', 'reviewedAt', 'notes')):
raise AuditBlocked('纯数据更新许可例外必须包含审核人、日期和理由')
evidence_path = accepted.get('evidencePath')
evidence_sha = accepted.get('evidenceSha256')
allowed_paths = accepted.get('allowedDataPaths')
require_json = accepted.get('requireValidJson', True)
if not isinstance(evidence_path, str) or not evidence_path or safe_path(evidence_path) != evidence_path:
raise AuditBlocked('纯数据更新许可例外的证据路径无效')
if not _sha256_hex(evidence_sha):
raise AuditBlocked('纯数据更新许可例外的证据哈希无效')
if (not isinstance(allowed_paths, list) or not allowed_paths
or any(not isinstance(p, str) or not p or any(s in p for s in '*?[]') or safe_path(p) != p
for p in allowed_paths)
or len(set(allowed_paths)) != len(allowed_paths)):
raise AuditBlocked('纯数据更新许可例外的允许数据路径列表无效')
if not isinstance(require_json, bool):
raise AuditBlocked('纯数据更新许可例外的 requireValidJson 必须为布尔值')
allowed_set = set(allowed_paths)
if evidence_path in allowed_set or any(protected_audit_path(p) or PurePosixPath(p).name.upper() == 'SKILL.MD' for p in allowed_set):
raise AuditBlocked('纯数据更新许可例外不能将许可、依赖或 SKILL.md 列入数据白名单')
old_ev = blob(repo, old, evidence_path)
new_ev = blob(repo, new, evidence_path)
if not new_ev or hashlib.sha256(new_ev).hexdigest() != evidence_sha or old_ev != new_ev:
raise AuditBlocked('纯数据更新许可例外的证据文件有变化或哈希不匹配,需人工重审')
all_keys = set(old_files) | set(new_files)
changed = {p for p in all_keys if old_files.get(p) != new_files.get(p)}
outside = sorted(changed - allowed_set)
if outside:
raise AuditBlocked(f'变更超出纯数据白名单({", ".join(outside[:5])}),需人工重审')
if require_json:
for path in sorted(changed):
if path not in old_files or path not in new_files:
raise AuditBlocked(f'白名单数据文件 {path} 发生新增或删除,需人工重审')
try:
old_obj = json.loads(blob(repo, old, path).decode('utf-8'))
new_obj = json.loads(blob(repo, new, path).decode('utf-8'))
except (UnicodeDecodeError, json.JSONDecodeError) as error:
raise AuditBlocked(f'白名单数据文件 {path} 不是有效 JSON({error}),需人工重审')
if not isinstance(old_obj, dict) or not isinstance(new_obj, dict) or set(old_obj.keys()) != set(new_obj.keys()):
raise AuditBlocked(f'白名单数据文件 {path} 的顶层 JSON 字段结构变化,需人工重审')
return True
def accept_exact_pin_license_exception(review: dict, repo: Path, old: str, new: str) -> bool:
"""Validate an exact-pin human license exception (never inherited across pins)."""
accepted = review.get('acceptedExactPinLicenseException')
@@ -724,6 +796,8 @@ def _audit_snapshots(repo: Path, entry: dict, sidecar: dict, result: dict,
accept_description_and_locales(review, entry, sidecar, repo, old, new, paths)
if review.get('acceptedExactPinLicenseException'):
accept_exact_pin_license_exception(review, repo, old, new)
if review.get('acceptedDataOnlyLicenseException'):
accept_data_only_license_exception(review, repo, old, new, old_files, new_files)
if review.get('acceptedBehavioralSecurityReview'):
accept_behavioral_security_review(review, old, new)
if old_root != new_root:
@@ -1055,5 +1055,91 @@ class AuditTests(unittest.TestCase):
self.repo, self.entry, self.metadata, {'ref': self.old, 'head': new},
'2026-10-31T01:02:03Z', special_review=bad_doc)
def test_client_attached_notices_audited_carry_forward(self):
from jsonschema import Draft7Validator
schema = json.loads((Path(__file__).resolve().parents[2] / 'schemas' / 'special-review.v1.schema.json').read_text())
(self.repo / 'skills/sample/LICENSE').unlink()
self._rebind_old(self.commit())
notice_sha = hashlib.sha256((self.repo / 'LICENSE').read_bytes()).hexdigest()
self.write('skills/sample/scripts/tool.py', 'print("newer commit")\n')
new = self.commit()
review = self._client_attach_review(
self.old, ['skills/sample'], notice_sha,
acceptedClientAttachedNotices={
'clientReleaseTag': 'v10.0.214',
'allowCarryForwardWhenUnchanged': True,
})
Draft7Validator(schema).validate(review)
entry, metadata, _ = audit_snapshots(
self.repo, self.entry, self.metadata, {'ref': self.old, 'head': new},
'2026-10-31T01:02:03Z', special_review=review)
self.assertEqual(entry['source']['ref'], new)
self.assertEqual(metadata['governance']['compliance']['reviewedRef'], new)
missing_tag = self._client_attach_review(
self.old, ['skills/sample'], notice_sha,
acceptedClientAttachedNotices={'allowCarryForwardWhenUnchanged': True})
with self.assertRaisesRegex(AuditBlocked, 'clientReleaseTag'):
audit_snapshots(
self.repo, self.entry, self.metadata, {'ref': self.old, 'head': new},
'2026-10-31T01:02:03Z', special_review=missing_tag)
self.write('skills/sample/NOTICE', 'Upstream added a colliding notice.\n')
colliding = self.commit()
with self.assertRaisesRegex(AuditBlocked, '顶层出现同名许可/通知文件'):
audit_snapshots(
self.repo, self.entry, self.metadata, {'ref': self.old, 'head': colliding},
'2026-10-31T01:02:03Z', special_review=review)
def test_data_only_license_exception_audits_paths_and_json_structure(self):
from jsonschema import Draft7Validator
schema = json.loads((Path(__file__).resolve().parents[2] / 'schemas' / 'special-review.v1.schema.json').read_text())
self.write('SKILL.md', '---\nname: sample\ndescription: Fixture\nversion: 1.0.0\n---\n')
self.write('README.md', '# Sample\nLicense: MIT\n')
self.write('feed.json', '{"items": [1], "stats": {"count": 1}}\n')
(self.repo / 'LICENSE').unlink()
(self.repo / 'skills/sample/LICENSE').unlink()
self.entry['source'].pop('path', None)
self.metadata['provenance']['content'].pop('path', None)
self.metadata['governance']['license']['evidencePath'] = 'README.md'
self.metadata['governance']['compliance']['licenseEvidencePath'] = 'README.md'
self._rebind_old(self.commit())
readme_sha = hashlib.sha256((self.repo / 'README.md').read_bytes()).hexdigest()
self.write('feed.json', '{"items": [1, 2], "stats": {"count": 2}}\n')
new_ok = self.commit()
review = {
'schemaVersion': 1,
'reviewedBy': 'mashagua',
'reviewedAt': '2026-11-29',
'notes': 'Data-only feed refresh exception.',
'acceptedDataOnlyLicenseException': {
'evidencePath': 'README.md',
'evidenceSha256': readme_sha,
'allowedDataPaths': ['feed.json'],
'requireValidJson': True,
},
}
Draft7Validator(schema).validate(review)
entry, _, _ = audit_snapshots(
self.repo, self.entry, self.metadata, {'ref': self.old, 'head': new_ok},
'2026-10-31T01:02:03Z', special_review=review)
self.assertEqual(entry['source']['ref'], new_ok)
self.write('feed.json', '{"items": [1, 2], "stats": {"count": 2}, "extra": true}\n')
bad_keys = self.commit()
with self.assertRaisesRegex(AuditBlocked, '顶层 JSON 字段结构变化'):
audit_snapshots(
self.repo, self.entry, self.metadata, {'ref': self.old, 'head': bad_keys},
'2026-10-31T01:02:03Z', special_review=review)
self.write('feed.json', '{"items": [1, 2], "stats": {"count": 2}}\n')
self.write('skills/sample/scripts/tool.py', 'print("unexpected code change")\n')
bad_code = self.commit()
with self.assertRaisesRegex(AuditBlocked, '变更超出纯数据白名单'):
audit_snapshots(
self.repo, self.entry, self.metadata, {'ref': self.old, 'head': bad_code},
'2026-10-31T01:02:03Z', special_review=review)
if __name__ == '__main__': unittest.main()
+37 -7
View File
@@ -34,7 +34,8 @@ def inspect_snapshots(repo, entry, metadata, result, special_review=None):
# Lazy import avoids a circular module import; helpers only read bounded blobs.
from audit_skill_update import (
git, blob, safe_path, GENERATOR, MAX_FILE_BYTES, MAX_FILES,
accept_client_attached_notices, accept_description_and_locales, _has_locale_copy, AuditBlocked,
accept_client_attached_notices, accept_data_only_license_exception,
accept_description_and_locales, _has_locale_copy, AuditBlocked,
)
old, new = result['ref'], result['head']
review = special_review or {}
@@ -74,13 +75,34 @@ def inspect_snapshots(repo, entry, metadata, result, special_review=None):
evidence_path = safe_path(license_info.get('evidencePath') or gov.get('compliance', {}).get('licenseEvidencePath') or '')
license_value = license_info.get('value')
grants = {ref: read(ref, evidence_path) for ref in (old, new)}
data_only_exception_ok = False
if license_value == 'MIT' and not mit_grant(grants[new]):
add(evidence_path, 'pin-bound-license-exception', 'manual_review',
'pre_existing' if not mit_grant(grants[old]) else 'introduced',
'MIT 声明不是完整版权及许可通知;旧 pin 人工例外不得因字节未变而扩展到新 pin。 / An MIT declaration is not the full notice; an old-pin exception does not authorize a new pin even when bytes match.',
'取得完整主许可通知,或由维护者明确审核并授权精确新 pin;不得由更新器改写 reviewedRef 冒充授权。 / Obtain the complete project notice or explicit human authorization for the exact new pin; never manufacture authorization by rebinding reviewedRef.',
{'declaredLicense': license_value, 'evidencePath': evidence_path,
'oldSha256': hashlib.sha256(grants[old]).hexdigest(), 'newSha256': hashlib.sha256(grants[new]).hexdigest()})
if review.get('acceptedDataOnlyLicenseException'):
def _in_scopes(path):
return any(not s or path == s or path.startswith(s + '/') for s in scopes)
scoped_old = {p: v for p, v in trees[old].items() if _in_scopes(p)}
scoped_new = {p: v for p, v in trees[new].items() if _in_scopes(p)}
try:
data_only_exception_ok = accept_data_only_license_exception(
review, repo, old, new, scoped_old, scoped_new)
add(evidence_path, 'pin-bound-license-exception', 'info', 'unchanged',
'已通过纯数据白名单与 JSON 结构核验,仅允许白名单数据文件变化且许可证据逐字节未变,沿用已审定的目录专用例外。 / Passed audited data-only allowlist and JSON structure check with unchanged license evidence; carrying forward catalog-specific exception.',
'如任何脚本、SKILL.md、依赖、JSON 顶层结构或证据文件变化,将自动阻断并退回人工重审。 / Any change to scripts, SKILL.md, dependencies, JSON top-level keys, or evidence bytes automatically blocks for human review.',
{'declaredLicense': license_value, 'evidencePath': evidence_path,
'evidenceSha256': hashlib.sha256(grants[new]).hexdigest(),
'allowedDataPaths': review['acceptedDataOnlyLicenseException'].get('allowedDataPaths')})
except AuditBlocked as error:
add(evidence_path, 'pin-bound-license-exception', 'blocked', 'introduced',
'纯数据更新许可例外核验未通过,需人工重审。 / Audited data-only license exception check failed; human review required.',
'仅在白名单数据文件按预期更新时放行;其他文件或结构变化须人工审核。 / Only allowlisted data-file updates with unchanged structure may pass; other changes need human review.',
{'detail': str(error), 'declaredLicense': license_value, 'evidencePath': evidence_path})
else:
add(evidence_path, 'pin-bound-license-exception', 'manual_review',
'pre_existing' if not mit_grant(grants[old]) else 'introduced',
'MIT 声明不是完整版权及许可通知;旧 pin 人工例外不得因字节未变而扩展到新 pin。 / An MIT declaration is not the full notice; an old-pin exception does not authorize a new pin even when bytes match.',
'取得完整主许可通知,或由维护者明确审核并授权精确新 pin;不得由更新器改写 reviewedRef 冒充授权。 / Obtain the complete project notice or explicit human authorization for the exact new pin; never manufacture authorization by rebinding reviewedRef.',
{'declaredLicense': license_value, 'evidencePath': evidence_path,
'oldSha256': hashlib.sha256(grants[old]).hexdigest(), 'newSha256': hashlib.sha256(grants[new]).hexdigest()})
attached_scopes = set()
if review.get('acceptedClientAttachedNotices'):
try:
@@ -133,6 +155,14 @@ def inspect_snapshots(repo, entry, metadata, result, special_review=None):
'clientCommit': accepted.get('clientCommit'),
'noticeRootPath': accepted.get('noticeRootPath'),
'proof': 'client attach install-copy readback bound to pin, client commit, and root notice hash'})
elif not new_ok and data_only_exception_ok and (not scope or evidence_path.startswith(scope + '/')):
add(scope, 'installed-project-notice', 'info', 'pre_existing' if not old_ok else 'changed',
'许可证据位于安装范围内,且本次更新已通过纯数据白名单与 JSON 结构核验。 / License evidence remains inside the install scope and this delta passed the audited data-only allowlist and JSON structure check.',
'如超出数据白名单或证据文件变化,将自动阻断并退回人工重审。 / Any delta outside the data allowlist or changing evidence bytes automatically blocks for human review.',
{'declaredLicense': license_value, 'requiredNoticePath': evidence_path,
'requiredNoticeSha256': hashlib.sha256(grants[new]).hexdigest(),
'requiredNoticeInsideScope': True,
'proof': 'audited data-only allowlist + unchanged license evidence inside install scope'})
elif not new_ok:
add(scope, 'installed-project-notice', 'blocked', 'pre_existing' if not old_ok else 'introduced',
'未证明所选安装目录携带主项目完整通知;仓库根证据或 vendor 许可不等于安装交付。 / Complete project notice delivery is unverified in the selected directory; root evidence or a vendor license is not installed delivery.',