Files
market/docs/verified-update-automation.md
mashaguaandDevin 8e016a484f 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>
2026-12-06 08:01:01 +08:00

15 KiB

Verified upstream updates

This is update automation, not automatic first admission, runtime acceptance or a security certification. The issue tracker remains enabled and is independent of admission evidence. No credentials, private feeds or user tokens belong here.

Trusted inputs and scope

  • The daily upstream-health job still checks Git pointers. The Git proposer uses exact old/new SHA, the existing delta auditor and the old admitted evidence.
  • config/verified-updates.v1.json adds explicit tracking for non-pointer/local sources. Currently registered: the owner-qualified ClawHub AMap package and the local AI News Radar edition. No unregistered source is guessed.
  • clawhub verifies the registered owner, gets an explicit stable latest version, downloads its version-specific ZIP and verifies the old pinned digest again. Registry MIT-0 metadata is not permission to override package MIT evidence.
  • github-file resolves a configured repository/branch/path to an immutable commit, then retrieves that exact raw file. This is the Web discovery adapter.
  • github-release selects one explicitly configured asset from an actual stable GitHub release, never an inferred version string. Mutable assets whose old bytes no longer match the admitted digest are blocked.
  • Automatic artifact auditing currently supports root-layout packages. A nested install scope needs an explicitly reviewed layout adapter. Arbitrary hosts, symlinks, executable ZIP entries, path traversal, duplicate/case-colliding names, encrypted archives and over-budget artifacts fail closed.
  • A new hash is identification only. Old/new bytes undergo the existing license, notice, dependency, frontmatter and metadata delta audit. Receipts name the actual SHA-256/upstream SHA; temporary Git objects only transport comparisons.

For a new Web source, add a reviewed tracking entry such as:

{"adapter":"github-file","repo":"example/project","branch":"main","path":"SKILL.md"}

A release ZIP uses adapter: github-release, repo, and an exact asset name. The old market pointer/digest/admission must already be valid. These examples do not enable first-time installs or authorize any unreviewed source.

Local editions

The local-git map records the exact upstream SHA, upstream path/hash, installed path/hash/mode, and every market-only wrapper. No newly discovered files are silently imported. Missing/moved files, added upstream license/notice obligations, changed permissions and mapping drift block advancement. Unmodified imported files can be replaced; a file changed by both upstream and market is a conflict, never a blind overwrite. Market wrappers/translations remain intact.

AI News Radar tracks the actual upstream master branch. Its existing generator and the five previously reported alerts are not changed by this tooling PR. Real read-only discovery currently detects a conflict in locally formatted CSS (assets/styles.css); the safe result is a draft/manual reconciliation, not an overwritten wrapper or a claim that the newer upstream already passed.

Publication and merge authority

Both publishers verify gh api user is mashagua; published commits use the maintainer's designated identity. Configure an appropriately scoped maintainer credential as the Actions secret MARKET_MAINTAINER_TOKEN through approved secret management. This change neither creates nor reads credential values. With no credential the workflows run audit/verification only; there is no bot-identity fallback. Checkout credentials are not persisted; publishing uses an ephemeral git credential helper environment. The issue-reporting step retains the normal workflow token and its existing behavior.

The merge workflow runs after validation-related workflow completions, hourly at minute 47, and manually. It only checks out current main, not PR files or workflow artifacts; it never runs PR/upstream code. Labels and PR JSON are not trust roots. For each same-repository maintainer update PR it:

  1. Independently rediscovers/re-fetches the target and recomputes the complete allowed proposal using trusted-main policy and special-review records.
  2. Requires the complete PR diff to equal that result. Tooling/workflow changes, changed review exceptions, foreign paths or forged receipts cannot enter.
  3. Automatically clears byte/mode-identical installed payloads and proven top-level SKILL.md semver-only changes (all other bytes, inventory and modes identical). A version bump alone no longer needs a second human or a special approval marker. This is not a behavioral security audit: instructions, scripts, dependencies, license/NOTICE and install-scope changes are not covered by that proof. Substantive installed-content changes still need an APPROVED human maintainer review on the exact head, with: market-reviewed-no-expansion: <full-head-SHA>. The reviewer must be a different non-bot user with write/maintain/admin access; stale/dismissed/self reviews do not count. This clearance cannot override license, dependency, inventory, permission or receipt failures. No PR JSON, label or timeout of the Copilot wait check serves as behavioral approval.
  4. Requires all applicable check/context results complete and successful on the exact final head, including mandatory validate, translate and Copilot wait. CodeQL/Analyze are required to pass when actually scheduled, not required to exist on a JSON-only update where GitHub does not schedule them; outstanding changes-requested reviews block. No ignored CodeQL failures.
  5. Requires current-base ancestry, a clean server state, and active strict server-side up-to-date rules for validate/translate to close the base race. The merge API binds the expected head SHA, uses squash, and has no bypass.
  6. Merges at most one PR per run, then stops because main has advanced. Behind branches remain held for a normal merge update and new final-head checks.

