Tegoby Attention SpanBlogBook a demo

Your agent doesn't need your SSH keys

An AI agent runs as your user, so it can read whatever you can: ~/.ssh, ~/.aws, the project's .env files, your browser profiles. To keep it away from them, run it under a Tego contract on Linux. Every contract carries Tego's built-in deny_read list of secret paths unless it writes deny_read: [], and Tego refuses those reads for the agent and every process it starts, whatever command or script makes them. The kernel does the refusing; at Basic, a listed file inside a folder the agent may write is refused by Tego's supervisor instead. Add what the list does not name with fs.deny_read.

For the bigger picture, read AI agent security on Linux. We make Tego; claims about it link its repository.

Why can an agent read your keys at all?

Because nothing stands between it and your files. An agent's shell tool starts programs as you, and a prompt injection only has to talk the agent into running one. The nx s1ngularity malware shows what one such program can do: a postinstall script in a malicious package ran as the user on install and "scans the file system, collects credentials, and posts them to GitHub as a repo under user's accounts" (GHSA-cxm3-wv7p-598c). A prompt is not a security boundary takes that case apart.

Permission rules inside the agent cover less than they seem to. Claude Code's own docs say its Read deny rules do not cover "arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself" (Configure permissions). For those, the same page points to Claude Code's sandbox, which enforces file access at the operating system level for every process.

What does Tego refuse by default?

With no deny_read line, or with one that adds paths, Tego applies its built-in list (contract semantics). It includes:

Kind Examples
SSH and signing ~/.ssh, ~/.gnupg
Cloud credentials ~/.aws, ~/.config/gcloud, ~/.kube/config, ~/.azure, ~/.oci
Token stores ~/.config/gh, ~/.git-credentials, ~/.npmrc, ~/.netrc, ~/.docker/config.json, ~/.pypirc
The agents' own logins ~/.claude/.credentials.json, ~/.codex/auth.json, ~/.gemini/oauth_creds.json
Password stores and keyrings ~/.password-store, ~/.config/op, ~/.local/share/keyrings
Browser profiles Firefox, Chrome, Chromium, Brave, Edge, Vivaldi and Opera at their usual paths
Project secrets .env files under the project root and the folder the run starts in

tego compile prints the entries it applies. A contract also refuses the host's local daemon sockets, ssh-agent among them, unless it sets host_sockets: true or a net entry names the socket (Write a Tego contract), so by default the agent cannot ask your running ssh-agent to sign for it.

How do you add your own paths?

Name them in fs.deny_read, which adds to the built-in list:

YAML
version: 0
name: my-agent
command: ["claude"]
extends: [tego/no-secrets]
fs:
  write: ["./src/", "./tests/"]
  # each entry must exist, or the contract does not compile (with zsh: ~/.zsh_history and ~/.zshrc)
  deny_read: ["~/.bash_history", "~/.bashrc"]

This shows the read side only, and Claude Code cannot sign in under it: tego/no-secrets keeps ANTHROPIC_API_KEY out unless env.pass names it, and Claude Code's own login files are on the built-in list. A contract that runs it also passes a login variable and names exec and net sections; Lock down Claude Code on Linux has one ready, and Write a Tego contract covers each section.

tego/no-secrets also keeps secret variables out of the agent's environment: only an allow-list of variables such as PATH and HOME reaches it, so a GITHUB_TOKEN you exported does not. Then check the contract with tego compile, and run the agent under it as Your first Tego run shows.

What does this not cover?

From Tego's own docs (Write a Tego contract, Security model and known limits and the README):

  • A secret the list does not name, such as a key under another name or a token inside a project file.
  • Your shell's startup files. A login or interactive shell the agent starts reads ~/.profile or ~/.bashrc again, and a token exported there is back. Keep tokens out of them, or deny them.
  • A secret inside a folder the agent may write. At the Basic protection level, Tego holds each read of a listed file there and refuses it, including through a renamed or hard-linked copy. fs.reads: direct turns that off and leaves the file unprotected, and a project on a network or shared filesystem (NFS, CIFS, FUSE, sshfs, or a Mac folder shared into a VM) can't use held reads, so the run refuses to start. Keep secrets outside the write folders anyway.
  • Names. A deny_read directory at Basic and Plus hides its files' contents, not their names.
  • Silent refusals at Basic. Under the default record: summary, a read that deny_read refuses fails with EACCES and usually leaves no line in the record. record: full, or Plus and Max (which need root), record reads.
  • Everything else. Tego "is not a sandbox that hides the machine": the agent reads any path not on the list, and anything it reads can leave through a host you allowed.

Next steps

Sources (5 links)

Read on 6 November 2026.