Skip to main content

What's new

Your coding agent can use a key without ever holding it

A 1904 task conversation. The agent says it has asked to run gh pr create on Studio Mac, and a card below reads Waiting for you to confirm full access on Studio Mac, Approve or decline it in 1904 Desktop on that computer.

One developer's write-up this week describes a setup plenty of people running agents will recognize. His coding agents work on a remote machine, and his keys, his password manager and his signed-in command-line tools stay on his laptop. It all works "until an agent needs something on my laptop." Copying a GitHub token across would have left it readable by every process on that machine. Forwarding his key agent to it would have let the remote machine sign with any loaded key, without asking and without a record. Both are the shortcuts most of us reach for the first time an agent stalls on a login, and both hand the key to the agent's whole machine.

A key on the agent's machine is a key the agent has

An agent reads web pages, issues, package docs and tool output all day, and any of them can carry instructions it might follow. Nobody has to break into anything for a planted instruction to use your token. It only takes one command, run on the machine where the token sits. Once a token lives in a config file or an environment variable there, every process the agent starts can read it, and afterwards you can't tell a legitimate use from a planted one. So the useful question is where a command that needs your login actually runs.

Run the step where the key lives

The pattern in that write-up works with any setup. Keep the key on a computer you control. When the agent needs something done with it, it asks for a specific command, you approve it on that computer, the command runs with your login, and only its output and exit code go back. His tool starts from deny, lists the commands that may be asked for, such as gh, and wants an approval every time, usually with Touch ID. Where a tool insists on a token in its environment, a rule reads it from the password manager for that one approved command, and the remote machine can't choose which secrets get read.

Read what you're approving

An approval covers everything the command can do. A shell, an interpreter or anything that reads its script from input is arbitrary code running as you, and approving env, or the password manager's own read command, gives the agent the very secret you were protecting. Prefer narrow commands like gh pr create over open ones like bash -c, and read the whole line before you run it. The output goes back into the agent's conversation too, so a command that prints a token has handed it over anyway.

Catch the key that lands in the code

The other way a credential escapes is the agent writing one into a file to get a test passing, usually as a connection string. Scan the lines being committed before the commit and again before the push, because a secret deleted in a later commit is still in the history you'd be publishing.

How it works in 1904

1904 runs your agents in the cloud, and Use My Computer in 1904 Desktop is how a task reaches a key that should stay home. The agent asks to run a command on your Mac or PC, and 1904 Desktop shows the whole command, the folder, the task, who asked and the agent's reason. Nothing runs until you approve it on that computer, and the output and exit code come back to the conversation. On a Mac, commands run in a sandbox that can't read your keys, passwords or browser data, with no internet unless you allow it for that command. A step that really needs your login asks for full access, which you confirm every time, with Touch ID where your Mac has it, and no timed allowance ever covers it. Windows has no sandbox yet, so there every command runs with full access. And if an agent's change does contain a secret, the Secrets check holds the commit, the push and the merge until it's gone.

← All posts

Start with an idea, or start with what you have.

Use AI supplied by 1904, or connect the subscription you already pay for.