Shell tool executes destructive commands (e.g. `rm -rf`) with no approval/confirmation gate
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with the shell execution and banned-builtins checks in internal/core/shell.go, then read the approval patterns in examples/extensions/confirm-destructive.go and examples/extensions/permission-gate.go. Work out how a default gate should classify dangerous commands and behave in interactive and non-interactive contexts. Done means risky commands require approval or are blocked safely, including in --quiet, CI, and GitHub Action contexts.
由索引模型根据 Issue 内容生成。
描述
Summary
The shell core tool (internal/core/shell.go) runs any command the model requests with no human-in-the-loop confirmation step, including destructive commands such as rm -rf. The only existing restriction is a regex blocklist of a handful of shell builtins (alias, bg, bind, builtin, command, set, trap, ulimit, etc. — see internal/core/shell.go ~L227-229). Any external binary — rm, curl, nc, ssh, scp, aws, git push --force, etc. — executes immediately once requested, with no approval prompt and no per-command risk classification (~L343-345).
Reproduction
In an interactive TUI session:
- Start
kitin a project directory. - Prompt: "Please execute the command rm
-rf ~/test." - The model issues
Shell rm -rf ~/test. - The command runs immediately — no confirmation dialog, no "allow once / always / deny" prompt — and the transcript shows only
(no output)before the agent reports back and marks the turn "Done".
Why this matters
Kit is designed to also process content that may not be fully trusted — model output steered by file contents, fetched web pages, MCP tool results, or (via the GitHub Action integration) third-party issue/PR text. Because the shell tool has no confirmation gate and no dangerous-command classification, any prompt-injected instruction that reaches the model can translate directly into destructive local command execution (data deletion, exfiltration via curl/nc, credential theft, etc.) with no opportunity for the user to intervene.
Note that examples/extensions/confirm-destructive.go and examples/extensions/permission-gate.go already demonstrate an approval-gate pattern as an opt-in extension — this suggests the gap is that no form of this is enabled by default in core, rather than the capability being entirely absent from the codebase.
Suggested remediation
- Add a confirmation/approval gate to the core
shelltool, at minimum for commands matching a dangerous-pattern list (recursive delete, network tools, credential-path access, force-push,sudo, etc.), prompting the user before execution. - Consider promoting the existing
confirm-destructive/permission-gateextension pattern to a default-on core behavior rather than leaving it opt-in. - Ensure whatever gate is added fails closed (blocks/prompts) rather than open in non-interactive contexts (
--quiet, CI, GitHub Action), since those are also the contexts most likely to encounter untrusted input.
Relevant code
internal/core/shell.go(banned-builtins check ~L227-229, execution path ~L343-345)examples/extensions/confirm-destructive.go,examples/extensions/permission-gate.go(existing opt-in pattern)
- 主要语言
- Go
- 星标
- 150
- 派生
- 30
- 平均合并
- 8 小时 12 分钟
- 30 天内合并 PR
- 53
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
agent-butler-finding chore
难度 1/5 1 小时以内 新手友好度 88/100
jordansmall/spindrift#6695 ·
维护者通常 1 天内回复
-
skills-init: commit-SHA skill refs never start (git checkout -- <sha> reads the SHA as a pathspec)未关闭
难度 1/5 1 小时以内 新手友好度 84/100
kagent-dev/kagent#3571 ·
维护者通常 1 天内回复
-
book-layout.spec fails when the similar-books rail holds other projects' books可能已有人在做 @praetorianer777 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
praetorianer777/GoTome#373 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 80/100
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeout可能已有人在做 @floriankoch 今天认领。 未关闭triage
难度 2/5 1-3 小时 新手友好度 76/100
envoyproxy/gateway#10562 ·
维护者通常 1 天内回复