Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#41 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
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-scansecurity_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 个符号
    handleScanhandleSecurityScanhandleSecurityScanStarthandleSecurityScanStatus …)。

同一个 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
    本应拦住此问题(它要求深扫 completedfindingCount >= 1),需确认该工作流在 fork/PR 场景下
    不是 0s 跳过(近期多个 run 显示 action_required、耗时 0s)。
  4. 让 worker 缺失时报 failed 而非 inconclusive,避免静默降级。
主要语言
Python
星标
39
派生
20
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

zai-org/zcode-plugins 的其他 Issue

查看 zai-org/zcode-plugins 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。