mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-12-07 04:39:25 +08:00
fix(catalog): 修正上游更新诊断中不影响安装内容的误报 (#455)
修正上游更新审核诊断中 4 处**不影响安装内容**的误报。每处只缩小到真正影响安装的范围,或者让诊断层认可已有的专项复核记录,不新增笼统豁免,也不提高任何预算。 ## 修改内容 | 类型 | 模块或功能 | 本次修改 | | --- | --- | --- | | 修复 | 诊断文件树(R1) | 单路径安装(有 `source.path`、没有 `children`)只列安装子树、根目录一层文件、声明的许可/NOTICE 证据路径和 `.claude-plugin`/`.codex-plugin` 清单;整库安装和合集仍列完整仓库,2 万文件上限不变 | | 修复 | `frontmatter-parse`(R2) | 旧 pin 就已无法解析、且不在任何登记/发现成员范围内的 SKILL.md 降为 `info`;新增的或成员内的仍然 `blocked`;证据中加 `insideMemberScope` | | 修复 | `authorization-config-network-review`(R3) | 诊断层认可 `acceptedBehavioralSecurityReview`:绑定当前旧/新 pin 且 `reviewedPaths` 覆盖全部敏感路径时降为 `info`;缺路径时列出 `unreviewedPaths`,pin 不对时给出 `behavioralReviewError`,两种情况都保持 `manual_review` | | 修复 | `protected_audit_path`(R5) | 图片扩展名(png/jpg/jpeg/webp/svg/gif/ico/bmp/avif)不再当作许可证据,`license.svg` 这类图标可以放进 `excludePaths` 目录;LICENSE/NOTICE/COPYING 文本和依赖清单仍受保护 | | 新增 | 测试 | 新增 10 个单测,覆盖每条规则的放行和仍然阻断两种情况 | | 更新 | 文档 | `docs/verified-update-automation.md` 新增 "Diagnostic scope boundaries" 小节 | ## 修改前后 | 场景 | 修改前 | 修复后 | | --- | --- | --- | | openclaw 系列(notion / nano-pdf / apple-reminders,安装路径各 1 个目录,仓库约 6.8 万文件) | 永远 `independent-static-diagnostics: not_checked`(`diagnostic tree exceeds budget`),这项无法修复 | 诊断能跑完;真实快照下剩下的阻断是 `installed-project-notice`(技能目录里没有 LICENSE,需要客户端附加通知的回读证据) | | larksuite-cli(上游 `scripts/skill-format-check/tests/bad-skill-*` 是故意写坏的测试夹具) | `frontmatter-parse: blocked` ×2,任何专项复核都清不掉 | `info`;真实快照下剩下的是 25 个子技能的 `installed-project-notice` | | last30days(`chrome_cookies.py`、`cookie_extract.py`、`env.py`、`http.py`、`permission_preflight.py` 有变化) | 就算有绑定精确 pin 的行为复核,仍然 `manual_review` | 复核覆盖全部 5 个路径时为 `info`;没有复核时仍是 `manual_review`(已用真实快照验证两种情况) | | ppt-master(`tabler-outline/license.svg`、`license-off.svg` 图标) | `excludePaths` 不能写整个 icons 目录,只能拼 4 条 glob 绕开(见 #453) | 可以直接写 `skills/ppt-master/templates/icons`(真实快照模拟通过) | **这次没改的**:根 `NOTICE` 的交付规则(`installed-notice-delivery`)。我核对了已核验客户端实现 desirecore#6429(`85fba4ab`)的 `market-source.ts`,它只附加 `governance.license.evidencePath` 这一个文件,不会附加单独的根 NOTICE。所以用"客户端附加"来清这一项会与事实不符。blog-repurpose / blog-chart / impeccable / rea-video 要么等客户端支持附加 NOTICE,要么等上游把 NOTICE 放进技能目录。 ## 影响范围 | 文件 | 行号 | 改动 | | --- | --- | --- | | `scripts/catalog/update_diagnostics.py` | 38-39 | 引入 `accept_behavioral_security_review` | | `scripts/catalog/update_diagnostics.py` | 49-73 | R1:单路径安装的有界文件列表 | | `scripts/catalog/update_diagnostics.py` | 247-259 | R2:成员范围外的旧畸形 SKILL.md | | `scripts/catalog/update_diagnostics.py` | 348-368 | R3:行为复核覆盖判定与证据字段 | | `scripts/catalog/audit_skill_update.py` | 164-172 | R5:图片扩展名不受许可保护 | | `scripts/catalog/test_update_diagnostics.py`(测试) | 523-615 | R1/R2/R3 共 9 个测试 | | `scripts/catalog/test_audit_skill_update.py`(测试) | 209-224 | R5 测试(含 excludePaths 整目录审核通过) | | `docs/verified-update-automation.md` | 177-209 | 规则说明 | ## 验证 | 检查项或场景 | 预期结果 | 实际结果 | 证据 | | --- | --- | --- | --- | | `pytest scripts/catalog/test_update_diagnostics.py` | 全部通过 | 52 passed(新增 9) | commit `a9937c9` | | `test_audit_skill_update.py` / `test_validate_catalog_metadata.py` / `test_collection_generator.py` / `test_check_upstream_health.py` / `test_propose_upstream_updates.py` / `test_review_workflow.py` | 全部通过 | 全部 OK / exit 0 | 本地 | | `pytest scripts/catalog/test_tracked_updates.py` | 全部通过 | 64 passed | 本地 | | 真实快照:openclaw `6ddf5a61→bd5b024b`、larksuite-cli `c5fbf1a5→71f8b946`、last30days `7c2e1c2b→f9dadcaf`、ppt-master `63a03673→bb48b2b1` | 误报消失,真实门槛仍在 | 如"修改前后"表所述 | 本地审核器 | | `validate_catalog_metadata.py --require-complete` / `validate-i18n.py` | 0 error | 0 error,105 warning(main 原有) | 本地 | | CI | 全部通过 | 等待中 | 本 PR checks | 这是审核规则改动,需要维护者复核。请勿自动合并。 Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
28ac761ff9
commit
8e016a484f
5 files changed
+203
-11
No files matched your search
@@ -174,6 +174,39 @@ now encoded in `schemas/special-review.v1.schema.json` and
|
|||||||
bound to the exact `fromRef`→`toRef` pair and `reviewedPaths` in `special-review.v1.json`.
|
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.
|
This remains a read-only review boundary, not a security certification or runtime acceptance.
|
||||||
|
|
||||||
|
### Diagnostic scope boundaries (false-positive fixes, no new exemptions)
|
||||||
|
|
||||||
|
`scripts/catalog/update_diagnostics.py` keeps every fail-closed gate, but no longer
|
||||||
|
blocks on facts that cannot affect the installed payload:
|
||||||
|
|
||||||
|
1. **Single-path installs list only what they read.** When an entry has a
|
||||||
|
`source.path` and no `children`, diagnostics list the selected subtree, root-level
|
||||||
|
files, declared license/notice evidence paths and `.claude-plugin`/`.codex-plugin`
|
||||||
|
manifests instead of the whole repository. A monorepo with more than 20,000
|
||||||
|
unrelated files (for example `openclaw/openclaw`) therefore reaches its real gates
|
||||||
|
instead of stopping at `independent-static-diagnostics: not_checked`. Whole-tree
|
||||||
|
and collection installs still list the complete tree.
|
||||||
|
2. **Historic malformed fixtures outside every member scope are informational.**
|
||||||
|
`frontmatter-parse` stays `blocked` for a newly added or in-member unparseable
|
||||||
|
`SKILL.md`. Only a file that was already unparseable at the old pin and lies
|
||||||
|
outside every declared/discovered member scope (such as an upstream test fixture
|
||||||
|
that is malformed on purpose) is reported as `info`, with `insideMemberScope: false`.
|
||||||
|
3. **`acceptedBehavioralSecurityReview` is honored by diagnostics.** A valid review
|
||||||
|
bound to the exact `fromRef`→`toRef` whose `reviewedPaths` cover every changed
|
||||||
|
authorization/credential/configuration/network path turns
|
||||||
|
`authorization-config-network-review` into `info`. Missing paths are listed in
|
||||||
|
`unreviewedPaths` and keep the row `manual_review`; an invalid or other-pin review
|
||||||
|
is reported in `behavioralReviewError`.
|
||||||
|
4. **Images named after a license are not license evidence.** `protected_audit_path`
|
||||||
|
ignores image extensions (`.png`, `.jpg`, `.jpeg`, `.webp`, `.svg`, `.gif`, `.ico`,
|
||||||
|
`.bmp`, `.avif`), so an icon such as `license.svg` can sit inside an `excludePaths`
|
||||||
|
directory. `LICENSE*`/`NOTICE*`/`COPYING*` text files and dependency manifests stay
|
||||||
|
protected.
|
||||||
|
|
||||||
|
Root `NOTICE` delivery is unchanged: the verified client implementations attach only the
|
||||||
|
catalog license evidence file, so a client-attach review cannot clear
|
||||||
|
`installed-notice-delivery` for a separate root `NOTICE`.
|
||||||
|
|
||||||
### Audited carry-forward rules (reducing repetitive Drafts without skipping checks)
|
### Audited carry-forward rules (reducing repetitive Drafts without skipping checks)
|
||||||
|
|
||||||
To prevent routine updates from repeatedly falling back to Draft when the underlying
|
To prevent routine updates from repeatedly falling back to Draft when the underlying
|
||||||
|
|||||||
@@ -161,8 +161,15 @@ def path_matches(name: str, patterns: list[str] | tuple[str, ...] | None) -> boo
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
IMAGE_EXTENSIONS = STATIC_IMAGE_EXTENSIONS | {'.svg', '.gif', '.ico', '.bmp', '.avif'}
|
||||||
|
|
||||||
|
|
||||||
def protected_audit_path(path: str) -> bool:
|
def protected_audit_path(path: str) -> bool:
|
||||||
name = PurePosixPath(path).name.upper()
|
pure = PurePosixPath(path)
|
||||||
|
# Icon or image assets named after a license (license.svg) are not license text.
|
||||||
|
if pure.suffix.lower() in IMAGE_EXTENSIONS:
|
||||||
|
return False
|
||||||
|
name = pure.name.upper()
|
||||||
return name.startswith(('LICENSE', 'NOTICE', 'COPYING')) or dependency_file(path)
|
return name.startswith(('LICENSE', 'NOTICE', 'COPYING')) or dependency_file(path)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -206,6 +206,22 @@ class AuditTests(unittest.TestCase):
|
|||||||
with self.assertRaisesRegex(AuditBlocked, '排除列表'):
|
with self.assertRaisesRegex(AuditBlocked, '排除列表'):
|
||||||
audit_snapshots(self.repo, self.entry, self.metadata, {'ref': self.old, 'head': new}, '2026-10-31T01:02:03Z', special_review=review)
|
audit_snapshots(self.repo, self.entry, self.metadata, {'ref': self.old, 'head': new}, '2026-10-31T01:02:03Z', special_review=review)
|
||||||
|
|
||||||
|
def test_license_named_image_is_not_protected_evidence(self):
|
||||||
|
from audit_skill_update import protected_audit_path
|
||||||
|
self.assertFalse(protected_audit_path('skills/sample/icons/license.svg'))
|
||||||
|
self.assertFalse(protected_audit_path('skills/sample/icons/License-Off.PNG'))
|
||||||
|
self.assertTrue(protected_audit_path('skills/sample/LICENSE'))
|
||||||
|
self.assertTrue(protected_audit_path('skills/sample/LICENSE.md'))
|
||||||
|
self.assertTrue(protected_audit_path('NOTICE.txt'))
|
||||||
|
self.assertTrue(protected_audit_path('skills/sample/package.json'))
|
||||||
|
self.write('skills/sample/icons/license.svg', '<svg/>')
|
||||||
|
self.write('skills/sample/icons/star.svg', '<svg/>')
|
||||||
|
self._rebind_old(self.commit())
|
||||||
|
self.write('skills/sample/scripts/tool.py', 'print("new fixture")\n')
|
||||||
|
new = self.commit()
|
||||||
|
review = {'schemaVersion': 1, 'excludePaths': ['skills/sample/icons']}
|
||||||
|
audit_snapshots(self.repo, self.entry, self.metadata, {'ref': self.old, 'head': new}, '2026-10-31T01:02:03Z', special_review=review)
|
||||||
|
|
||||||
def test_budget_exempt_allows_known_oversize_file(self):
|
def test_budget_exempt_allows_known_oversize_file(self):
|
||||||
big = 'skills/sample/data/index.json'
|
big = 'skills/sample/data/index.json'
|
||||||
self.write(big, 'x' * (1024 * 1024 + 50))
|
self.write(big, 'x' * (1024 * 1024 + 50))
|
||||||
|
|||||||
@@ -520,3 +520,96 @@ def test_stale_short_desc_description_locale_review_does_not_pass(case):
|
|||||||
with pytest.raises(AuditBlocked):
|
with pytest.raises(AuditBlocked):
|
||||||
audit_snapshots(case.repo, case.entry, case.metadata, {'ref': case.old, 'head': new},
|
audit_snapshots(case.repo, case.entry, case.metadata, {'ref': case.old, 'head': new},
|
||||||
'2026-10-31T01:02:03Z', special_review=review)
|
'2026-10-31T01:02:03Z', special_review=review)
|
||||||
|
|
||||||
|
|
||||||
|
def test_single_path_install_ignores_unrelated_monorepo_files(case):
|
||||||
|
# Many files outside the selected path must not exhaust the diagnostic budget.
|
||||||
|
unrelated = case.repo/'packages/huge'
|
||||||
|
unrelated.mkdir(parents=True)
|
||||||
|
for index in range(20001):
|
||||||
|
(unrelated/f'f{index}.txt').write_text('')
|
||||||
|
baseline(case)
|
||||||
|
case.write('skills/sample/scripts/tool.py','new')
|
||||||
|
rows=findings(case)
|
||||||
|
assert not any(r['gate']=='independent-static-diagnostics' for r in rows)
|
||||||
|
delta=next(r for r in rows if r['gate']=='installed-content-delta')
|
||||||
|
assert delta['evidence']['changedPaths']==['skills/sample/scripts/tool.py']
|
||||||
|
|
||||||
|
|
||||||
|
def test_single_path_install_still_reads_root_and_plugin_evidence(case):
|
||||||
|
case.write('NOTICE','Possibly applicable root notice')
|
||||||
|
baseline(case)
|
||||||
|
case.write('skills/sample/scripts/tool.py','new')
|
||||||
|
row=next(r for r in findings(case) if r['gate']=='installed-notice-delivery')
|
||||||
|
assert row['state']=='manual_review'
|
||||||
|
|
||||||
|
|
||||||
|
def _malformed_fixture(case, marker):
|
||||||
|
case.entry['children']=[{'id':'sample','path':'skills/sample'}]
|
||||||
|
case.write(marker,'---\nname: broken\ndescription: Invalid: YAML\n---\nBody\n')
|
||||||
|
|
||||||
|
|
||||||
|
def test_preexisting_malformed_fixture_outside_members_is_info(case):
|
||||||
|
marker='tools/format-check/tests/bad-skill/SKILL.md'
|
||||||
|
_malformed_fixture(case, marker)
|
||||||
|
baseline(case)
|
||||||
|
case.write('skills/sample/scripts/tool.py','new')
|
||||||
|
row=next(r for r in findings(case) if r['gate']=='frontmatter-parse')
|
||||||
|
assert row['state']=='info' and row['origin']=='pre_existing'
|
||||||
|
assert row['evidence']['insideMemberScope'] is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_new_malformed_skill_outside_members_still_blocks(case):
|
||||||
|
case.entry['children']=[{'id':'sample','path':'skills/sample'}]
|
||||||
|
case.write('tools/format-check/tests/bad-skill/SKILL.md','---\nname: broken\ndescription: Invalid: YAML\n---\nBody\n')
|
||||||
|
row=next(r for r in findings(case) if r['gate']=='frontmatter-parse')
|
||||||
|
assert row['state']=='blocked' and row['origin']=='introduced'
|
||||||
|
|
||||||
|
|
||||||
|
def test_preexisting_malformed_skill_inside_member_still_blocks(case):
|
||||||
|
marker='skills/sample/nested/SKILL.md'
|
||||||
|
_malformed_fixture(case, marker)
|
||||||
|
baseline(case)
|
||||||
|
case.write('skills/sample/scripts/tool.py','new')
|
||||||
|
row=next(r for r in findings(case) if r['gate']=='frontmatter-parse')
|
||||||
|
assert row['state']=='blocked'
|
||||||
|
assert row['evidence']['insideMemberScope'] is True
|
||||||
|
|
||||||
|
|
||||||
|
def _behavior_review(old, new, paths):
|
||||||
|
return {'schemaVersion': 1, 'reviewedBy': 'mashagua', 'reviewedAt': '2026-12-05',
|
||||||
|
'notes': 'Read-only behavioral review of the exact delta.',
|
||||||
|
'acceptedBehavioralSecurityReview': {
|
||||||
|
'fromRef': old, 'toRef': new,
|
||||||
|
'reviewDoc': 'docs/reviews/sample-behavior.md', 'reviewedPaths': paths}}
|
||||||
|
|
||||||
|
|
||||||
|
def test_bound_behavior_review_covering_all_sensitive_paths_is_info(case):
|
||||||
|
case.write('skills/sample/scripts/cookie_extract.py','implementation')
|
||||||
|
new=case.commit()
|
||||||
|
review=_behavior_review(case.old, new, ['skills/sample/scripts/cookie_extract.py'])
|
||||||
|
rows=inspect_snapshots(case.repo,case.entry,case.metadata,{'ref':case.old,'head':new},review)
|
||||||
|
row=next(r for r in rows if r['gate']=='authorization-config-network-review')
|
||||||
|
assert row['state']=='info'
|
||||||
|
assert row['evidence']['reviewDoc']=='docs/reviews/sample-behavior.md'
|
||||||
|
|
||||||
|
|
||||||
|
def test_behavior_review_missing_a_sensitive_path_stays_manual(case):
|
||||||
|
case.write('skills/sample/scripts/cookie_extract.py','implementation')
|
||||||
|
case.write('skills/sample/scripts/auth_safety.py','implementation')
|
||||||
|
new=case.commit()
|
||||||
|
review=_behavior_review(case.old, new, ['skills/sample/scripts/cookie_extract.py'])
|
||||||
|
rows=inspect_snapshots(case.repo,case.entry,case.metadata,{'ref':case.old,'head':new},review)
|
||||||
|
row=next(r for r in rows if r['gate']=='authorization-config-network-review')
|
||||||
|
assert row['state']=='manual_review'
|
||||||
|
assert row['evidence']['unreviewedPaths']==['skills/sample/scripts/auth_safety.py']
|
||||||
|
|
||||||
|
|
||||||
|
def test_behavior_review_for_another_pin_stays_manual(case):
|
||||||
|
case.write('skills/sample/scripts/cookie_extract.py','implementation')
|
||||||
|
new=case.commit()
|
||||||
|
review=_behavior_review(case.old, case.old, ['skills/sample/scripts/cookie_extract.py'])
|
||||||
|
rows=inspect_snapshots(case.repo,case.entry,case.metadata,{'ref':case.old,'head':new},review)
|
||||||
|
row=next(r for r in rows if r['gate']=='authorization-config-network-review')
|
||||||
|
assert row['state']=='manual_review'
|
||||||
|
assert '不可跨版本继承' in row['evidence']['behavioralReviewError']
|
||||||
@@ -35,7 +35,8 @@ def inspect_snapshots(repo, entry, metadata, result, special_review=None):
|
|||||||
from audit_skill_update import (
|
from audit_skill_update import (
|
||||||
git, blob, safe_path, GENERATOR, MAX_FILE_BYTES, MAX_FILES,
|
git, blob, safe_path, GENERATOR, MAX_FILE_BYTES, MAX_FILES,
|
||||||
accept_client_attached_notices, accept_data_only_license_exception,
|
accept_client_attached_notices, accept_data_only_license_exception,
|
||||||
accept_description_and_locales, _has_locale_copy, AuditBlocked,
|
accept_description_and_locales, accept_behavioral_security_review,
|
||||||
|
_has_locale_copy, AuditBlocked,
|
||||||
)
|
)
|
||||||
old, new = result['ref'], result['head']
|
old, new = result['ref'], result['head']
|
||||||
review = special_review or {}
|
review = special_review or {}
|
||||||
@@ -45,13 +46,31 @@ def inspect_snapshots(repo, entry, metadata, result, special_review=None):
|
|||||||
gate=gate, state=state, origin=origin, reason=reason,
|
gate=gate, state=state, origin=origin, reason=reason,
|
||||||
repair=repair, evidence=evidence or {},
|
repair=repair, evidence=evidence or {},
|
||||||
sourceUrl=entry['source']['repoUrl'].removesuffix('.git') + '/compare/' + old + '...' + new))
|
sourceUrl=entry['source']['repoUrl'].removesuffix('.git') + '/compare/' + old + '...' + new))
|
||||||
|
# A single-path install only reads its own subtree, root-level files and a
|
||||||
|
# few named evidence paths; listing an unrelated monorepo would exhaust the
|
||||||
|
# budget without adding evidence. Whole-tree and collection installs still
|
||||||
|
# list the complete tree because their scopes or discovery span it.
|
||||||
|
walk_scope = '' if entry.get('children') else safe_path(entry['source'].get('path', ''))
|
||||||
|
walk_gov = metadata.get('governance', {})
|
||||||
|
walk_extras = sorted({safe_path(p) for p in (
|
||||||
|
(walk_gov.get('license') or {}).get('evidencePath'),
|
||||||
|
walk_gov.get('compliance', {}).get('licenseEvidencePath'),
|
||||||
|
walk_gov.get('compliance', {}).get('noticePath'),
|
||||||
|
'.claude-plugin/plugin.json', '.codex-plugin/plugin.json') if p})
|
||||||
def files(ref):
|
def files(ref):
|
||||||
found = {}
|
found = {}
|
||||||
for record in git(repo, 'ls-tree', '-rz', ref).split(b'\0'):
|
def collect(*args, skip_trees=False):
|
||||||
if record:
|
for record in git(repo, 'ls-tree', '-z', *args).split(b'\0'):
|
||||||
meta, path = record.split(b'\t', 1)
|
if record:
|
||||||
mode, kind, oid = meta.decode().split()
|
meta, path = record.split(b'\t', 1)
|
||||||
found[path.decode()] = (mode, kind, oid)
|
mode, kind, oid = meta.decode().split()
|
||||||
|
if not (skip_trees and kind == 'tree'):
|
||||||
|
found[path.decode()] = (mode, kind, oid)
|
||||||
|
if walk_scope:
|
||||||
|
collect(ref, skip_trees=True)
|
||||||
|
collect('-r', ref, '--', walk_scope, *walk_extras)
|
||||||
|
else:
|
||||||
|
collect('-r', ref)
|
||||||
if len(found) > 20000:
|
if len(found) > 20000:
|
||||||
raise ValueError('独立诊断仓库文件数超预算 / diagnostic tree exceeds budget')
|
raise ValueError('独立诊断仓库文件数超预算 / diagnostic tree exceeds budget')
|
||||||
return found
|
return found
|
||||||
@@ -225,11 +244,19 @@ def inspect_snapshots(repo, entry, metadata, result, special_review=None):
|
|||||||
add(path, 'collection-members', 'info' if accepted_members else 'blocked', 'pre_existing' if marker in markers[old] else 'introduced',
|
add(path, 'collection-members', 'info' if accepted_members else 'blocked', 'pre_existing' if marker in markers[old] else 'introduced',
|
||||||
'登记与解析集合不一致;文件原已存在。 / Declared/discovered mismatch; file already existed.' if marker in markers[old] else '登记与解析集合不一致;本次新增物理文件。 / Declared/discovered mismatch; physical file is newly added.',
|
'登记与解析集合不一致;文件原已存在。 / Declared/discovered mismatch; file already existed.' if marker in markers[old] else '登记与解析集合不一致;本次新增物理文件。 / Declared/discovered mismatch; physical file is newly added.',
|
||||||
'逐项审核后同步 children 及两种语言,不把缺项自动准入。 / Review each item and synchronize children and both locales; never auto-admit missing members.')
|
'逐项审核后同步 children 及两种语言,不把缺项自动准入。 / Review each item and synchronize children and both locales; never auto-admit missing members.')
|
||||||
|
member_scopes = discovered | declared
|
||||||
for path in sorted(markers[new]):
|
for path in sorted(markers[new]):
|
||||||
if fm_at(new, path) is None:
|
if fm_at(new, path) is None:
|
||||||
add(path, 'frontmatter-parse', 'blocked', 'pre_existing' if fm_at(old, path) is None and path in markers[old] else 'introduced',
|
pre_existing = fm_at(old, path) is None and path in markers[old]
|
||||||
|
# A historically unparseable SKILL.md outside every member scope
|
||||||
|
# (for example a deliberately malformed test fixture) is never
|
||||||
|
# installed and cannot hide a member; a new or in-scope one can.
|
||||||
|
outside = not any(not scope or path.startswith(scope + '/') for scope in member_scopes)
|
||||||
|
add(path, 'frontmatter-parse', 'info' if pre_existing and outside else 'blocked',
|
||||||
|
'pre_existing' if pre_existing else 'introduced',
|
||||||
'SKILL frontmatter 无法可靠解析。 / SKILL frontmatter cannot be parsed reliably.',
|
'SKILL frontmatter 无法可靠解析。 / SKILL frontmatter cannot be parsed reliably.',
|
||||||
'修正 YAML 后重新发现;这不证明技能是新增加的。 / Fix YAML and rediscover; this does not prove a new skill was added.')
|
'修正 YAML 后重新发现;这不证明技能是新增加的。 / Fix YAML and rediscover; this does not prove a new skill was added.',
|
||||||
|
{'insideMemberScope': not outside})
|
||||||
# Descriptions are semantic, not automatic translations. Unchanged historical
|
# Descriptions are semantic, not automatic translations. Unchanged historical
|
||||||
# English fallbacks are visible but not newly invented failures.
|
# English fallbacks are visible but not newly invented failures.
|
||||||
for scope in scopes:
|
for scope in scopes:
|
||||||
@@ -318,11 +345,27 @@ def inspect_snapshots(repo, entry, metadata, result, special_review=None):
|
|||||||
'physicalRemoved':sorted(old_installed.keys()-new_installed.keys()),
|
'physicalRemoved':sorted(old_installed.keys()-new_installed.keys()),
|
||||||
'modeChanges':[p for p in changed_paths if p in old_installed and p in new_installed and old_installed[p][0]!=new_installed[p][0]],
|
'modeChanges':[p for p in changed_paths if p in old_installed and p in new_installed and old_installed[p][0]!=new_installed[p][0]],
|
||||||
'comparisonComplete':True})
|
'comparisonComplete':True})
|
||||||
if sensitive:
|
behavior_reviewed = set()
|
||||||
|
behavior_error = None
|
||||||
|
if sensitive and review.get('acceptedBehavioralSecurityReview'):
|
||||||
|
try:
|
||||||
|
if accept_behavioral_security_review(review, old, new):
|
||||||
|
behavior_reviewed = set(review['acceptedBehavioralSecurityReview']['reviewedPaths'])
|
||||||
|
except AuditBlocked as error:
|
||||||
|
behavior_error = str(error)
|
||||||
|
if sensitive and set(sensitive) <= behavior_reviewed:
|
||||||
|
add('.', 'authorization-config-network-review', 'info', 'changed',
|
||||||
|
'授权/凭据/配置/网络相关命名的实现文件发生变化;已由绑定当前旧/新 pin 的只读行为专项复核逐项覆盖。不是安全认证。 / Authorization, credential, configuration or networking paths changed and are each covered by a read-only behavioral review bound to these exact pins. Not a security certification.',
|
||||||
|
'该复核不跨 pin 继承;后续 pin 的同类变化需重新复核。 / The review does not carry to later pins.',
|
||||||
|
{'changedPaths': sensitive,
|
||||||
|
'reviewDoc': review['acceptedBehavioralSecurityReview'].get('reviewDoc')})
|
||||||
|
elif sensitive:
|
||||||
add('.', 'authorization-config-network-review', 'manual_review', 'changed',
|
add('.', 'authorization-config-network-review', 'manual_review', 'changed',
|
||||||
'授权/凭据/配置/网络相关命名的实现文件发生变化;依赖哈希或普通元数据校验不能确认行为边界。这是保守人工复核提示,不是已证实漏洞。 / Implementation paths related by name to authorization, credentials, configuration or networking changed. Dependency hashes or metadata checks cannot establish behavioral bounds. This is a conservative review requirement, not a confirmed vulnerability.',
|
'授权/凭据/配置/网络相关命名的实现文件发生变化;依赖哈希或普通元数据校验不能确认行为边界。这是保守人工复核提示,不是已证实漏洞。 / Implementation paths related by name to authorization, credentials, configuration or networking changed. Dependency hashes or metadata checks cannot establish behavioral bounds. This is a conservative review requirement, not a confirmed vulnerability.',
|
||||||
'逐项检查凭据来源/保存、用户同意、网络端点与授权降级;另行记录真实最终 SHA 行为审核,不以依赖专项说明代替。 / Review credential access/storage, user consent, endpoints and authorization fallback; record genuine final-SHA behavioral review, not a dependency-only exception.',
|
'逐项检查凭据来源/保存、用户同意、网络端点与授权降级;另行记录真实最终 SHA 行为审核,不以依赖专项说明代替。 / Review credential access/storage, user consent, endpoints and authorization fallback; record genuine final-SHA behavioral review, not a dependency-only exception.',
|
||||||
{'changedPaths':sensitive})
|
{'changedPaths':sensitive,
|
||||||
|
'unreviewedPaths':sorted(set(sensitive) - behavior_reviewed),
|
||||||
|
**({'behavioralReviewError': behavior_error} if behavior_error else {})})
|
||||||
# Root tooling is reported separately from installed runtime dependencies.
|
# Root tooling is reported separately from installed runtime dependencies.
|
||||||
old_package, new_package = read(old, 'package.json'), read(new, 'package.json')
|
old_package, new_package = read(old, 'package.json'), read(new, 'package.json')
|
||||||
if old_package != new_package and new_package:
|
if old_package != new_package and new_package:
|
||||||
|
|||||||
Reference in new issue
Block a user