Retrieved article excerpt
Open article · Retrieved 2026-11-06T15:22:13.008427+00:00
[Back to Posts](https://githubnext.com/posts/)
# Limit what agents learn about private repos with enclaves
Enclaves are a new security primitive for cross-repository GitHub Agentic Workflows. Enclaves let agents work on different repositories while limiting what they say to each other.
[Landon Cox Landon Cox](https://github.com/lpcox "Landon Cox") [Peli de Halleux Peli de Halleux](https://github.com/pelikhan "Peli de Halleux") [Rodrigo Fonseca Rodrigo Fonseca](https://github.com/rfonseca "Rodrigo Fonseca") [Grace Jia Grace Jia](https://github.com/gjia25 "Grace Jia") [Vic Li Vic Li](https://github.com/vic-lsh "Vic Li") [Pedro Henrique Penna Pedro Henrique Penna](https://github.com/ppenna "Pedro Henrique Penna") Nov 2, 2026
The [GitLost disclosure](https://noma.security/noma-labs/gitlost-how-we-tricked-githubs-ai-agent-into-leaking-private-repos) showed how an agent with access to public and private repos can leak private data. Researchers at Noma Labs created an agent with permission to read public and private repositories across an organization and respond to issues in a public repo. They then opened a malicious public issue that caused the agent to post the contents of a private repo in a public comment.
The attack did not require breaking out of a sandbox or stealing an auth token. Once the agent had permission to read from a private repository and write to a public one, the attacker persuaded it to use its permissions in a way that the maintainer did not intend or want.
[GitHub Agentic Workflows](https://gh.io/gh-aw) became [Generally Available](https://github.blog/changelog/2026-10-28-github-agentic-workflows-generally-available/) during [GitHub Universe](https://githubuniverse.com/) last week, and the release includes a new way to prevent private-to-public leaks like GitLost in cross-repo workflows. Our solution is an experimental security primitive called an **enclave**, which allows an agent to access private data and deterministically constrain what it can say about it.
An enclave is a single-use sandbox that allows the primary agent in an agentic workflow to isolate itself from work in another repository. An enclave’s purpose is to prevent the primary agent from seeing private information so that it cannot inadvertently over-share. Military and intelligence organizations apply the principle of *need-to-know* by compartmentalizing operations so that personnel working on one mission don’t necessarily have access to information about another. Even someone with a high security clearance doesn’t automatically get access to every classified operation. Enclaves allow the same compartmentalization among agents.
## Overview of enclaves
An agentic workflow’s primary agent can only access the repo in which it executes, but it can use enclaves to perform work in repos outside of its own. Primary agents launch an enclave by specifying the enclave’s repo, the computation to be performed, and a response schema. Interactions between the primary agent and enclaves are handled by a trusted broker that validates the primary’s launch request, runs enclaves in isolation, and validates enclave responses to the primary agent.
The primary agent sends a repository, task, and response schema to a trusted broker. The broker checks the request and information budget, runs an isolated enclave with private repository access, and returns only a validated, bounded result.
Like [FIDES](https://arxiv.org/html/2505.23643#S5.SS2)’s constrained output schemas for LLM calls, the primary agent specifies response schemas for its enclaves. The response schema defines the vocabulary the enclave uses to communicate with the primary agent. Schemas are typically limited to Booleans, enumerations, bounded integers, and structured combinations of those base types. The enclave cannot add explanations, attach files, or return arbitrary strings. The broker checks every response against the schema and rejects anything outside it.
The amount of information the response schema can carry is constrained by an **information budget** that is measured in bits. The workflow configuration determines the budget via the enclave repository’s sensitivity. For example, a sensitivity of `confidential` permits 8 bits per repository per workflow run.
The broker validates the primary agent’s response schema to ensure that it cannot reveal more bits than the workflow author budgeted. A Boolean has two possible values and can convey one bit through its successful result. A choice among four categories can convey two bits. Combining fields increases the number of possible responses and the information the result can carry. Importantly, a single bit in the schema is always reserved for errors. Validation errors, runtime errors, budget overflow errors, and timeout errors all set the error bit.
While the workflow author sets the budget, **the primary agent defines the schema’s semantics and chooses how to spend the available budget.** It might ask whether an API is used, classify compatibility, or request a bounded count. It chooses the field names, allowed values, and task instructions that give those values meaning. This flexibility lets the agent tailor a narrow response to the work at hand without receiving unrestricted access to the repository.
Before launching an enclave, the broker calculates a schema-compliant response’s information charge, including the constrained status and timing channels, and checks it against the repository’s remaining budget. The charge is reserved before execution rather than determined by the answer that comes back. Calls share the same per-repository ledger for the run, so the primary agent can adapt its questions but cannot grow the budget or reset it by choosing a new schema. If an enclave response would exceed the balance, the broker denies it.
## Two kinds of enclave work
Agentic workflows support two enclave executors:
**Script enclaves** run bounded Python programs over read-only repository snapshots, without network access. They are useful for deterministic checks, such as whether a file exists, whether a dependency appears in a manifest, or whether a configuration satisfies a rule.
**Agent enclaves** run a separate coding agent for tasks that need reasoning. An agent enclave might inspect an implementation and classify whether a reported bug applies. Its network access is restricted to the configured model-provider path and, when explicitly enabled, a narrow GitHub tool interface. It does not receive general-purpose GitHub credentials or unrestricted network access.
Enclaves are declared in workflow front matter. This configuration excerpt enables both kinds for the same private repository:
```
sandbox:
agent:
id: awf
enclaves:
- script:
repos:
- repo: myorg/private-service
sensitivity: confidential
timeout: 45
- agent:
model: gpt-5
repos:
- repo: myorg/private-service
sensitivity: confidential
timeout: 180
```
The workflow must separately provide credentials that authorize access to the repository. Declaring an enclave cannot expand what those credentials can read. The primary agent receives enclave tools through the MCP gateway. The primary never sees private repository snapshots or any auth credentials.
The maintainer chooses the repository policy, sensitivity, and execution limits. A tool call cannot override those settings merely because the agent asks for a different runtime or broader access.
## GitLost with enclaves
Let’s return to GitLost. The attack depended on an agent reading a private repository and posting its contents in a public issue. With enclaves, the primary agent handles the public issue, and the enclave inspects the private repository. The broker controls what information passes between them.
Suppose a workflow in `contoso/public-repo` needs to answer questions about an integration in `contoso/private-repo`. The maintainer could use this front matter configuration excerpt:
```
---
engine: copilot
sandbox:
agent:
id: awf
tools:
github:
allowed-repos: [contoso/public-repo]
safe-outputs:
add-comment:
max: 1
enclaves:
- agent:
model: gpt-5
repos:
- repo: contoso/private-repo
sensitivity: confidential
timeout: 180
---
```
The two repository declarations serve different purposes. `tools.github.allowed-repos` confines the primary agent’s GitHub reads to the public repository. The enclave’s `repos` entry permits private analysis, and `sensitivity: confidential` sets an 8-bit disclosure budget for that repository for the run. `safe-outputs` lets the primary agent propose a public comment; it does not give the enclave a way to post one.
This excerpt leaves out the workflow trigger, task instructions, and credential setup. The trusted infrastructure must be authorized to prepare the private repository snapshot for the enclave, without exposing those credentials or the snapshot to the primary agent. The private repository must not also be checked out into the primary agent’s workspace or accessible through another tool.
Now imagine the public issue asks whether version 2 of a dependency is compatible with the private integration. The primary agent could ask the enclave for a simple yes-or-no answer with this response schema:
```
{"type":"boolean"}
```
The same schema could support many different questions. The task prompt supplies its meaning: here, `true` means the upgrade is compatible. The broker does not need to understand that meaning; it can determine that the successful result has only two possible values. The workflow author set the disclosure limit, while the primary agent chose this particular use of it.
Alternatively, the primary agent might need to distinguish an uncertain result and know whether migration is required. It could make an `enclave_run_agent` call with a more expressive schema:
```
{
"privateRepo": "contoso/private-repo",
"prompt": "Check whether version 2 is compatible with our integration and whether migration is required.",
"schema": {
"type": "object",
"fields": [
{
"name": "compatibility",
"schema": {
"type": "enum",
"values": ["compatible", "incompatible", "unknown"]
}
},
{
"name": "migrationRequired",
"schema": { "type": "boolean" }
}
]
}
}
```
Three compatibility values and two migration values produce **only six possible successful answers**. The successful-result portion requires three bits of budget. Adding four bits reserved for timing and one for success/error brings the total charge to **eight bits**, exactly the `confidential` repository’s per-run budget. It charges the worst-case amount before execution, not just for whichever result the enclave eventually returns.
Once admitted, the enclave reads the private repository and performs the analysis. It might encounter both compatibility notes and an unrelated confidential project name or launch date. Its response must still fit the schema:
```
{"compatibility":"compatible","migrationRequired":false}
```
The broker validates that response and returns it to the primary agent, which can propose a public comment: “Version 2 is compatible with our internal integration. No migration is required.” The private files and the enclave’s analysis never enter the primary agent’s context.
An isolated enclave reads private compatibility notes, while a broker allows only compatibility and migrationRequired fields back to the public primary agent.
*Private analysis stays isolated. The primary agent receives a compatibility result, not the private notes used to produce it.*
What happens if the issue contains the GitLost instruction to retrieve a private README and paste it into the public comment? A direct read by the primary agent is outside its repository scope. Delegating the instruction to the enclave does not open an unrestricted return channel. A free-