Skip to content

fix(mcp,media-ops,crablaw-cn): 安全基线 v2 恢复第一方本机 sidecar + 媒体 0.4.4 主体注入 + 法律存储完整性(三仓根因修复 D-0(c) / P-M1 / P-L1 / P-L2) - #25

Merged
acosmi-fushihua merged 2 commits into
mainfrom
fix/2026-09-12-three-repo-remediation
Sep 12, 2026

Conversation

@acosmi-fushihua

Copy link
Copy Markdown
Contributor

目的

按「三仓根因修复统一实施方案 v2.1」(真源在私有源码仓 acosmi/crabcode-source)交付插件仓侧的 P0/P1 工作包:媒体线 D-0(c) + P-M1-id + RC-05[2.1] + P-M1-a,法律线 P-L1-a/b + P-L2-a + P-L2-c。基线 c1c5dd9(main)。

裁决(主控)

改动

媒体线(commit 2)

  • src/policy/mcpSafeBaseline.ts / mcpContractValidator.ts:允许表 MCP_ALLOWED_LOCAL_SERVERS,新增 ${user_config.X} 必须 required: true 规则。
  • plugins/crabcode-media-ops/.mcp.json(新):MEDIAOPS_IDENTITY_MODE=local-editorial、ISSUER=crabcode-local-editorial、ID/显示名来自宿主 user_config,角色 = POLICIES 全部角色去掉四个第二真人门角色(tests/mcp-config-roles.test.ts 推导比对)。
  • plugin.json:0.4.4、requiredMcpServers:["mediaops"]、userConfig.principal_id/principal_name。
  • src/envelope.ts:success=false ⇒ isError:true。
  • src/domain.ts / tools/delivery.ts / tools/readiness.ts:QA 证据自带 mode,static 不再写 passed;Media Gate 要求 mode='full'。
  • dist/server.js 重建、SBOM 同步、README / 0.4-migration 更新、restore-inventory.json 证据。

法律线(commit 1)

  • _matter_common.py / bootstrap_matter.py / sync_run_manifest.py / validate_run.py + 三份 schema + PRACTICE.md:扫描覆盖状态、归档纳入、逐级链接校验(含 Windows junction)、锁内独占创建 + .pending、陈旧锁按 pid 回收、stale 集合保留、来源变化传播、[已核验-来源] 谓词收紧、退出码表。
  • tests/crablaw-cn/matter-store-integrity.test.ts:16 条真脚本反例。

