Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[mimosa 1.0.3] 深扫 worker 未构建:security-scan-worker.mimosa 解密为空模块,security_scan 恒返回 inconclusive

オープン
#41 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
40/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker, javascript, node.js

調査の方向性

The issue is in the build process for the security-scan-worker.mimosa file. Start by examining the build:mcp npm script and the scripts/build-plugin.mjs file to see how the worker is generated. Check the payload/dist/mcp/ directory for the existing empty worker file. The fix likely involves ensuring the worker module is properly bundled and exported. Run the existing CI test tests/test_mimosa_plugin.py::test_mcp_async_deep_scan_completes_and_seals_report to verify the fix.

索引モデルが issue の本文から書いたものです。

説明

[mimosa 1.0.3] 深扫 worker 未构建:security-scan-worker.mimosa 解密为空模块,security_scan 恒返回 inconclusive

摘要

mimosa 1.0.3 的 MCP 深度扫描(security_scan / security_scan_start)完全不可用:
扫描 worker 的受保护产物 payload/dist/mcp/security-scan-worker.mimosa 是一个空壳——
容器与签名均有效,但解密后导出的模块为空对象(零导出)。MCP server 因此每次都返回:

[Mimosa] normalized security scan failed: security scan worker 未构建;请重新运行 build:mcp / sync:zcode

结果:所有 deep scan 在分析开始前即终止,返回 runStatus: "inconclusive"、completeness: "partial",
threatModel / findingDiscovery 两个阶段计数全为 0(entryPoints=0、principals=0、findings=0)。

影响

  • 依赖 MCP 深扫的能力(/mimosa-deep-audit、$mimosa-security-scan、security_scan* 工具)对本插件全量失效。
  • 因为返回 inconclusive 而非 failed,调用方(含 ZCode 在 push 前的扫描门禁)会无法拿到完整结论,
    却又看不出一条明确的错误——表现为「扫描能跑完、但零覆盖、无法据此判断安全」。
  • 本地写前 hook、Stop 增量复查、Git 门禁、CLI audit 不受影响(见下「已确认正常的部分」)。

环境

  • OS:Windows 11 (win32 10.0.26200 x64)
  • Node:v24.18.0(在 PATH 上)
  • ZCode 插件市场:zcode-plugins-official
  • 插件:mimosa@zcode-plugins-official 1.0.3
  • 引擎配置:默认 MIMOSA_ENGINE=native

复现步骤

  1. 从官方市场安装 mimosa 1.0.3,新建任务使其 MCP 生效。
  2. 调用 MCP 深扫(等价于 /mimosa-deep-audit):
    // tools/call
    { "name": "security_scan", "arguments": { "project": "<任意仓库>", "depth": "deep" } }
    
  3. 观察返回:isError: true,文本为
    [Mimosa] normalized security scan failed: security scan worker 未构建;请重新运行 build:mcp / sync:zcode。
  4. 若走 security_scan_start + security_scan_status 轮询路径,job 会 completed,
    但 result.completeness == "partial"、runStatus == "inconclusive"、findingCount == 0。

证据

1. 三份产物哈希完全一致(排除传输/安装损坏)

官方仓库、CDN 发布 zip、本地安装副本的 worker 哈希逐字节相同:

path: plugins/mimosa/payload/dist/mcp/security-scan-worker.mimosa
bytes: 1306563
sha256: a4d5963e3c471ce1935ed4630bd7639b0e634d42b4f618232696862e5370c246
  • 仓库版(gh api .../contents/...)
  • CDN https://cdn-zcode.z.ai/zcode/official-plugin/plugins/mimosa/1.0.3/plugin.zip(zip sha256 63fa21a0...)
  • 本地 ~/.zcode/cli/plugins/cache/zcode-plugins-official/mimosa/1.0.3/...

三者一致。该文件本身未损坏、未截断。

2. 该文件通过了签名清单校验(说明它就是被正式发布的产物)

