AI agent時代、`.claude/` と `.vscode/` はCIと同じくらいレビュー対象になる Configuration directories like `.claude/` and `.vscode/` that AI coding agents read are em…
- AI coding agentが参照する `.claude/` や `.vscode/` などの設定ファイルは、悪意ある指示を埋め込むサプライチェーン攻撃の新たな経路になり得る。
- 依存パッケージだけでなく、agentが読む設定ディレクトリもCIと同等の厳格なコードレビュー対象とすべきという主張を解説する。
English summary
- Configuration directories like `.claude/` and `.vscode/` that AI coding agents read are emerging as a new attack surface for supply chain threats, beyond just npm dependencies.
- The article argues these files deserve the same rigorous code review as CI configuration.
AI coding agentの普及に伴い、開発環境の「設定ファイル」が新たなセキュリティリスクの焦点として浮上しつつある。本記事が取り上げるのは、いわゆる「Mini Shai-Hulud」問題と呼ばれる事例を起点に、`.claude/` や `.vscode/` といったディレクトリがサプライチェーン攻撃の経路になり得るという問題提起だ。
従来のサプライチェーン攻撃といえば、npmやPyPIなどのパッケージレジストリに悪意あるコードを紛れ込ませる手法が主流だった。しかしAI coding agentが広く使われるようになった現在、agentが自律的に読み込む設定ファイル群が新たな攻撃ベクターになる可能性がある。Claude Codeであれば `.claude/` 配下のMARKDOWNファイルやカスタム指示、VS Codeであれば `.vscode/settings.json` や拡張機能の設定などがこれに当たる。
問題の核心は、これらのファイルにagentへの「隠し命令」を埋め込むことが技術的に可能である点だ。たとえば悪意ある依存パッケージがインストール時にプロジェクトの `.claude/` へ不正な指示ファイルを書き込んだ場合、開発者が気づかないままagentがその指示に従って動作するリスクがある。コードそのものではなく、agentの「行動規範」を汚染するという点で、従来の攻撃より発見が難しい側面もある。
この観点から筆者は、`.claude/` や `.vscode/` はもはや単なる個人設定ではなく、`.github/workflows/` などのCIディレクトリと同等のレビュー対象として扱うべきだと主張する。CIの設定ファイルが本番環境に影響するのと同様に、agentの設定ファイルは開発プロセス全体に影響する可能性があるからだ。
AI coding agentが参照する `.claude/` や `.vscode/` などの設定ファイルは、悪意ある指示を埋め込むサプライチェーン攻撃の新たな経路になり得る。
関連する動きとして、Anthropicは既にClaude Codeにおけるpermissionモデルや信頼境界の設計を公開しており、agentが実行できる操作の範囲を明示的に制限する仕組みを設けている。またGitHubのCopilot WorkspaceやCursorなど他のAI coding環境でも、ワークスペース設定の扱い方は各社で異なり、セキュリティポリシーの統一はまだ業界全体の課題として残っている。
チームで開発する際は、`.claude/` や `.vscode/` をgitignoreから外してリポジトリで管理し、変更時にはPRレビューを必須とする運用が現実的な対策として考えられる。AI agentが開発ワークフローに深く組み込まれるほど、その「設定」を管理するガバナンスの重要性は増していくと見られる。
As AI coding agents become a standard part of the development workflow, a subtle but significant security blind spot is emerging: the configuration directories these agents silently read and act upon. A post on Qiita uses the so-called "Mini Shai-Hulud" incident as a springboard to argue that directories like `.claude/` and `.vscode/` deserve the same rigorous review discipline as CI configuration files.
The conventional image of a supply chain attack involves malicious code smuggled into npm or PyPI packages. But AI coding agents introduce a new layer of trust that attackers could exploit. When Claude Code runs in a project, it reads instructions from `.claude/` — markdown files, custom system prompts, and behavioral guidelines. VS Code-based agents similarly consume `.vscode/settings.json` and related workspace configs. A malicious package installed as a dependency could, in principle, write crafted instruction files into these directories during installation, poisoning the agent's behavior without ever touching the application source code itself.
What makes this threat pattern particularly insidious is its indirection. Rather than injecting malicious code that a linter or SAST tool might catch, an attacker would be manipulating the agent's "rules of engagement" — how it interprets requests, which actions it considers safe, and what it's willing to do autonomously. Developers reviewing a pull request are far less likely to scrutinize a markdown file in `.claude/` than a change to a CI workflow.
The author's core argument is that this asymmetry needs to end. Just as `.github/workflows/` files can trigger arbitrary code execution in CI and therefore demand careful review, configuration files read by AI agents can influence the entire development process and should be treated with equivalent seriousness. The practical recommendation is straightforward: stop gitignoring these directories, commit them to the repository, and require pull request review for any changes.
Configuration directories like `.claude/` and `.vscode/` that AI coding agents read are emerging as a new attack surface for supply chain threats, beyond just npm dependencies.
This conversation sits within a broader industry debate about trust boundaries in agentic systems. Anthropic has published details on Claude Code's permission model, which explicitly limits what actions the agent can take and prompts users before crossing certain boundaries. Other environments — GitHub Copilot Workspace, Cursor, Windsurf — each handle workspace-level configuration differently, and there is no cross-industry standard yet for how agent configuration should be audited or secured.
The deeper issue is governance. As AI agents become more autonomous — capable of writing code, running tests, opening pull requests, and interacting with external APIs — the gap between "configure" and "deploy" narrows. A misconfigured or compromised agent configuration file is increasingly close in impact to a compromised CI pipeline. Teams that treat these files as informal scratch space may find themselves exposed in ways that are difficult to detect after the fact.
The takeaway is less about a specific CVE and more about a mental model shift: in an AI-augmented development environment, the surface area that requires security review has expanded beyond source code and infrastructure-as-code to include the instructions that shape agent behavior. Treating `.claude/` as seriously as `.github/workflows/` is a reasonable and low-cost starting point.
本ページの本文・要約は AI による自動生成です。正確性は元記事 (qiita.com) をご確認ください。