zai-org / zai-org/zcode-plugins

[mimosa 1.0.3] Git 门禁全工作区扫描误拦存量 + ENOBUFS 放行:建议 diff 扫描、不可变基线、修稳定性、加 sanitizer 声明(附 591 vs 密封 43 复现数据)

Open
#17 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39
Forks
20
PR merge metrics
No merged PRs in 30d

Description

插件与版本

  • 插件:mimosa(Code Security Protection)1.0.3,macOS,node v24,ZCode 官方市场安装
  • 场景:大型工作区(数千文件,其中包含大量按保留策略不可修改的历史存证备份目录

现象一:Git 门禁按"全工作区快照"扫描,存量污染导致误拦

一次 git commit(改动仅为 2 个 Markdown 文档)被阻断,报 "591 high + 47 low"。逐条抽样核实:绝大多数命中位于备份/历史项目目录的冻结副本——这些文件按治理策略不允许修改,"修复"它们等于破坏存证。

同一工作区用官方 MCP sealed deep scan(同日)只报 43 条(含 seal sha256)。591 与 43 的巨大差异说明:门禁的扫描对象与治理目标错配——把"历史存证"和"当前施工变更"混进同一个阻断闸。

现象二:门禁判定不稳定

同一天内:既有"591 高危强制拦截",也有多次 "scanner_enobufs → 按兼容策略放行"。同一个闸忽严忽松,阻断判定不可依赖,也无法区分"真风险"与"工具故障"。

现象三:已防护代码无申辩出口

12 条 "path traversal" 高危命中于同一个脚本。该脚本路径拼接已统一经过项目内安全路径模块(realpath 归一 + containment 校验,越界即抛错),关键写点另有 realpath 前缀校验。我们补写了五类逃逸测试(../../../、绝对路径注入、根内 symlink 逃逸、编码变体),11/11 通过——但扫描器仍逐调用点报高危。原因:扫描器未把该净化模块建模为 sanitizer,且没有项目级白名单/基线机制可关闭这类"已防护"判定。

建议(按优先级)

  1. Git 门禁默认改为 diff 扫描:只扫本次提交触及的文件 + 新增依赖/配置变化,不做全工作区快照。
  2. 支持项目级不可变基线:项目内声明(如 backups/** = immutable),历史命中不阻断新增提交;若 diff 触碰基线路径则重新扫描。
  3. 修复大工作区下的 ENOBUFS/超时:让阻断判定可信——宁可稳定地报 43 条,也不要在"591 强拦"与"enobufs 放行"之间摇摆。
  4. 提供 sanitizer 声明与误报关闭机制:允许项目以机器可读方式声明"某模块是路径净化器/某类判定已按基线接受",让已防护流可按项目关闭,而非逐调用点报高危。

期望

门禁稳定完成、只对新增风险负责、误报有项目级出口。当前它已经实际冻结了正常开发提交(含纯文档改动),只能靠它自身的 enobufs 兼容路径偶然放行。


English summary

mimosa 1.0.3 git-gate scans a full workspace snapshot on every commit: one docs-only commit was blocked with "591 high + 47 low", while an official sealed deep scan of the same workspace reported 43 findings — most of the 591 live in immutable evidence backups that policy forbids modifying. The gate is also unstable: same day, it both hard-blocked and allowed commits via scanner_enobufs compatibility pass-through. Additionally, 12 "path traversal" findings hit one script whose path joins all go through a central sanitizer module (realpath + containment, raises on escape; 5-class escape test suite passes 11/11) — no project-level baseline/sanitizer acknowledgment exists to close them. Requests: (1) diff-scoped gate scanning, (2) project-level immutable baseline with re-scan on touch, (3) fix ENOBUFS flakiness, (4) machine-readable sanitizer declaration / baseline format to close guarded findings.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Git gate entry point and the scanner's ENOBUFS handling, then inspect the sanitizer module and the existing 11/11 path-escape test suite. Trace how commit scope and findings are selected. Done means diff-scoped scanning, immutable-baseline and sanitizer declarations, and stable handling of large workspaces without inconsistent blocking.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, node.js, python
Domain
developer-experience, devtools, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.