How-to
Keep ChatGPT's SSH projects off your keys
When the ChatGPT desktop app opens a project on an SSH host that receives your forwarded SSH agent, the AI working there can sign in as you with your loaded keys. Check whether yours does, then close it off.
A Hacker News post on 9 November said an AI agent the ChatGPT desktop app runs on a remote machine can use your local SSH credentials, for example to push to private GitHub repos.
Its proof was an older code change that was closed without being merged, but a user’s 5 November bug report on OpenAI’s Codex repo, still open with no OpenAI reply, quotes setup code the user found inside the app, linking a forwarded agent to a fixed path that the remote server uses.
The prompt: check and close your SSH agent
Run it in an AI that can run commands on your computer, such as Claude Code or the Codex CLI, or paste each command’s output into any chat. It reads only until you approve a change.
You are helping me check whether an AI agent working on a remote machine can use my SSH keys, and then plan how to close that off. Work like a careful security engineer who reviews SSH setups for a living. If you miss a host that forwards my agent, an AI running commands there can sign in as me to GitHub or my servers while I am connected. If you raise a false alarm, I may break a setup that was fine. So judge only from command output I show you or that you run, and say plainly when you cannot tell. FACTS TO USE (from the OpenSSH manual pages and OpenAI's remote connections page, read on 10 November 2026; do not add to them from memory, and if today is much later, tell me to recheck them) - ForwardAgent in ~/.ssh/config controls whether my local SSH agent is forwarded to a remote machine. OpenSSH's default is no. - Anyone, or any program, on the remote machine that can reach the forwarded agent socket can use my loaded keys to authenticate while I am connected. They cannot extract the private keys through the agent. - ssh -G [host alias] prints the settings ssh will actually use for that host, after every Host and Match block. - ssh-add -l lists the keys my agent holds. ssh-add -D removes them all. ssh-add -t sets a lifetime. ssh-add -c makes each use ask for confirmation, through a helper program called ssh-askpass. ssh-add -h limits a key to named hosts. - OpenAI says the ChatGPT desktop app reads host aliases from ~/.ssh/config and resolves them with OpenSSH. Its page does not say whether the app forwards my agent. A user's bug report on OpenAI's Codex repo, dated 5 November 2026 and still open with no reply from OpenAI, quotes setup code the user found inside the app, linking a forwarded agent to ~/.codex/app-server-control/forwarded-ssh-agent.sock on the remote host. Treat that path as a lead to check, and never as a fact about my machine. ABOUT ME (I fill this in once; any line can say "not sure") - My computer: [macOS / Linux / Windows] - The host aliases the ChatGPT desktop app or Codex connects to: [e.g. "devbox, build-server", or "not sure, check Settings > Connections in the app"] - What the AI needs to do over SSH from those hosts: [e.g. "pull and push one private GitHub repo", "nothing beyond the files already there", "reach other servers through this one"] - My keys: [e.g. "one id_ed25519 for everything", "a work key and a personal key", "a hardware key"] - Can you run commands on my computer in this chat: [yes / no, I will paste output] SAFETY RULES FOR THIS CHAT - Run only the read-only commands listed in Job 1 and Job 3, unless I say yes to a specific change. - Never print, open, copy or ask me to paste a private key file or its contents. Fingerprints and public keys are fine. - Never edit ~/.ssh/config, remove a key or generate a key until you have shown me the exact change and I have said yes. Before any edit, copy the config to a dated backup. - If I paste something that looks like a private key, tell me to delete it from this chat and treat that key as exposed. HOW TO WORK Check that I filled in the section above. If the host aliases line is blank, ask for it once and wait. If you cannot run commands, give me each command in its own line to run, and wait for the output before moving on. If my computer is Windows, give the PowerShell form of any grep, using Select-String. Job 1. Inventory my side. Run, or ask me to run: - ssh-add -l - ssh -G [host alias] | grep -i -E "^(forwardagent|identityfile|identitiesonly|proxyjump) " for each host alias - grep -n -i -E "forwardagent|^[[:space:]]*(host|match|include) " ~/.ssh/config Then list, in a table: each loaded key's fingerprint and comment, and for each host the resolved ForwardAgent value and the config line that sets it. If ssh-add -l says it cannot connect to the agent, my agent is not running here, so nothing can be forwarded from this session; say so and skip to Job 4. If it says the agent has no identities, the agent holds no keys right now; say that forwarding would still hand over any key I add later. If an Include line points to another file, ask to read that file too before you judge, because the setting may live there. Job 2. Judge each host from my side. - If ForwardAgent resolves to yes, or to a socket path or variable: FORWARDED BY MY CONFIG. Name the line that does it, and flag any Host * or wildcard block, since that forwards to every host. - If it resolves to no: NOT FORWARDED BY MY CONFIG. Say this covers my own ssh command, and that the remote check in Job 3 is what shows whether the app's connection is different. Job 3. Check from the remote side. Tell me to open a chat in a ChatGPT desktop project on that host and ask it to run, and to paste back the output: - echo "$SSH_AUTH_SOCK"; ssh-add -l - ls -l ~/.codex/app-server-control/ 2>/dev/null (if CODEX_HOME is set there, look under that folder instead) Then judge: - If ssh-add -l there lists any fingerprint that matches one from Job 1: REACHABLE. The AI on that host can use those keys while the app is connected. Name the keys. - If it lists fingerprints that match none from Job 1: say they come from an agent I have not shown you, perhaps one running on the remote host itself, mark their source NOT STATED, and ask me whether I recognise them. - If it says it cannot connect to the agent, or SSH_AUTH_SOCK is empty: NOT REACHABLE in that chat right now. - If the command was blocked, needed approval I refused, or failed in a way you cannot read: CANNOT TELL. Do not guess; say what output would settle it. - If Job 2 said NOT FORWARDED but Job 3 says REACHABLE, say so plainly as a mismatch, and tell me to report it to OpenAI with both outputs, with hostnames removed. Job 4. Make my plan, one host at a time, using what I said the AI needs to do. - If the AI needs nothing over SSH from that host: set ForwardAgent no for it. If an earlier Host * or wildcard block sets ForwardAgent yes, say that ssh uses the first value it finds, so the line must be removed there; then confirm with ssh -G. Show the exact Host block, reconnect the host in the app, then repeat Job 3. - If it needs one GitHub repo: suggest a separate key on the remote host added to that repo as a deploy key, which is read-only unless I allow writes, and turn forwarding off. - If it uses the host to reach other servers: suggest ProxyJump on my side, so I connect through it without forwarding my agent. - If I insist on keeping forwarding: suggest loading only the one key that host needs, or limiting it to that host with ssh-add -h, a lifetime with ssh-add -t, and a confirmation or touch on each use, from ssh-add -c, a hardware key, or a key in my computer's secure chip. Tell me to test ssh-add -c with one login first, because without a working ssh-askpass the key may refuse to sign. - For any wildcard ForwardAgent yes: move it into named Host blocks for the hosts I actually trust, and set Host * to no at the end of the file. Never invent an app setting. If you think the app has a switch for this, write it as [CHECK IN APP] and tell me where to look: Settings > Connections. MY RESULT End with a short table: host, my config says, remote check says, verdict, next action. Then the exact config changes waiting for my yes. Tell me to save this result, since you may not keep this chat. SELF-CHECK BEFORE YOU ANSWER - Every verdict rests on output you ran or I pasted, quoted, or it says CANNOT TELL. - You never said my keys were stolen or copied. Forwarding lets the remote use them while connected, nothing more is known. - You printed no private key and made no change I did not approve. - You added no fact beyond this prompt, and marked anything else NOT STATED or [CHECK IN APP].
Run the check by hand
The same test in three commands, if you want to see it yourself first.
- See what your agent holds. On your own computer, run
ssh-add -l. Each line is a key your agent will sign with, and that list is what a forwarded agent hands over. - See what your config does for each host. Run
ssh -G devbox | grep -i forwardagent, with your own host alias.ssh -Gprints the settings after every Host block, so a buriedHost *line withForwardAgent yesshows up here. - Check from inside the app. In a ChatGPT desktop project on that host, ask the chat to run
ssh-add -l. Matching fingerprints mean the AI there can use those keys while the app is connected, and a cannot-connect error means it cannot. No identities means an agent is reachable but empty, so any key you load later is usable there.
Close it off
Pick by what the AI on that host actually needs to do over SSH.
It needs nothing over SSH
What to do: add ForwardAgent no under that host’s Host block in ~/.ssh/config.
Watch for: if a Host * block higher up says ForwardAgent yes, delete that line, because ssh uses the first value it finds. Then reconnect the host in Settings > Connections and rerun the check. If ssh-add -l still lists keys there, quit the app fully and run the check again.
Verdict: the cleanest fix, since the default is already off and this only undoes a line that turned it on.
It needs one GitHub repo
What to do: make a separate key on the remote host and add it to that repo as a deploy key, which reaches one repo and is read-only unless you allow writes. Then turn forwarding off.
Verdict: the AI keeps working on that repo and cannot touch the rest of your account.
It uses the host to reach other servers
What to do: set ProxyJump on your own machine, so you connect through the host without forwarding your agent to it.
Verdict: you still reach the other servers, and the agent stays home.
You want to keep forwarding
What to do: load only the key that host needs, add a lifetime with ssh-add -t, and require a confirm or a touch on every use.
Touch options: Nicolas Mattia’s walkthrough (19 October) makes a Touch ID key in a Mac’s secure chip with built-in tools; Secretive does the same as an app; a hardware key made with ssh-keygen -t ed25519-sk needs a touch by default.
Verdict: every sign-in now needs you, so an unexpected prompt tells you the AI is trying to use a key.
The honest bit
- Not known: whether the app forwards your agent to a host your config leaves at the default. OpenAI does not document it, and the user’s bug report shows the app using an agent that arrives, without saying how it arrived.
- Not claimed: that anyone’s keys were stolen. The OpenSSH manual says a forwarded agent lets the remote side use your keys while connected, and cannot hand over the private keys themselves.
- Your check: the
ssh-add -lrun inside a remote project chat. Matching fingerprints mean reachable, whatever your config says.
The facts here come from the Hacker News post, OpenAI’s Codex repo and remote connections page, the OpenSSH manual pages and GitHub’s deploy key docs, read 10 November 2026.
Do it now
Open a chat in your remote project, ask it to run ssh-add -l, and if anything comes back, paste the prompt into your terminal AI and fix that host first.
Until you fix it, ssh-add -D empties your agent so there is nothing to use. If your config has AddKeysToAgent yes, ssh adds a key back the next time it loads one from a file, so fix the host too.
A few quick questions
Can the AI copy my private key through a forwarded agent?
No, according to the OpenSSH manual: whoever can reach the forwarded agent can authenticate with your loaded keys, but cannot extract the key material. That ends when the connection closes, though anything it did while connected stays done.
Does IdentitiesOnly stop forwarding?
No. IdentitiesOnly controls which keys your own ssh offers when it connects. It does not change what a forwarded agent hands to the remote host, so you still need ForwardAgent no there.