mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-12-05 09:39:21 +08:00
feat(market): 专项复核支持安装范围内附加 Notice 的精确接受 (#330)
为 Class C 专项复核增加 `acceptedScopedNotice`,以便在**不放宽根许可证门禁、也不接受嵌套 LICENSE** 的前提下,审查并接受安装范围内已有 NOTICE 文件的附加变更。这是完成 [#310](https://github.com/desirecore/market/pull/310) 所必需的审核能力,本身不改任何技能 pin。 ## 安全边界 / Security boundaries 默认拒绝仍然成立。只有同时满足以下条件的嵌套 NOTICE 追加才会被接受: - 记录必须包含真实的 `reviewedBy`、`reviewedAt` 和非空 `notes`。 - `fromRef` / `toRef` 必须等于本次审核的旧/新完整 40 位 SHA,过期复核会被拒绝。 - `files` 必须恰好等于实际变更的 NOTICE 路径集合(不能多、不能少、不能重复)。 - 每个文件必须给出旧、新内容的 SHA-256,并与两次快照中的真实字节一致。 - 新文件必须是旧文件的严格前缀保留追加(`new.startswith(old)`)。丢掉原有声明的改写或前置插入即使哈希写对了也会被拒绝。 - 只允许非根路径的 NOTICE(例如 `skills/.../NOTICE`)。根目录 LICENSE/NOTICE/COPYING 仍走既有 `acceptedRootEvidenceSha256`。 - 嵌套 LICENSE/COPYING、删除、重命名、新建 NOTICE、通配符、路径逃逸(`..` / 绝对路径)、符号链接一律拒绝。 - `excludePaths` 仍然不能用来隐藏许可或 Notice 文件。 本变更不执行上游代码,不代表安全认证或运行验收。 ## 验证 / Validation - `uv run --with pytest --with jsonschema --with pyyaml python -m pytest scripts/catalog/test_audit_skill_update.py`:29 passed(含既有根 Notice 用例,以及附加 NOTICE 的正例和哈希/快照不匹配、缺理由、多余或不全路径、通配符、`..`、嵌套 LICENSE、删除、重命名、新建、前置插入、excludePaths、符号链接等反例) - `uv run --with pytest --with jsonschema --with pyyaml python -m pytest scripts/catalog/test_validate_catalog_metadata.py`:62 passed Automated source/license/metadata verification tooling only. No auto-merge of skill snapshot PRs in this change.
This commit is contained in:
1 parent
ff87cdace2
commit
8546cb641a
3 files changed
+341
-4
No files matched your search
@@ -42,6 +42,32 @@
|
||||
"description": "Exact set of new collection membership install paths when discovered children differ from the old entry. Must equal the discovered path set. Newly added members also require acceptedFrontmatterSha256 for that path.",
|
||||
"items": { "type": "string", "minLength": 1 },
|
||||
"uniqueItems": true
|
||||
},
|
||||
"acceptedScopedNotice": {
|
||||
"type": "object",
|
||||
"description": "Exact in-place additive NOTICE changes inside the install scope. LICENSE/COPYING, deletions, renames, new files, rewrites that drop existing bytes, globs, and root-level NOTICE (use acceptedRootEvidenceSha256) cannot be accepted here. fromRef/toRef must equal the audit's old and new snapshot SHAs, and files must be exactly the changed NOTICE paths with matching previous and new SHA-256 hashes.",
|
||||
"additionalProperties": false,
|
||||
"required": ["fromRef", "toRef", "files"],
|
||||
"properties": {
|
||||
"fromRef": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
|
||||
"toRef": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
|
||||
"files": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["path", "previousSha256", "sha256"],
|
||||
"properties": {
|
||||
"path": { "type": "string", "minLength": 1 },
|
||||
"previousSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
||||
"sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"if": { "required": ["acceptedScopedNotice"] },
|
||||
"then": { "required": ["reviewedBy", "reviewedAt", "notes"] }
|
||||
}
|
||||
Reference in new issue
Block a user