Overview
Your project holds secrets of its own: .env files, private keys, API tokens. co:op keeps them
out of the box in three ways:
- Secret files stay hidden. The box can't read
.env, private keys or the files you list in.coopignore. coop secrets findfinds secrets left inside ordinary files.coop secrets addlets your app use an API token while the box holds only a fake value.
coop doctor checks that hiding works on your computer. See
what it checks.
Secrets inside files
co:op hides whole files, so a token pasted into an ordinary file stays readable.
coop secrets find scans for known provider tokens, private keys and long random values assigned
to variables like API_KEY or PASSWORD. It reports each finding as file:line and exits 1 when
it finds one, so it works before a run and in CI:
Shell examples
coop secrets find
coop secrets find --include-ignored # also files Git ignores
The report never shows a value. In a project that hides config/stripe.live.json with
.coopignore, the scan still reports the key in it:
✗ 1 possible secret found
config/stripe.live.json:2
Stripe key
Hidden from the box, but Git would commit this file.
Remove real secrets from files you intend to commit.
If this is a false positive, add this entry to .coopsecretsignore
and replace <reason> with an explanation:
# config/stripe.live.json — Stripe key
fp-v1:01e7bb5857e09cfa0f03f0785ddbaed4cd8c0c11945566069d0709fc0df27dd4 # <reason>
- The default scan reads the files Git would commit, hidden ones included, because hiding a file
from the box doesn't stop you from committing or pushing it. It also reads co:op's Git-ignored
task files and notes under
.agent/. --include-ignoredadds the other Git-ignored files the box can read, except those in dependency and build folders such asnode_modules,vendoranddist.- If the scan can't read a file, it fails, so a permission error can't produce a clean result.
If it can't open a folder, the default scan warns that the files Git doesn't track in that
folder weren't checked, and
--include-ignoredfails. - The command also lists changed files that can run commands on your machine, such as commit
hooks, editor or agent settings, Compose files and the Makefile. With
--include-ignoredit also lists such files that Git ignores, like.claude/settings.local.json. Read them before you run anything. This list never changes the exit code.
After a change to the Makefile, for example, the scan ends with:
Review files that run commands
Makefile
Runs when you use make.
Read these changes before running your tools.
For a false positive you've reviewed, copy the entry the scan prints into .coopsecretsignore at
the project root and replace <reason> with your reason. Here a test fixture holds an expired
token:
# test/fixtures/expired-session.json — JWT
fp-v1:f144933b669bf2af2af27f0cb621255d178e6762edc3c6f6fa7216f88d0f3b8b # expired test token
The next scan passes:
✓ No new possible secrets found
1 finding ignored by .coopsecretsignore.
An entry without a reason, or with <reason> left in, stops the scan with the line to fix. The
entry identifies that exact finding without storing the secret. Adding a line above the finding
doesn't invalidate the entry, but changing the value or moving the file does. The entry applies
only to this command: fork merges, checkpoint uploads and session redaction still check every
finding.
API secrets
When the app you're building needs a real API token, such as GH_TOKEN for GitHub, save it with
coop secrets add instead of keeping it in a file. Inside the box, the GH_TOKEN environment
variable is set to a fake value. co:op replaces it with the real token in the request headers, but
only on requests you approved. An agent that prints the variable, or sends it anywhere else,
reveals only the fake value.
Example: gh api
Say your scripts read issues with gh api. Save the token once, followed by every host it may be
sent to:
Shell examples
coop secrets add GH_TOKEN api.github.com
Type or paste the value at the prompt:
GH_TOKEN:
✓ Saved GH_TOKEN for api.github.com
List the requests it may be used for in .agent/project.yaml, then run coop approve:
box:
secrets:
GH_TOKEN:
- GET https://api.github.com/**
co:op saves the value in ~/.config/coop/secrets.json, which no box can mount. A project can't
add hosts to that list. The printed line allows every GET request to the API. Narrow it to the
requests your scripts make, and approve them:
YAML
box:
secrets:
GH_TOKEN:
- GET https://api.github.com/repos/acme/app/**
Shell examples
coop approve
Now gh works in the box as usual. It sends the fake value in its Authorization header, and
co:op replaces that with the real token because the request matches the approved line:
Shell examples
coop run -- gh api repos/acme/app/issues --jq '.[].title'
The variable holds only the fake value:
Shell examples
coop run -- sh -c 'echo $GH_TOKEN'
coop_decoy_GH_TOKEN_…
co:op refuses a request that isn't on the list, such as gh api -X DELETE repos/acme/app, with a
403 that shows the line to add.
gh isn't in co:op's base image. Add it to your
.agent/Dockerfile (apt-get install gh on the Debian
base) and run coop build.
Push over HTTPS
Git in the box can push to github.com with a saved token. Save the token for github.com, list
the two requests a push makes, and run coop approve:
Shell examples
coop secrets add GH_TOKEN github.com
YAML
box:
secrets:
GH_TOKEN:
- GET https://github.com/acme/app.git/info/refs
- POST https://github.com/acme/app.git/git-receive-pack
co:op sets a Git credential helper for https://github.com in the box. The helper answers with
the user x-access-token and the fake value, and co:op replaces the fake value with the token on
these two requests. To fetch with the token too, add
POST https://github.com/acme/app.git/git-upload-pack. The paths follow the remote URL, so use an
https://github.com/acme/app.git remote. We recommend a fine-grained token limited to that
repository, with Contents write, so the token can't change anything else in your account.
The helper works for github.com only. Keep the Git lines for github.com under one secret. When two secrets have them, Git gets no credential.
Which requests a line allows
Each line is a method and an https URL. The method is GET, HEAD, POST, PUT, PATCH,
DELETE, OPTIONS or ANY. A line matches any query string:
| Line | Allows |
|---|---|
GET https://api.github.com/repos/acme/app |
GET and HEAD requests to that path |
POST https://api.github.com/repos/acme/*/issues |
POST requests where * is one path segment, such as web |
GET https://api.github.com/repos/acme/app/** |
GET and HEAD requests to that path and every path below it |
ANY https://api.github.com/** |
every GitHub API request, with any method |
GET https://*.example.com/** |
GET and HEAD requests to one label under example.com, such as eu.example.com, as in network rules. Save the secret for *.example.com too. |
A project can list up to 16 secrets, 64 lines per secret and 32 hosts in total.
coop approve records each secret's requests with the project's network approval. After you
change the list, filtered and open runs don't start until you approve it again. Offline runs don't
use secrets. A remote session gets its secrets from its controller. See
the session API.
Change or delete a saved secret
Shell examples
coop secrets # names, hosts and use
coop secrets add GH_TOKEN api.github.com # a new value and hosts
coop secrets rm GH_TOKEN
coop secrets shows each secret's hosts, never its value, and how runs on this machine used it:
how many requests carried it, when the last one did, and how many requests co:op refused. Saving
a name again replaces its value and hosts.
coop secrets rm asks first, because co:op can't show or restore the value. Running boxes keep
the value until they stop. A project that still lists the secret in box.secrets doesn't start
until you save the secret again, or remove it from box.secrets and run coop approve.
What happens to a request
In filtered and open runs, co:op's broker reads every request the box sends to a host listed in
box.secrets. Clients reach the broker in two ways: the box's /etc/hosts points each exact host
at it, and clients that use the box's HTTPS_PROXY are sent there too. co:op adds the run's
certificate to the box's system certificate list and points Python's requests at it.
- If a request carries the fake value in a header and a line approves it, the broker sends it
with the real value. In the
Authorizationheader, the broker also replaces a fake value inside a base64 token, such as Basic auth. - If no line approves it, the broker refuses the request with a 403 that shows the line to add.
In a filtered run,
coop net blockedlists the refusal. - A request without the fake value is sent when a line matches it or the run may reach the host anyway. In a filtered run, a line allows its requests without a network rule.
- In a response, the broker replaces the real value with the fake value, and a re-encoded
Authorizationtoken with the one the box sent. Range requests are sent without their range, so a value can't come back in pieces.
The fake value stays the same for one project on one machine, so a token your app saved in its development data keeps working.
What it doesn't cover
- The broker replaces the fake value only in headers. A token sent in a URL or a request body arrives as the fake value.
- A signed request, such as AWS SigV4, is computed from the secret, so the fake value can't sign it.
- A WebSocket or other upgraded connection can't use a secret. A response that co:op can't decompress is refused when its request used a secret, because co:op can't check it for the real value.
- Project services don't get API secrets.
/etc/hostscan't hold a wildcard host such as*.github.com, so only clients that useHTTPS_PROXYreach the broker for it. For Node's built-infetch, setNODE_USE_ENV_PROXY: "1"inbox.env.- Point clients that ship their own certificate list, such as Java or Elixir's CAStore, at
/etc/ssl/certs/ca-certificates.crt. An image that isn't built on co:op's base image keeps its system list unchanged, so point clients at$SSL_CERT_FILEthere. - In an open run of a project that lists port 443 in
serve.ports, the box keeps that port, so its secret hosts are reached only throughHTTPS_PROXY. - A response that repeats the real value in another encoding, such as hex, reaches the box.
- A run refuses a secret for a host that its agent signs in to, such as
api.openai.comin a Codex run. Other agents' runs can use it, and a host an agent only downloads from is allowed. - The agent can still do everything the approved requests allow, so give the token only the access your app needs.
How hiding works
co:op hides files in one of two ways. eBPF protection denies access to a hidden file in the kernel. Mount protection mounts an empty read-only file or folder over it. co:op uses eBPF protection when all of these hold, and mount protection otherwise:
- The box runs on Docker, without rootless mode or user-namespace remapping, and without container options that conflict with the protection.
- The project is on APFS on a Mac, where the Docker VM enforces the rules, or on ext4 or xfs on Linux.
- Docker uses cgroup v2 with the
cgroupfsorsystemdcgroup driver. Withsystemd, co:op asks systemd over the system bus for the cgroups that hold its boxes. - The kernel runs the BPF security module (BPF LSM) and has every file hook the filter attaches
to. Recent kernels such as Fedora 44's do, and older ones such as RHEL 10's 6.12 don't. If the
module is off, add
bpfto thelsm=boot parameter.
coop doctor reports why a project gets mount protection, and tries to read test secrets in a
real box. A launch doesn't test the protection, so run coop doctor after you update Docker or
OrbStack. co:op builds the eBPF helper inside Docker, so you don't install any packages on the
host.
What the box sees with eBPF protection
With eBPF protection, the box can't read or change a secret, including through another letter
case, an equivalent Unicode spelling, a symlink or an existing hardlink. Each attempt returns
Operation not permitted. The box also can't connect to a Unix socket in a hidden folder, such as
one another container serves from the project. Public files stay writable, ordinary public
hardlinks work, and .coopignore is readable but can't be changed.
Some tools stop at that error, such as Terraform when it opens terraform.tfvars. To keep them
working, each hidden file that exists when the box starts, up to 1,000 per launch, shows up as an
empty read-only file instead. In a Git repository, only Git-ignored files do, because an agent's
git add -A would commit a tracked or new file as empty. So add your secrets to .gitignore. The
box can't delete or rename a folder that holds one of these files.
stat works on the other hidden files, so find and tools that list a folder keep working:
| On a hidden path | Result |
|---|---|
stat on a file |
the file's real size, times, mode, owner and link count |
| extended attributes of a file | read as empty |
readlink on a symlink |
fails |
stat on a folder, or on anything inside it |
fails |
ls -l in the folder's parent |
shows the folder's entry with an error |
The filesystem protection contract says how eBPF protection treats files that you create or edit after the box starts.
Tools that scan the project
For tools that scan the repository, co:op sets COOP_BOX=1 inside the box. When it is set:
- Skip paths that return a permission error (
EPERMorEACCES) on metadata lookup, folder traversal or file reads, including a denied folder's subtree. - Treat a denied path as unreadable, not as an empty file.
- Report the skipped paths, so the result shows which files were checked, and keep reporting other errors.
A successful stat, or a path in the list of tracked files, doesn't mean the contents can be read.
The box has no list of hidden paths, so handle the filesystem error instead of reproducing the
hiding rules.
What the box sees with mount protection
With mount protection, stat on a secret shows the size and times of the empty file or folder,
not the real ones. On a case-insensitive disk, co:op also mounts an empty file over every
uppercase and lowercase spelling of a hidden filename with up to 11 letters, and over every
spelling of .coopignore.
Mount protection hides only what exists when the agent or service starts. A secret you create on
the host later at a public path, such as a new late.pem or .env.local, is readable in that box
until it restarts. A file created inside an already hidden folder is not, because the box sees
only the empty folder. So create secrets before you start an agent, keep them in a hidden folder
such as secrets/, or restart the agent after you add one. The box can't rename a hidden folder.
It can rename a folder that holds a hidden file, and the file stays hidden at its new path.
When mount protection can't cover a filename
A filename with more than 11 letters or a non-ASCII letter, or a project with too many spellings in total, exceeds what co:op can mount. The box or service could then read the file under another letter case, so co:op refuses to start the agent or service. To fix it, either:
- move the file into a hidden folder, or
- run
coop approve --case-exposureto review the listed files and accept that they stay readable under another letter case with mount protection. Plaincoop approvereviews network access and doesn't accept any file exposure.
The approval applies to those exact paths, including their future contents, for new agent and
service runs. A newly exposed path needs another approval, and running boxes don't change.
.coopignore can't be approved this way. COOP_ALLOW_CASE_EXPOSED_SECRETS=1 exposes the files
for a single run. With eBPF protection, these files stay hidden and need neither.
Filesystem protection contract
This contract describes eBPF protection. Mount protection hides only what exists at start, as described above, and a launch that uses it says so under "Protecting secrets".
co:op trusts the host and your editors. Each time co:op starts an agent or service with eBPF protection, it records the current hiding rules and the protected files and folders. While the box runs, it checks every file the box opens against the built-in list. As a result:
- Ordinary edits to public files work immediately.
- A path that is already protected stays protected when you edit it or save it atomically on the host, even when a parent folder is replaced. Existing hardlinks keep their protection when the original file is replaced.
- A new file that the built-in list matches, such as
late.pemor.env, is unreadable in the box as soon as it exists, in any letter case or Unicode spelling. The box can still create, overwrite, truncate or delete such a file, so installers and key generators keep working. The box can't read the file, rename it, or rename another file to a matching filename. So a tool in the box that saves a new secret by writing a temporary file and renaming it fails withOperation not permitted. Writing the file directly under its final name works. - Inside a hidden folder, the box can't create a file or folder, or move a file in.
- Restart the affected agent or service after you change
.coopignore, create a file that only.coopignorehides, create a hidden folder, mark an already-public file or folder as secret, or create an unprotected hardlink to a secret from the host. Protection that is already running doesn't reload its rules or revoke memory mappings that were already readable. - On the host, to save a secret atomically, write the temporary file outside the project or inside an already hidden folder. A new temporary file at a public path is protected only when the built-in list matches its filename.
- Protection belongs to the file or folder, not to its path. Removing the hiding rule doesn't make a hidden secret public while it still has another hardlink in the project. Remove the other hardlinks and restart before you make the original file public.
- When you approve a hidden file for a service, the service can read that file, its other hardlinks and your later in-place edits on the host. The approval never allows writes. If the file is replaced, start the service through co:op again so that it can read the new file.
A separate helper enforces the rules in the kernel, and the agent gets no BPF privileges. If the helper exits, all access to the shared project files is denied until co:op removes that agent or service. On Linux the denial applies to the whole disk that holds the project, so the box usually can't run its own programs either.
Stopped service containers keep their protection for a later restart. After a VM reboot, co:op's guard runs before an image's start command and its healthchecks, and refuses to run image code under the old protection. Start the service through co:op to get new protection.
The helper on AppArmor hosts
With the systemd driver, the helper talks to systemd over the system bus. Docker's default
AppArmor profile blocks that, so on an AppArmor host such as Ubuntu the helper runs without
AppArmor. To run the helper under co:op's own profile, run this once:
Shell examples
coop setup apparmor
coop doctor suggests the command when it would help, and again when an update changes the
profile. The command installs the profile in /etc/apparmor.d through Docker, without sudo, and
the profile loads on every boot.
The profile has Docker's default rules, which deny mounts and writes to kernel settings, plus the two systemd calls that start and stop co:op's slices. Other system bus calls stay blocked. AppArmor can't check the arguments of those two calls, so the profile doesn't limit what the helper could do through systemd.