Repository navigation
feat(hooks): allow read-only local curl diagnostics and log syntax ask kinds - #287
Merged
Merged
Conversation
…k kinds Allow curl -w with a fixed format, -D -, and --compressed against localhost, and treat a localhost curl piped into stdin-only filters (jq, head, tail, grep, wc) like the curl alone. Record only a short reason kind for a syntax ask in the audit log, never the command text. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Oct 22, 2026
Accept only a single-quoted -w/--write-out format made of allowlisted
placeholders, plain text, and the newline escape, so double-quoted
escapes cannot smuggle a remote URL or -L/-x/-K, and %output, %{stderr},
and @file forms keep asking. Restore the fixed option order of the curl
rule so repeated or reordered options ask again.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Check each filter's text outside single quotes against a strict literal character set, so globs and zsh extended_glob patterns cannot make a filter read local files. Register shell_inspection as first-party so deptry passes. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Split the filter glob test so the hook assertion always runs and only the real-zsh expansion demonstration skips on runners without zsh. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
ローカル開発サーバーへの読み取り専用 curl が毎回確認を求められていたため,許可範囲を広げる.あわせて,構文による確認要求の原因を監査ログから判別できるようにする.
変更内容
allowed_commands.jsonの localhost 向け curl ルールで,次を許可する.ホストは localhost,127.0.0.1,[::1] に限定したままとする.-w/--write-out: シングルクォートで囲んだ固定書式のみ.使えるのは許可リストにあるプレースホルダ(%{http_code},%{time_total},%{time_connect},%{time_starttransfer},%{size_download},%{content_type},%{url_effective},%{remote_ip}),\n,英数字と一部の記号のみ.ダブルクォート,%output,%{stderr},@fileなどファイルの読み書きや出力先の変更につながる書式は確認を求める.-D -/--dump-header -: 標準出力のみ.ファイルへの出力は確認を求める.--compressedguard_command.pyで,localhost の curl をjq,head,tail,grep,wcの標準入力専用フィルターにパイプする形を,curl 単体と同様に扱う.UnsupportedSyntaxに短い理由種別(heredoc,expansion,dollar-quote,wrapper,parse-failure)を追加し,構文による確認要求の監査ログには種別のみを記録する.コマンド本文や引数は記録しない.shell_inspection.pyに分け,shell_syntax.pyを行数上限内に収めた.pyproject.tomlのknown_first_partyに登録し,deptry を通す.テスト
uv run --frozen pytest tests/agents: 2173 件成功uv run --group audit vulture: 指摘なしuv run --group audit deptry .: 問題なしlefthook run pre-commit --all-files: 成功Closes #286
🤖 Generated with Claude Code