|
| 1 | +--- |
| 2 | +title: 'Building guardrails for GitHub Copilot cloud agent' |
| 3 | +shortTitle: 'Build guardrails' |
| 4 | +intro: 'Configure your enterprise so that {% data variables.copilot.copilot_cloud_agent %} will operate in a secure, compliant environment.' |
| 5 | +versions: |
| 6 | + feature: copilot |
| 7 | +contentType: tutorials |
| 8 | +category: |
| 9 | + - Roll Copilot out at scale |
| 10 | + - Manage Copilot for a team |
| 11 | +--- |
| 12 | + |
| 13 | +Before you enable {% data variables.copilot.copilot_cloud_agent %}, it is good practice to set up your enterprise so you can be confident {% data variables.product.prodname_copilot_short %} will operate within secure, predictable guardrails. |
| 14 | + |
| 15 | +## Learn about built-in protections |
| 16 | + |
| 17 | +{% data variables.copilot.copilot_cloud_agent %} has a strong base of built-in security protections designed to protect against common risk points of AI agents. See [AUTOTITLE](/copilot/concepts/agents/coding-agent/risks-and-mitigations). |
| 18 | + |
| 19 | +## Plan policy settings |
| 20 | + |
| 21 | +Plan your policies for {% data variables.copilot.copilot_cloud_agent %} in advance. Policies allow you to set a baseline for restrictions at the enterprise level, which organization owners can restrict further if needed. |
| 22 | + |
| 23 | +Some questions to ask are: |
| 24 | + |
| 25 | +* Which organizations and repositories will {% data variables.copilot.copilot_cloud_agent %} be enabled in? See [AUTOTITLE](/copilot/concepts/agents/coding-agent/access-management). |
| 26 | +* Which MCP servers will you configure to give {% data variables.copilot.copilot_cloud_agent %} access to external tools? See [AUTOTITLE](/copilot/how-tos/use-copilot-agents/cloud-agent/extend-cloud-agent-with-mcp). |
| 27 | + |
| 28 | +### Which policies don't apply? |
| 29 | + |
| 30 | +The following {% data variables.product.prodname_copilot_short %} policies don't apply to {% data variables.copilot.copilot_cloud_agent %}: |
| 31 | + |
| 32 | +* Content exclusions |
| 33 | +* Custom models (providing your own LLM API keys) |
| 34 | +* Private MCP registries |
| 35 | + |
| 36 | +## Adapt rulesets |
| 37 | + |
| 38 | +{% data variables.copilot.copilot_cloud_agent %} is already restricted from actions like pushing to a default branch or merging pull requests. You can build on these default protections in branch rulesets. {% data variables.copilot.copilot_cloud_agent %} is subject to rulesets just like human developers. |
| 39 | + |
| 40 | +To adapt your rulesets for {% data variables.copilot.copilot_cloud_agent %}: |
| 41 | + |
| 42 | +* **Consider whether additional rules are required** in repositories where agents will operate, such as requiring results from {% data variables.product.prodname_code_scanning %} or {% data variables.product.prodname_code_quality_short %}. If you have identified the organizations or repositories where {% data variables.copilot.copilot_cloud_agent %} will be enabled, you can apply a custom property to them so they're easy to target in a ruleset. |
| 43 | +* **Consider whether {% data variables.copilot.copilot_cloud_agent %} will be blocked** by any of your existing rulesets. {% data variables.product.prodname_copilot_short %} _can_ sign its commits, but it may not be able to follow other rules that restrict commit metadata. |
| 44 | +* **Protect important {% data variables.product.prodname_copilot_short %} and MCP configuration files** with a `CODEOWNERS` file, and enable the "Require review from Code Owners" rule, so that edits to these files must be approved by specific teams. For filepaths to target, see [AUTOTITLE](/copilot/reference/customization-cheat-sheet). |
| 45 | + |
| 46 | +## Set up your {% data variables.product.prodname_actions %} environment |
| 47 | + |
| 48 | +{% data variables.copilot.copilot_cloud_agent %} operates on {% data variables.product.prodname_actions %} runners. Set up your runners and policies so that {% data variables.product.prodname_copilot_short %} operates securely. |
| 49 | + |
| 50 | +### Store data and secrets |
| 51 | + |
| 52 | +Continue to store data and tokens that you _don't_ want {% data variables.product.prodname_copilot_short %} to access as **{% data variables.product.prodname_actions %} variables or secrets**. {% data variables.product.prodname_copilot_short %} won't be able to access these in its sessions or environment setup steps. |
| 53 | + |
| 54 | +If you need to provide data and secrets that {% data variables.copilot.copilot_cloud_agent %} _does_ need, you'll be able to do this in a specific `copilot` environment. |
| 55 | + |
| 56 | +### Configure runners |
| 57 | + |
| 58 | +Decide which runners you will use for {% data variables.copilot.copilot_cloud_agent %}. We recommend using **{% data variables.product.github %}-hosted runners**, so that each {% data variables.copilot.copilot_cloud_agent %} runs on a fresh virtual machine. If you use self-hosted runners, we recommend using ephemeral runners. |
| 59 | + |
| 60 | +Organization owners can restrict the {% data variables.copilot.copilot_cloud_agent %}'s runners to a specific runner label, to be used automatically in all repositories. See [AUTOTITLE](/copilot/how-tos/administer-copilot/manage-for-organization/configure-runner-for-coding-agent). |
| 61 | + |
| 62 | +### Configure workflow policies |
| 63 | + |
| 64 | +Decide whether **{% data variables.product.prodname_actions %} workflows should be blocked from running** in pull requests that {% data variables.copilot.copilot_cloud_agent %} creates. See [AUTOTITLE](/copilot/how-tos/use-copilot-agents/coding-agent/configuring-agent-settings#allowing-github-actions-workflows-to-run-automatically-when-copilot-pushes). |
| 65 | + |
| 66 | +By default, workflows are blocked from running until someone with write access approves them. Repository administrators will be able to disable this feature, so communicate with them in advance about your preferred setting. |
| 67 | + |
| 68 | +### Review default permissions |
| 69 | + |
| 70 | +Review the default permissions for the `GITHUB_TOKEN` in your enterprise. See [AUTOTITLE](/enterprise-cloud@latest/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#workflow-permissions). |
| 71 | + |
| 72 | +This policy does **not** affect the token that {% data variables.product.prodname_copilot_short %} will receive for its sessions, but the `GITHUB_TOKEN` _is_ used in environment setup steps defined in `copilot-setup-steps.yml` workflow files. |
| 73 | + |
| 74 | +Bear in mind that developers will be able to set their own `permissions` in these workflow files, and you should encourage them to use the minimum required permissions in all workflows. |
| 75 | + |
| 76 | +## Next steps |
| 77 | + |
| 78 | +When you're ready to enable {% data variables.copilot.copilot_cloud_agent %}, see [AUTOTITLE](/copilot/how-tos/administer-copilot/manage-for-enterprise/manage-agents/manage-copilot-coding-agent). |
0 commit comments