证据(主控亲跑,Windows / bun 1.3.11 / Python 3.11)

  • 仓根:bun test ./tests/workflow-skill-presentation-completeness.test.ts ./tests/validators/ ./tests/analysis.test.ts ./tests/references.test.ts ./tests/ci-trigger-policy.test.ts ./tests/crablaw-cn/ → 179 pass / 0 fail;bun run validate exit 0;lint:mcp-contract all checks passed;bun test ./tests/crabaccount/ 13 pass。
  • 媒体插件:bun run typecheck 0;bun run check:distribution status: passed, toolCount: 38;bun run validate 对齐 0.4.4;bun run test 113 pass / 5 fail —— 5 条为 Windows 既存红(3 条 package 的 EPERM fsync、1 条 storage 的 EBUSY rm,改动前基线同样红;1 条 readiness 为争用 flake,单跑两次 6/6 绿)。Linux 与 full QA 由本 PR 派发的 CI 覆盖(见下)。
  • stdio 直连探针(重建后的 dist,按 .mcp.json 逐字解析 env):注入 ID/显示名 → identity.mode=local_editorial, authenticated=true,mediaops.content.save 成功、无 isError;去掉 ID → capabilities 与 content.save 均 AUTHENTICATION_REQUIRED 且 isError:true。
  • tests/crabcode-security/* 在 Windows 上因 /bin/sh / python3 banner hook 既存红(CI 的 ubuntu/macos 矩阵覆盖)。

未验证 / 待 CI

  • MEDIAOPS_QA_MODE=full(Chromium/Nu/axe)链路只经 typecheck 与 fixture,本机无浏览器;由 CI media-ops-plugin job 验证。
  • 宿主端真机安装链(镜像 → 0.4.4 安装 → GUI 收集 user_config → mediaops 自动连接)在合并、发布镜像后由主控在本机用宿主代码路径验收。
  • Python 脚本 POSIX 分支(真 symlink、os.kill 探活)只在 CI 跑到。

中间提交说明

commit 1 单独检出时 workflow-skill-presentation-completeness 的 metadata.version 断言为 0.4.4 而市场仍 0.4.3(该文件同时承载法律 SKILL.md 指纹与媒体版本两处更新,随 commit 2 一起绿);本 PR 以合并提交合入,不影响 main。

🤖 Generated with Claude Code

https://claude.ai/code/session_01SckZkZw7wdyWSAFWNQFvLJ

Acosmi Automation and others added 2 commits September 12, 2026 01:58
RC-17/18:existing_name_records 返回覆盖状态(complete/partial + corrupt/refused/typeErrors),
扫描范围纳入 matters/_archived;每个文件 open 前经 safe_path 逐级链接校验(含 Windows
junction reparse tag),拒读进入覆盖不完整;非 object 的 client.json 是类型错误不是崩溃。
RC-19:事项目录在 .matter-store.lock 内 os.mkdir 独占创建,.pending 完成标记,
同 ID 并发只允许一次创建、后者退出码 3。
RC-20:锁文件写 pid/host,陈旧锁按 pid 存活判定回收(Windows 用 OpenProcess,
不用会杀进程的 os.kill),绝不按文件年龄;命中记录带双方角色与关系分类。
RC-22(写侧最小):staleIssueIds 为既有 ∪ 新影响,只有重分析清除;sources.jsonl
逐条摘要进 manifest,被引用来源变化传播失效;--apply 的读改写整段在 .writer.lock 内。
RC-21(P-L2-a):[已核验-来源] 只接受 verified / lawyer-reviewed 的官方/案例来源,
unknown / superseded / unreviewed / source-needs-check 一律不算。
RC-23(P-L2-c):PRACTICE.md 新增运行环境与退出码表(python3 别名)。

测试:tests/crablaw-cn/matter-store-integrity.test.ts 16 条真脚本反例(R01/R02/R03/X1–X5/X7 +
谓词三态 + .pending),共享夹具 matterFixture.ts;篡改对照 11 条全红后还原全绿。
workflow-skill-presentation-completeness 的模型内容指纹随两份 SKILL.md 路由文案更新。

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SckZkZw7wdyWSAFWNQFvLJ
…注入 local-editorial 主体 —— 裁决 D-0(c)

RC-01 / D-0(c):mcpSafeBaseline 由单一 html-video 允许项扩为 MCP_ALLOWED_LOCAL_SERVERS
(html-video + media-ops 两个随包 dist、本机 stdio 的第一方服务),其余 41 个连接器
继续暂停;mcpContractValidator 按允许表校验,并新增「.mcp.json 引用的 ${user_config.X}
必须在 plugin.json.userConfig 声明为 required」规则(宿主缺值替换抛错且不写 default)。
RC-13(P-M1-id):媒体插件恢复 .mcp.json,固定 MEDIAOPS_IDENTITY_MODE=local-editorial 与
ISSUER=crabcode-local-editorial,主体 ID / 显示名来自宿主 user_config(principal_id /
principal_name 均 required),角色清单 = POLICIES 全部角色去掉只由第二真人门要求的四个
(tests/mcp-config-roles.test.ts 从 identity.ts 推导比对防漂移);requiredMcpServers 恢复
["mediaops"] 让宿主安装后自动激活;版本 0.4.3 → 0.4.4(manifest/package/marketplace/
dist/SBOM 同步,dist/server.js 重建)。
RC-05[2.1]:envelope.toToolResult 对 success=false(error / blocked)带 isError:true,
业务失败不再以成功形态返回;JSON 正文不变。
RC-24(P-M1-a):QA 证据自带等级 —— static 模式写 status:'static' / mode:'static',未跑的
Chromium/Nu 检查记 skipped 而非 passed;readiness 只接受 mode='full' 的证据放行审批
(DELIVERY_QA_LEVEL_INSUFFICIENT),旧记录缺 mode 视为 legacy-unknown;完整性检查
只断言证据存在,等级判定单点留在 Media Gate。
证据:docs/audit/evidence/2026-09-12-mcp-restore/restore-inventory.json(新 .mcp.json
sha256 65c5afbf…179f);08-22 containment-inventory 原样保留为历史,
mcp-safe-baseline.test 以 removed == paused ∪ restored 的会计恒等式承接可追溯性。

主控实测(Windows,bun 1.3.11):重建 dist 走 stdio 直连,注入 ID/显示名后
mediaops.content.save 成功且无 isError;去掉 ID 后 capabilities 与 content.save 均
AUTHENTICATION_REQUIRED 且 isError:true。full QA 链路本机无 Chromium,由 CI Playwright
容器验证。

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SckZkZw7wdyWSAFWNQFvLJ
@acosmi-fushihua

Copy link
Copy Markdown
Contributor Author

CI(分支派发)run 34684792554 结果:verify ✅ · media-ops-plugin(Linux Playwright 容器,含 test:qa / qa:release full QA)✅ · html-video-plugin ✅ · media-publisher-fixture ✅ · security-plugin ×4 ✅ · crabcopyright-plugin:3.13 ×2 ✅,3.9 ×2 ❌ 与本 PR 无关 —— pip install pdfplumber==0.11.9 解析到 pdfminer.six==20251230(要求 Python ≥3.10),是工作流钉的依赖在 3.9 上的既存漂移,本 PR 未触碰 crabcopyright。

@acosmi-fushihua
acosmi-fushihua merged commit 99fa5c4 into main Sep 12, 2026
10 of 12 checks passed
@acosmi-fushihua
acosmi-fushihua deleted the fix/2026-09-12-three-repo-remediation branch September 12, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant