Running coding agents without handing them my credentials
TL;DR Highlight
Credentials stay on the laptop; agents run commands there via Touch ID approval
Who Should Read
A developer running Claude Code or Codex on VMs who doesn't want to copy gh tokens or SSH keys onto them
Core Mechanics
- Copying tokens and ssh -A both felt unsafe
- A token on the VM can be read by every process there for as long as it's valid.
- With ssh -A the VM can use every key without asking, and nothing records what was signed.
- ssh -A only covers SSH keys.
- lend is a proxy in front of your SSH agent
- Requests over the forwarded socket run commands like gh on the laptop under my login.
- Every request goes through a laptop-side policy and approval, and the token never leaves.
- Policy is default-deny with an allowlist
- Set default to deny and narrow by executable path and args_prefix (e.g. pr view).
- biometric:inline puts Touch ID inside the request dialog for a single touch.
- Claude Code uses one MCP tool
- lend mcp exposes run_local_command, and a reason is required.
- The dialog shows the full executable path, arguments, working directory, and reason.
- The reason and caller info come from the VM, so they're marked unverified.
- Secrets are injected only into approved commands
- Values read via op read are passed as env vars like GH_TOKEN.
- The VM can't choose variables or references, and values never appear in prompts or history.
- Approving env, sh, or op itself hands the values straight back.
- Reconnects change the socket path, so use a stable symlink
- In the VM's ~/.ssh/rc, verify with lend doctor --remote and then update a fixed-path link.
- Agents already running need one restart with the stable path in their environment.
- It is not a sandbox
- An approved command runs as my user and can touch my files.
- Approving a shell, interpreter, or anything reading instructions from stdin effectively allows anything.
- No PTY, so interactive programs don't work, and biometric approval is macOS only.
Community Reactions
- Pushback: giving access to what keys enable is the real issue
- One commenter said the approval alert doesn't enable an informed choice, so what's the benefit.
- Another suggested asking the agents to get your credentials anyway to see if it's security or theater.
- Similar alternatives already in use
- Commenters said fnox exec gh decrypts via a YubiKey so the agent never sees the token.
- Another uses keepassxc-cli with read-only, minimal-access tokens for agents.
- Another noted Docker sandboxes support secret injection.
- Demand for HTTP secret injection
- Commenters said Nono and Smolvm already do this and they use it.
- A limitation raised: credentials used on a Tailscale node bypass those tools' proxy.
- Unprivileged user account instead of a VM
- One commenter cited VM latency, efficiency, and setup-automation chores, so they give agents a plain user account.
How to Apply
- Check today whether gh tokens sit on your agent VM
- Look for tokens in ~/.config/gh/hosts.yml and env vars on the VM and remove them.
- Install lend on laptop and VM, then run lend doctor on the laptop to check policy and approval setup.
- Write a policy that allows only gh
- Set default to deny and give the gh path args_prefix ["pr","view"] with biometric:inline.
- Connect with lend ssh --config ./policy.json -- VMNAME and test with lend exec.
- Connect Claude Code to lend mcp
- Add command lend, args ["mcp"] to the MCP config on the VM.
- Read the reason and arguments in each approval dialog before approving.
- Set up a stable socket link for reconnects
- In ~/.ssh/rc, update ~/.ssh/lend/agent.sock when lend doctor --remote passes.
- In ~/.bashrc, export that path as SSH_AUTH_SOCK.
Try It
# Run in your laptop terminal (macOS, needs brew; commands as in the original post)
brew install antoniomika/tap/lend
# Save policy.json on the laptop (allow only gh pr view)
cat > policy.json <<'EOF'
{
"default": "deny",
"commands": [
{"executable": "/opt/homebrew/bin/gh", "args_prefix": ["pr", "view"], "approval": "biometric:inline"}
]
}
EOF
# Connect to the VM with this policy
lend ssh --config ./policy.json -- {{VM_HOST}}
# Next, inside the VM (lend must be installed there too)
lend doctor --remote
lend exec --reason "Check PR" -- gh pr view {{PR_NUMBER}}Terminology
Related Papers
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
How the Claude Code team thinks about verification
E2E, property and differential tests plus verification rules let Claude run in parallel.
Windows 11 Is Collecting Data on Which Coding Agents and Developer Tools You Use
Reverse engineering shows Windows 11 logs which coding agents you use and reports it as optional diagnostics
The Silent Cost of Conversation History in LLM Reasoning
Keeping full conversation history dropped accuracy from 0.6 to 0.1 within 20 turns; a verified state summary prevented it.
Anthropic upgrades Claude Code Projects to run parallel AI workers
Claude Code Projects now has a coordinator that splits work into parallel threads and opens PRs.
Show HN: AgentRun – open-source, Self-improving Managed Agents
Agents save notes and skills after each run, cutting code review cost to 18 cents