Skip to content

feat(claude): 業務用マシンでクラウド系 CLI をエージェントから実行させない - #273

Merged
paveg merged 2 commits into
mainfrom
feat/claude-business-deny-cloud-cli
Nov 4, 2026
Merged

paveg merged 2 commits into
mainfrom
feat/claude-business-deny-cloud-cli

Conversation

@paveg

@paveg paveg commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

概要

業務用マシン(business_use: true)では、AWS・GCP・Kubernetes・Terraform・SOPS などのクラウド系 CLI と sudo・gh auth を、エージェントが Bash から実行できないようにする。これらの状態には MCP サーバーから触れるか、人が手で実行する。個人用マシンの設定は変えない。

  • home/dot_claude/settings.json.tmpl: permissions.deny に 16 パターンを足す(Bash(*aws *) など)
  • home/dot_codex/rules/custom.rules.tmpl: 同じ対象を forbidden の prefix_rule 3 本で足す(deny ブロックにある「両ファイルを揃える」という取り決めに従う)
  • 別コミット: 業務用マシンで brucke@freee-ccplugins-marketplace プラグインを有効にする(deny とは関係のない変更だが、同じファイルの業務用ブロックに入るので一緒に出す)

レビューの観点

  • 既存の ask(Claude)と prompt(Codex)のルールは、個人用マシンのために残している。業務用では deny と forbidden が優先されるので、これらは効かない
  • Claude の Bash(*aws *) はコマンド文字列のどこに aws があっても一致するので、grep aws file のようなコマンドも止まる。Codex は argv の前方一致なので、foo && aws ... のような連結コマンドの後ろ側は捕まえられない

確認したこと

確認 結果
業務用で settings.json.tmpl をレンダリングし jq で読む JSON として正しく読め、追加した 16 件が deny に入っている
個人用(--override-data '{"business_use":false}')でレンダリングする Claude 側の追加は 0 件。Codex 側にもブロックは出ない
codex execpolicy check(業務用でレンダリングしたルール) aws s3 ls・helm get values r・gh auth token・sudo ls は forbidden。helm list・gh pr list・git status はどのルールにもマッチしない
just test test-zsh-features の「project environment state was not approved」で失敗。変更を退避した main でも同じように失敗するので、この PR とは関係ない

🤖 Generated with Claude Code

paveg and others added 2 commits November 4, 2026 17:42
業務用マシンでは、AWS・GCP・Kubernetes・Terraform・SOPS などの状態に Bash から触れさせず、MCP サーバー経由か手作業に限る。business_use のときだけ、Claude の permissions.deny と Codex の execpolicy に同じ対象を禁止として足す。

既存の ask / prompt ルールは個人用マシンのために残す。業務用では deny / forbidden が優先されるので、そちらは効かない。

Claude の Bash(*aws *) はコマンド文字列のどこにあっても一致するが、Codex は argv の前方一致なので、連結したコマンドの後ろ側は捕まえられない。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 661c6f7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@paveg
paveg enabled auto-merge (squash) November 4, 2026 08:43
@paveg
paveg merged commit 03dec21 into main Nov 4, 2026
12 checks passed
@paveg
paveg deleted the feat/claude-business-deny-cloud-cli branch November 4, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant