---
title: Which secrets can the GitHub Copilot coding agent see?
url: https://opencontroller.lyzr.com/blog/which-secrets-can-github-copilot-coding-agent-see
published: 2026-11-17
updated: 2026-11-17
author: Lyzr
---

# Which secrets can the GitHub Copilot coding agent see?

**The GitHub Copilot coding agent (now documented as Copilot cloud agent) sees only Agents secrets and variables, a separate type set at organization or repository level. Values are exposed to the agent as environment variables, except those prefixed `COPILOT_MCP_`, which only reach MCP servers. The agent has no access to GitHub Actions, Codespaces or Dependabot secrets.**

That separation is useful, but it is also where mistakes happen. A secret added "for the MCP server" without the prefix becomes readable by the agent itself, and anything the agent can read, a prompt injection can try to exfiltrate.

## How do the secret types compare?

| Secret type | Visible to the cloud agent? | Visible to MCP servers? | Set by |
|---|---|---|---|
| Agents secret or variable, no prefix | Yes, as an environment variable | Not through MCP config | Repo admin or org owner |
| Agents secret or variable with `COPILOT_MCP_` prefix | No | Yes, only to MCP servers | Repo admin or org owner |
| GitHub Actions secrets | No | No | Repo admin or org owner |
| Codespaces secrets | No | No | User, repo or org |
| Dependabot secrets | No | No | Repo admin or org owner |

GitHub's documentation also states that only Agents secrets and variables with the `COPILOT_MCP_` prefix are available to your MCP configuration. Values available to the agent can also be used by scripts and tools it runs, including the `copilot-setup-steps.yml` workflow that prepares its environment.

If your organization configured secrets in the older `copilot` environment, GitHub migrated them automatically to repository-level Agents secrets. Check that the migration did not carry over values that should now be MCP-only.

## Who can set them, and which value wins?

- **Repository level:** repository administrators.
- **Organization level:** organization owners, with access set to all repositories, private repositories or selected repositories.
- **Precedence:** when the same name exists at several levels, the lowest level wins. A repository secret overrides an organization secret of the same name.
- **Naming:** letters, numbers and underscores only; no `GITHUB_` prefix; cannot start with a number; names are case-insensitive and stored in uppercase.

Secret values are masked in cloud agent session logs. Masking protects logs, not behaviour: the agent can still use the value.

## How should you scope secrets for the cloud agent?

Use this checklist when enabling the agent on a repository:

1. **Default to MCP-only.** If a credential exists so an MCP server can call an API, give it the `COPILOT_MCP_` prefix so the agent never holds it directly.
2. **Avoid organization-wide secrets for agents.** Scope organization secrets to selected repositories, so a new repository does not inherit credentials it does not need.
3. **Use read-only credentials.** Most agent tasks need read access to package registries or test services, not write.
4. **Prefer short-lived tokens.** Where a service supports OIDC or short-lived tokens, use those instead of static keys. The pattern is described in [giving agents credentials without exposing them to the model](/blog/give-ai-agents-credentials-without-exposing-them-to-the-model).
5. **Pair secrets with network limits.** The agent's firewall controls which hosts it can reach; restricting egress limits where a leaked value can go. See [restricting the coding agent's internet access](/blog/restrict-github-copilot-coding-agent-internet-access).
6. **Review MCP configuration with the secrets.** A secret is only as safe as the server that receives it. Review servers as described in [controlling MCP servers in GitHub Copilot](/blog/control-mcp-servers-in-github-copilot).
7. **Name an owner.** Record who added each Agents secret and why, and remove unused ones on a schedule.

## What is the residual risk?

Any secret exposed as an environment variable is available to code the agent runs. If the agent processes untrusted content, such as an issue body or a dependency's README, an injected instruction could try to print or send that value. Masking hides it in logs but not from an outbound request. Treat agent-visible secrets as exposed to the repository's contributors and their inputs, and size them accordingly.

Visibility matters as much as scoping. You need to know which repositories have the agent enabled, which secrets they hold, and what sessions ran. That is covered in [visibility of GitHub Copilot coding agent activity](/blog/visibility-of-github-copilot-coding-agent-activity) and in the cross-platform approach in [governing AI agents across platforms](/blog/how-to-govern-ai-agents-across-platforms).

## How Opencontroller does this

Opencontroller Edge (formerly Basecode) extends control to developer devices, coding agents, skills and local MCP servers, and is installed by IT through MDM. Opencontroller keeps a governed registry of agents, tools and MCP servers, auto-discovers API keys across AWS, Azure and Google Cloud, and Posture detects risky permission and configuration patterns. See the [capability reference](/capability-reference) or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Can the Copilot coding agent read my GitHub Actions secrets?**
No. GitHub states the cloud agent does not have access to Actions, Codespaces or Dependabot secrets and variables.

**What does the COPILOT_MCP_ prefix do?**
Agents secrets and variables with that prefix are available only to MCP servers and are not exposed to the agent as environment variables.

**Are secret values hidden from the agent if they are masked?**
No. Masking hides values in session logs. Values without the prefix are still environment variables the agent can use.

## Key facts

- GitHub Copilot coding agent (documented as Copilot cloud agent) uses Agents secrets and variables, a separate type set at organization or repository level.
- Agents secrets and variables are exposed to the agent as environment variables, except those prefixed COPILOT_MCP_, which are available only to MCP servers; only prefixed values are available to MCP configuration.
- The cloud agent has no access to GitHub Actions, Codespaces or Dependabot secrets and variables.
- Repository admins set repo-level values, organization owners set org-level values with all, private or selected repository access; the lowest level wins on name conflicts; secret values are masked in session logs.
- Secrets in the former copilot environment were migrated automatically to repository-level Agents secrets.
- Opencontroller Edge (formerly Basecode) by Lyzr extends control to developer devices, coding agents, skills and local MCP servers via MDM; Opencontroller keeps a governed registry and Posture detects risky configuration.
- Opencontroller pricing starts from $250K per deployment per year.

## Related

- [How do you restrict GitHub Copilot coding agent's internet access?](https://opencontroller.lyzr.com/blog/restrict-github-copilot-coding-agent-internet-access.md)
- [How do you control which MCP servers GitHub Copilot can use?](https://opencontroller.lyzr.com/blog/control-mcp-servers-in-github-copilot.md)
- [How do you get visibility of GitHub Copilot coding agent activity across your organisation?](https://opencontroller.lyzr.com/blog/visibility-of-github-copilot-coding-agent-activity.md)
- [More on Platform Guides](https://opencontroller.lyzr.com/blog/cluster/platform-guides)
