Shell tool executes destructive commands (e.g. `rm -rf`) with no approval/confirmation gate
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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分
- マージ済み PR(30日)
- 53
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
router-for-me/CLIProxyAPI#7330 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug os:ios
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
hajimehoshi/ebiten#4039 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 9 日以内に返信