💡
GitHub Copilot Coding AgentのFirewall設定
エラー
I tried to connect to the following addresses, but was blocked by firewall rules:
概要
初期状態では、GitHub Copilot Coding Agentはインターネットに殆どアクセスできない。
FW(ファイアウォール)が設定されており、CopilotとGitHubのやりとりや、依存関係のダウンロードに必要な範囲だけ、アクセスが許可されている。
そこで、どこかの外部のサイトにアクセスが必要な場合は、FWにアクセス許可を追加するか、FWを無効にする必要がある。
設定方法
FWにアクセス許可を追加するには、COPILOT_AGENT_FIREWALL_ALLOW_LIST_ADDITIONS
に、カンマ区切りでドメイン名やURLを記入すればOK。
なのだが、それをどこに書けば良いかが、とても分かり辛い。
Copilot coding agentは、GitHub Actionsで動いているようで、GitHubActionsの設定としても設定できるし、github.comのSettingsでも設定できるらしい。
github.com の Settings で設定
手っ取り早く、github.com の Settings で設定する場合は下記の手順で追加できる。
- github.com のリポジトリのページ
- 右上の「Settings」
- 左の「Environments」
- 「copilot」
- 「Environment variables」の「Add environment variable」
- Nameに「COPILOT_AGENT_FIREWALL_ALLOW_LIST_ADDITIONS」を、Valueに許可したいドメインやURLを「,」区切りで入力
- 「Add variable」
copilot-setup-steps.yml
で設定
もし、Copilot coding agent の実行環境を .github/workflows/copilot-setup-steps.yml
でカスタマイズしているなら、envの部分を下記のように書けばOK。
env:
COPILOT_AGENT_FIREWALL_ALLOW_LIST_ADDITIONS: 許可したいドメインやURLを「,」区切りで記述
参考
詳しくは下記を参照。なお、FWを無効にすることもできるが、自由度高くて何をしでかすか分からず危険なのでお勧めしないらしい。
- https://docs.github.com/ja/enterprise-cloud@latest/copilot/customizing-copilot/customizing-or-disabling-the-firewall-for-copilot-coding-agent
- https://docs.github.com/ja/enterprise-cloud@latest/copilot/customizing-copilot/customizing-the-development-environment-for-copilot-coding-agent
- https://docs.github.com/ja/enterprise-cloud@latest/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#creating-configuration-variables-for-a-repository
- https://dev.classmethod.jp/articles/github-actions-configuration-variables-vs-environment-variables/
Discussion