Thus this does not promise unreviewed autonomous merging of arbitrary changed skill scripts/prompts. A real exact-head human no-expansion review is the additional behavioral authority; automation does not invent that attestation. This mechanism PR itself is outside the allowed diff and must be reviewed/merged separately by a maintainer.

Daily discovery remains 09:23 Asia/Singapore (GitHub can delay execution). Git and configured-source publishers each have a five-candidate cap. An existing open PR for a skill is preserved, not overwritten; the same closed candidate is not recreated. When an existing bot-authored Draft PR for the exact same target SHA passes fresh re-audit under updated main policy/special-review records (with zero manual human commits/files on the draft branch), the proposer merges main normally (no rebase/force-push), re-runs all catalog/i18n validators, updates the receipt/body, and marks the PR Ready (gh pr ready). When upstream has moved to a newer SHA that passes fresh re-audit and the older open Draft PR is bot-authored only (no manual edits), the proposer closes the stale Draft PR with a comment and opens a fresh Ready PR for the new SHA (with an expanded re-audit budget of max(limit * 4, 25) so open Drafts do not starve). Non-installable entries (availability != "installable", such as listing-only) are reported as governance-blocked in coverage rather than opening doomed Draft PRs. For single-file size budgets, non-executable raster images (.png, .jpg, .jpeg, .webp) are permitted up to 5 MiB while scripts, code, SVGs, docs, and other files remain strictly capped at 1 MiB. Discovery/audit/validation failures retain old admission and become drafts/manual findings. Nothing automatically promotes listing-only.

Offline checks

uv run scripts/catalog/validate_catalog_metadata.py --require-complete
uv run scripts/i18n/validate-i18n.py
uv run scripts/i18n/translate.py --check
uv run --with pytest --with jsonschema --with pyyaml --with 'lxml>=5.3,<7' --with 'defusedxml>=0.7' python -m pytest scripts

uv run scripts/catalog/publish_tracked_updates.py performs real discovery and audit planning without publication. merge_verified_updates.py defaults to verification-only and must run from current main; --merge additionally requires the maintainer credential, collaborator-permission read access and every gate above. Do not run publishing/merge flags as a smoke test against real PRs.

Direction-review correction (2026-11-25)

The original implementation incorrectly required every CodeQL language job on all updates, including JSON-pointer changes that do not schedule those jobs. Only baseline jobs are mandatory by name; every latest applicable returned check, status and workflow run must still succeed. No CodeQL failure is ignored. The byte-change gate was also too broad: an independently proven SKILL version-only change is now automatic. This deliberately does not promise that metadata checks can prove arbitrary upstream script/instruction behavior safe. Expanding that coverage needs a real behavioral review mechanism, not deletion of the safeguard. Identity verification, trusted-main re-audit, local-patch preservation, finite budgets, exact-head binding, strict server rules and no-admin/no-force stay intact.

Special-review and release-gate requirements (2026-11-29)

Three additional gates learned from manual PR reviews (#368, #358, #360) are now encoded in schemas/special-review.v1.schema.json and scripts/catalog/audit_skill_update.py:

  1. Client release gate for acceptedClientAttachedNotices: Binding a verified client source commit/tree (CLIENT_COLLECTION_NOTICE_IMPLEMENTATIONS or CLIENT_STANDALONE_NOTICE_IMPLEMENTATIONS) proves the implementation, not that users have received it in a public build. Before clearing Draft on a notice-delivery update, confirm the verified implementation is shipped in an official client release (e.g. DesireCore v10.0.214) with no unverified drift in skill-staging.ts, market-install.ts, or source-fetch.ts. Record the release tag in acceptedClientAttachedNotices.clientReleaseTag when bound to a shipped build.
  2. Exact-pin non-inheritable license exceptions (acceptedExactPinLicenseException): Entries without a standalone LICENSE file (such as follow-builders, which relies on a one-line README.md MIT declaration) never inherit a previous human exception across commits. Each new pin requires an explicit exact-fromRef→toRef review record binding the unchanged evidence SHA-256, updated bilingual catalog descriptions, and a dated review document under docs/.
  3. Behavioral security review gate (acceptedBehavioralSecurityReview): When an upstream snapshot modifies credential/environment loading, browser cookie or consent gating, authorization/network boundaries, or .skillignore inside the install scope (such as last30days), matching dependency hashes alone is insufficient. 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.

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)

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.