deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

Keeping credentials off agent VMs: lend's approval proxy and a curl-pipe blocking hook

A proxy called lend lets VM-hosted coding agents run credential-bearing commands on the owner's laptop under biometric approval, while a Claude Code PreToolUse hook blocks piping downloaded scripts into a shell.

Keeping credentials off agent VMs: lend's approval proxy and a curl-pipe blocking hook

Two recent community posts approach the same operational problem from different ends: how to let coding agents do real work without handing them your secrets or letting them pipe arbitrary downloaded code into a shell. One, which reached the Hacker News front page, describes a tool called lend that brokers credential-bearing commands back to the author's laptop for approval. The other, on dev.to, is a small Claude Code hook that blocks curl | bash-style commands before they execute.

Agents on VMs, credentials on the laptop

According to the post on antonio's blog, the author runs several agents in parallel — Claude Code in one repository, Codex reviewing a branch in another — none of them on his laptop. They live on disposable VMs, while the laptop keeps the SSH keys, the 1Password vault, and the logged-in gh and cloud CLIs. The separation works until an agent needs to act as its owner: monitoring CI, calling an API with a stored token, or reaching another host over SSH.

He rejects the two standard solutions. Copying a token onto the VM leaves it readable by every process on that machine for as long as it is valid. Forwarding the SSH agent with ssh -A keeps private keys local, but the VM can silently use every key in the agent, leaves no record of what was signed, and only helps with SSH.

lend runs commands where the credentials live

lend is a proxy placed in front of an existing SSH agent. The VM forwards lend's socket instead of the real one, so ordinary SSH and Git keep working, while lend adds an SSH agent extension for executing commands. When an agent asks to run gh, the request travels over the forwarded socket and the command runs on the laptop under the owner's login. The token never leaves the laptop; stdout, stderr and the exit code stream back to the agent.

Every request, whether a signature or a command, is checked against a policy stored on the laptop and defaults to deny. Rules can pin exact executable paths, restrict usage to specific subcommands with an argument prefix, and allow only listed key fingerprints. Approvals use a biometric mode that puts Touch ID directly in the request dialog. The dialog itself shows the full path to the executable, every argument, the working directory, the stated reason, and what the remote process reported about itself. Because the reason and caller details originate on the VM, they are marked unverified — useful context for the human deciding, but unable to widen what the policy permits.

Connecting is a single command from the laptop that starts a per-connection proxy and stops it when SSH exits. On the VM side, Claude Code can reach lend through an MCP server exposing one tool, run_local_command, which requires a reason. A plain CLI call is available for setups without MCP.

The post also handles a practical wrinkle: a forwarded agent socket belongs to one SSH connection, so panes surviving a reconnect would hold a stale path. The author keeps a symlink at a fixed location, updated by an SSH rc script that first probes the socket to confirm it speaks lend's protocol, with his shell configuration adopting the stable path when the check passes. Surrounding tooling includes herdr, a terminal multiplexer that tracks which agent runs in each pane and lets agents start and prompt one another via CLI, and Ovis, a browser and phone client that turns approval requests into push-notification cards over Tailscale. The post closes with sections on what lend does not protect against and on prior art.

A hook that refuses remote scripts in a shell

The dev.to post targets a gap that permission rules and secret-path guards leave open: a shell tool call that downloads a script and pipes it straight into an interpreter. The fix is a Claude Code PreToolUse hook — a short Bash script that reads the tool call as JSON on stdin, greps for curl or wget piped into sh, bash or python, including sudo variants, and exits with code 2 to block execution.

The blocked command never runs, and the hook's stderr message returns to Claude so it can adapt rather than retry a reworded pipe. Registration happens in the project's settings with a matcher on the Bash tool. The author is candid about limits: this is a pattern match, not a shell parser, so it should be extended with house-specific patterns, paired with guards for destructive commands like force pushes, committed so teammates inherit the same rule, and tested with a harmless example in a throwaway session.

Why it matters

Both posts share one assumption: agent safety should not depend on the agent behaving well. lend removes the need to place long-lived credentials on a machine shared with the agent, replacing broad access with per-request, policy-checked approvals that leave a decision trail. The hook closes the complementary risk of executing network-fetched code with no human in the loop. As agents get broader shell and MCP access by default, these patterns — deny by default, verify before approving, block before executing — are the kind of guardrails likely to move from personal setups into standard practice.

  • #coding-agents
  • #security
  • #ssh
  • #claude-code
  • #mcp

Related posts