Files
zcode-gatekeeper/gatekeeper/allowlist.txt
T
luoxiaoxin123 b207dbcaa0 安全修复:复合命令缺口、状态文件投毒、自批命令、协议 fail-open、dangerlist 漏报
- COMPOUND 补全换行/单个&/重定向(白名单不再被多行/重定向命令绕过),find 移出白名单
- gatekeeper 状态文件读写确定性硬拒(防 approved.json 投毒绕过灾难黑名单)
- 模型自批 approve 命令确定性硬拒(防 --yes 自我放行)
- approvedConsume 校验时间戳必须在过去(防未来时间戳使批准永不过期)
- daemon 协议错误/未知 op 返回 {ok:false},客户端降级内联完整审查(消除 fail-open)
- onReviewerError 支持 prompt 别名;llmTimeoutMs 超时预算钳制(防 hook 超时 fail-open)
- dangerlist 补漏:del/rd flag 顺序无关、Remove-Item 盘根星号、Format-Volume、format.com
- review 输入 JSON 解析失败与基础设施崩溃改为 fail-closed
- install 首次安装从模板生成 config.json;回归扩展至 41 项
2026-09-13 20:59:36 +08:00

71 lines
1.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 只读/无副作用命令白名单:命中即放行,不调用审查模型(正则,不区分大小写)
# 注意:脚本会自动排除复合命令(含 && || ; | $( 反引号),此处无需处理 ——
# 因此 PowerShell 管道(Get-Xxx | Select ...)一律落入灰区交 LLM,
# 这是刻意的:PS 管道尾段可能是 rm/ri(Remove-Item 的别名)等危险别名。
# ---------------------------------------------------------------
# —— Bash / 通用 ——
^\s*echo\s
^\s*pwd\s*$
^\s*whoami\s*$
^\s*hostname\s*$
^\s*id\b
^\s*uname\s
^\s*date\s*$
^\s*uptime\s*$
^\s*free\s
^\s*who\b
^\s*ls(\s|$)
^\s*dir(\s|$)
^\s*cat\s
^\s*head\s
^\s*tail\s
^\s*grep\s
^\s*rg\s
^\s*wc\s
^\s*stat\s
^\s*file\s
^\s*du\s
^\s*df(\s|$)
^\s*tree(\s|$)
^\s*which\s
^\s*where(\s|$)
^\s*whereis\s
^\s*type\s
^\s*realpath\s
^\s*basename\s
^\s*dirname\s
^\s*readlink\s
^\s*lscpu\s*$
^\s*lsblk\s*$
^\s*printenv\b
^\s*env\s*$
^\s*node\s+(-v|--version)\s*$
^\s*npm\s+(-v|--version)\s*$
^\s*python\s+(-V|--version)\s*$
^\s*git\s+(status|log|diff|show|branch|rev-parse|remote\s+-v|config\s+--get)\b
^\s*npm\s+(ls|list|view)\b
# —— PowerShell(只读 cmdlet)——
^\s*Get-Location\s*$
^\s*Get-Content\s
^\s*Get-ChildItem\b
^\s*Get-Item\b
^\s*Get-ItemProperty\b
^\s*Get-Command\b
^\s*Get-Help\b
^\s*Get-Member\b
^\s*Get-Variable\b
^\s*Get-PSDrive\b
^\s*Get-Service\b
^\s*Get-Process\b
^\s*Get-Volume\b
^\s*Get-Module\b
^\s*Get-Date\s*$
^\s*Test-Path\s
^\s*Select-String\s
^\s*Measure-Object\b
^\s*Write-Output\s
^\s*Write-Host\s
# —— cmd / 跨平台 ——
^\s*tasklist\b
^\s*ps\b