Skip to content

fix(hooks): close the quoted-argument and wrapper bypasses in the command guard #71

Closed

Description

@furedea-agent

guard_command の禁止判定に 2 つの抜け道がある.クォートした引数とラッパーで禁止コマンドや管理対象プログラムが hook を素通りする.
安全装置の穴なので最優先で塞ぎ,回帰テストを置く.
判断事項: なし.

入力 現在 期待
git 'add' .,git add ".",git add '-A',git 'commit' -n -m x,python -m 'pip' install x allow deny
stdbuf -o0 gh repo delete x --yes,setsid …,unbuffer …,ionice -c3 …,busybox … allow(hook 素通り) 管理対象として判定(listed でなければ ask)
stdbuf -o0 curl https://example.com allow ask(ローカル以外の curl)

受け入れ条件

  • 禁止の正規表現を,クォートを外した引数列(arguments)でも判定する
  • stdbuf,setsid,unbuffer,ionice,busybox をラッパーとして扱い,後続のプログラムを判定する
  • 上表の全入力を回帰テストに追加し,修正前に失敗することを確認する
  • 既存のテストが通る
出典・前提
  • 原因: forbidden_objection が command_words_text(プログラム名以外はクォートを保持した原文)に正規表現を当てている(shell_syntax.py:287-296,134-147).ラッパー一覧 WRAPPERS(shell_syntax.py:36-60)に上記がない
  • 事前調査で decide() に通して確認済み
  • 範囲外: インタプリタ内のコード(python3 -c "...").python は無条件 allow の設計

Activity

  1. added
    bug
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions