Copilot cloud agent is an autonomous agent that has access to your code and can push changes to your repository. This entails certain risks.
Where possible, GitHub has applied appropriate mitigations. This gives Copilot cloud agent a strong base of built-in security protections that you can supplement by following best practice guidance.
Unvalidated code can introduce vulnerabilities
По умолчанию Copilot cloud agent проверяет генерируемый код на предмет проблем безопасности и получает второе мнение по своему коду с Copilot code review. Он пытается устранить проблемы, выявленные до завершения pull request. Это повышает качество кода и снижает вероятность генерации кода, вводя Copilot cloud agent такие проблемы, как жёстко закодированные секреты, небезопасные зависимости и другие уязвимости. Copilot cloud agent's security validation does not require a GitHub Secret Protection, GitHub Code Security, or GitHub Advanced Security license.
- CodeQL is used to identify code security issues.
- Newly introduced dependencies are checked against the GitHub Advisory Database for malware advisories, and for any CVSS-rated High or Critical vulnerabilities.
- Secret scanning is used to detect sensitive information such as API keys, tokens, and other secrets.
- Details about the analysis performed and the actions taken by Copilot cloud agent can be reviewed in the session log. See Сессии управляющих агентов.
Optionally, you can disable one or more of the code quality and security validation tools used by Copilot cloud agent. See Настройка настроек для облачного агента GitHub Copilot.
Copilot cloud agent can push code changes to your repository
To mitigate this risk, GitHub:
- Limits who can trigger the agent. Only users with write access to the repository can trigger Copilot cloud agent to work. Comments from users without write access are never presented to the agent.
- Limits the branch the agent can push to. Copilot cloud agent only has the ability to push to a single branch. When the agent is triggered by mentioning
@copiloton an existing pull request, Copilot has write access to the pull request's branch. In other cases, a newcopilot/branch is created for Copilot, and the agent can only push to that branch. The agent is also subject to any branch protections and required checks for the working repository. - Limits the agent's credentials. Copilot cloud agent can only perform simple push operations. It cannot directly run
git pushor other Git commands. - Requires human review before merging. Draft pull requests created by Copilot cloud agent must be reviewed and merged by a human. Copilot cloud agent cannot mark its pull requests as "Ready for review" and cannot approve or merge a pull request.
- Restricts GitHub Actions workflow runs. By default, workflows are not triggered until Copilot cloud agent's code is reviewed and a user with write access to the repository clicks the Approve and run workflows button. Optionally, you can configure Copilot to allow workflows to run automatically. See Обзор материалов Copilot.
- Prevents the user who asked Copilot cloud agent to create a pull request from approving it. This maintains the expected controls in the "Required approvals" rule and branch protection. See Доступные правила для наборов правил.
- Requires an additional approval when a pull request isn't attributed to a person. When Copilot cloud agent opens a pull request under its own app identity, one more approval is required before it can be merged, as long as the repository already requires at least one approval. This is enabled by default in rulesets, where administrators can turn it off, and always applies to branch protection rules. See Доступные правила для наборов правил.
Copilot cloud agent has access to sensitive information
Copilot cloud agent has access to code and other sensitive information, and could leak it, either accidentally or due to malicious user input.
To mitigate this risk, GitHub restricts Copilot cloud agent's access to the internet. See Настройка или отключение брандмауэра для GitHub Copilot.
AI prompts can be vulnerable to injection
Users can include hidden messages in issues assigned to Copilot cloud agent or comments left for Copilot cloud agent as a form of prompt injection.
To mitigate this risk, GitHub filters hidden characters before passing user input to Copilot cloud agent: For example, text entered as an HTML comment in an issue or pull request comment is not passed to Copilot cloud agent.
Administrators can lose sight of agents' work
To mitigate this risk, Copilot cloud agent is designed to be auditable and traceable.
- Copilot cloud agent's commits are authored by Copilot, with the developer who assigned the issue or requested the change to the pull request marked as the co-author. This makes it easier to identify code generated by Copilot cloud agent and who started the task.
- Copilot cloud agent's commits are signed, so they appear as "Verified" on GitHub. This provides confidence that the commits were made by Copilot cloud agent and have not been altered.
- Session logs and audit log events are available to administrators.
- The commit message for each agent-authored commit includes a link to the agent session logs, for code review and auditing. See Сессии управляющих агентов.
Automations run without a person initiating each task
Automations run Copilot cloud agent automatically, on a schedule or in response to events, without a person initiating each task. See О автоматизациях Copilot. This introduces some additional risks, which GitHub mitigates as follows.
- Work is attributed to the person who created the automation. Pull requests opened and code pushed by an automation are attributed to the user who created the automation. As when that user creates a pull request themselves, they can't approve it, which preserves the expected "Required approvals" controls.
- You control which tools an automation can use. When an automation is triggered by an event, input from untrusted users could become part of the prompt. To limit the impact of prompt injection, you choose exactly which tools an automation can use, so it can only take the actions the task requires.
- Events from untrusted users are ignored by default. Automations ignore events triggered by users without write access to the repository by default, with a setting to opt in.
- Workflows still require human approval. An issue or pull request opened by an automation could trigger another automation. As with all Copilot cloud agent work, GitHub Actions workflows don't run on a pull request until a user with write access approves them, which prevents workflows from running automatically as part of such a chain.