payload/manifest.json 中声明:

{ "path": "dist/mcp/security-scan-worker.mimosa", "bytes": 1306563,
  "sha256": "a4d5963e3c471ce1935ed4630bd7639b0e634d42b4f618232696862e5370c246" }

声明值与实际文件哈希一致 → 这不是「发布时文件被改动」,而是这份空壳 worker 就是构建产物。

3. 加载后导出为零(与可用的 server.mimosa 对比)

用插件自带的 runtime/protected-loader.cjs 按官方方式加载:

loader.activateProtectedAssetPack(assets/d2bf40...mimosa, "mimosa/<variant>/private-assets/d2bf40...");
loader.activateProtectedRulePack(rules/mimosa-offline.mimosa, "mimosa/<variant>/zcode-rules");

const w = loader.loadProtected(module, "dist/mcp/security-scan-worker.mimosa",
                               "mimosa/<variant>/zcode-scan-worker");
console.log(typeof w, Object.keys(w));   // → object, []
  • worker:object {},零导出。
  • 同机制加载 dist/mcp/server.mimosa:正常导出 11 个符号
    (handleScan、handleSecurityScan、handleSecurityScanStart、handleSecurityScanStatus …)。

同一个 loader、同一套激活流程,server 正常、worker 为空 → 问题在 worker 打包产物本身。

4. 构建流程未产出 worker(根因指向)

plugins/mimosa/payload/README.md 的构建说明只声明了两个产物:

npm install
npm run build:cli && npm run build:mcp
node scripts/build-plugin.mjs
# 产物在 mimosa-zcode/,已自包含 dist/cli.js 与 dist/mcp/server.js

worker 未被列为构建产物,而仓库中 dist/mcp/security-scan-worker.mimosa 却以「有效容器 + 空模块」的
形态存在。故判断:build:mcp 未真正生成 worker 的模块体,仓库内该文件是一个占位空壳。

期望行为

  • build:mcp 应产出内容完整的 security-scan-worker.mimosa;
  • security_scan 在正常仓库上返回 runStatus: "completed"、coverage.completeness: "complete",
    并能在存在明显漏洞(如命令注入)时给出 findingCount >= 1;
  • 若 worker 缺失/为空,应返回明确错误(failed)而非静默降级为 inconclusive,
    以免调用方把「零覆盖」误读为「没问题」。

已确认正常的部分(供定位参考,非本 issue 范围)

  • 规则包 rules/mimosa-offline.mimosa:可正常激活。
  • 私有资产包 assets/d2bf40...mimosa:可正常激活。
  • 原生知识库 assets/bccd43...mimosa(manifest 记 8145 条规则 / 1071 个 CVE):容器存在。
  • 写前 hook(hooks/scan-hook.mjs,PreToolUse/PostToolUse):本地实测 coverage: "complete",
    能正常拦截命令注入类候选。
  • CLI dist/cli.js audit <dir> --json:可运行并产出报告。

即:只有 MCP 深扫这一条链路因 worker 为空而失效。

建议

  1. 修复 build:mcp,确保 security-scan-worker.mimosa 被真实构建并随 mimosa-zcode/ 一起打包。
  2. 在 scripts/build-plugin.mjs 的产物清单中显式包含该 worker,并对其做「非空导出」冒烟校验。
  3. 修复 CI:.github/workflows/validate.yml 中的 tests/test_mimosa_plugin.py::test_mcp_async_deep_scan_completes_and_seals_report
    本应拦住此问题(它要求深扫 completed 且 findingCount >= 1),需确认该工作流在 fork/PR 场景下
    不是 0s 跳过(近期多个 run 显示 action_required、耗时 0s)。
  4. 让 worker 缺失时报 failed 而非 inconclusive,避免静默降级。
主要言語
Python
スター
39
フォーク
20
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

zai-org/zcode-plugins のほかの issue

zai-org/zcode-plugins の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。