Short answer

According to an open issue in OpenAI's Codex repository and a DEV post, ChatGPT Desktop can forward your local SSH agent to the remote machine where Codex runs, so any process the agent starts there can sign as you. No abuse has been shown, and OpenAI had made no statement as of November 10. On an iOS build machine, check which hosts you forward to, give the agent host its own deploy key per repo with IdentitiesOnly yes, use a separate read-only key for the fastlane match repo, and set ForwardAgent no for the hosts where agents run.

On November 9 a post on DEV, followed by a Hacker News thread, pointed out something many Codex users had never thought about: when ChatGPT Desktop connects to a remote machine over SSH to run Codex there, it can forward your local SSH agent to that machine. Any process the remote Codex app server starts can then ask your agent to sign with your keys. For most iOS developers those are the keys that push to GitHub, pull private Swift packages and, in a lot of small teams, read and write the fastlane match repo that holds the company's signing certificates.

Nobody has shown malware abusing this, and the post that started the discussion says so. What it changes is the blast radius of a mistake. If a prompt injection in a README, an issue or a package convinces the agent to run git push --force or ssh somewhere, the command runs with your identity, and nothing needs to be stolen first. A recent Ruby gem worm that writes CLAUDE.md and AGENTS.md into repos shows one way such instructions arrive.

This guide covers what the forwarding does according to OpenAI's own code and issue tracker, how to see on your build machine exactly which keys an agent can reach, and how to cut that down to the one repo the agent should touch. It assumes the common iOS setup: a Mac on your desk, plus a Mac mini, a cloud Mac or a Linux box where the agent runs builds and edits code.

What was reported

Three public sources carry the story, and none of them is an announcement from OpenAI.

The first is issue #59694 in the openai/codex repository, opened on November 5, 2026. Its title is "Remote SSH: one desktop client overwrites the shared SSH agent used by other clients." The author quotes the bootstrap logic the desktop app runs on the remote host:

if [ -S "${SSH_AUTH_SOCK:-}" ]; then
  ln -sfn -- "$SSH_AUTH_SOCK" \
    "${CODEX_HOME:-$HOME/.codex}/app-server-control/forwarded-ssh-agent.sock"

According to the issue, the shared app server starts with SSH_AUTH_SOCK pointing at that stable path, and each desktop connection rewrites the link before it runs codex app-server proxy. The bug being reported is about two clients: a MacBook and a Windows PC connected to the same remote account, and whichever connected last replaced the link, so git operations through the shared path started timing out. The author notes that the code checks whether a socket exists but not whether it answers. The issue was still open with labels and no maintainer reply when I read it on November 10. It also mentions PR #28131, an older proposal to refresh the SSH agent for the app-server proxy, closed without merging, and says that PR is not evidence of a released fix.

The second is the DEV post by Sam Labbe, published November 9. It describes the agent forwarding as a designed capability, names a --forward-ssh-agent flag in the app-server integration, and frames the risk as credential capability: the agent can authenticate as you anywhere your key is accepted. It lists audit commands and three mitigations, which I test below.

The third is a Daily CyberSecurity write-up from November 10, which summarizes the issue, the closed PR and the HN thread, and reports no statement from OpenAI.

OpenAI's Remote connections documentation explains that the app reads concrete host aliases from ~/.ssh/config, starts the remote Codex app server through SSH using the remote user's login shell, and that "remote project chats run commands, read files, and write changes on the remote host." It asks you to keep the host to the same standard as normal SSH access, with "trusted keys, least-privilege accounts, and no unauthenticated public listeners." It does not mention agent forwarding at all, which is part of why this surprised people.

So treat the details as reported by users reading the code, with one issue still open. The defensive steps below are useful whatever OpenAI ends up changing, because they also apply to Claude Code, Cursor or any other agent you run over SSH with ForwardAgent yes.

Why this matters more for iOS teams

OpenSSH's own manual is blunt about forwarding. The ssh_config page says "Agent forwarding should be enabled with caution," because anyone who can bypass file permissions on the remote host can use your local agent through the forwarded socket. A coding agent running as your user on that host does not even need to bypass anything: it is your user.

Think about what a typical iOS developer's personal SSH key can reach:

  • Every GitHub repository your account can push to, including client apps you no longer work on.
  • Private Swift packages and CocoaPods specs pulled over SSH.
  • The fastlane match repository. The match docs describe it as a private git repo you own that stores your certificates and provisioning profiles, encrypted with a passphrase you set through MATCH_PASSWORD. The encryption protects the files from being read, but a key with write access can still push changes, delete branches or rewrite history.
  • Any server listed in ~/.ssh/config: a staging API box, a VPS that hosts your app's privacy policy page, a backup NAS.

A coding agent needs none of that. For a typical task it needs to clone one app repo, maybe fetch a few packages, and push to a feature branch.

Step 1: find out which hosts you forward to

Start on your own Mac. Agent forwarding is usually switched on in ~/.ssh/config, sometimes years ago, often under a broad Host * block. This script prints the effective ForwardAgent value for every concrete host alias, using ssh -G, which makes ssh evaluate your config and print the result without connecting:

#!/usr/bin/env bash
# forwardagent-check.sh: run on your own Mac. Prints the effective ForwardAgent
# value for every concrete Host alias in ~/.ssh/config (patterns are skipped).
set -u
CONFIG="${1:-$HOME/.ssh/config}"
awk 'tolower($1)=="host"{for(i=2;i<=NF;i++) print $i}' "$CONFIG" \
 | grep -v '[*?!]' | sort -u | while read -r host; do
  fa="$(ssh -F "$CONFIG" -G "$host" 2>/dev/null | awk '$1=="forwardagent"{print $2}')"
  printf '%-30s ForwardAgent=%s\n' "$host" "${fa:-?}"
done

Run it with bash forwardagent-check.sh. Output looks like this:

buildmac                       ForwardAgent=no
devbox                         ForwardAgent=yes

The script skips wildcard hosts on purpose, because Codex also ignores pattern-only hosts when it lists SSH targets. It only lists hosts written in the file you give it, so run it again on any file you pull in with Include. I tested it on Linux with OpenSSH 9.6 against a sample config. One thing that caught me during testing: without -F, ssh -G reads the config of the account's real home directory, not whatever $HOME says, so keep the flag if you point the script at another file.

Any host that says yes and also runs a coding agent is a host where the agent can sign as you, whether the forwarding comes from your config or from the desktop app.

Step 2: see what the agent host can actually reach

Now log in to the build machine and look from the agent's side. The DEV post suggests three quick checks: ssh-add -l to list identities that can sign, a look inside ~/.codex/app-server-control/ for the forwarding socket, and echo "$SSH_AUTH_SOCK". I put them in one read-only script and added two things the manual commands miss: a timeout, because the issue describes a socket that exists but never answers (a plain ssh-add -l just hangs), and a look at the environment of running Codex processes on Linux.

#!/usr/bin/env bash
# agent-host-audit.sh: run on the machine where the coding agent runs.
# Read-only. Shows which SSH agent the agent's processes can reach and which keys it holds.
set -u
CODEX_DIR="${CODEX_HOME:-$HOME/.codex}"
LINK="$CODEX_DIR/app-server-control/forwarded-ssh-agent.sock"

echo "== Shell SSH_AUTH_SOCK"
echo "${SSH_AUTH_SOCK:-<not set>}"

echo "== Codex forwarded agent link"
if [ -L "$LINK" ]; then
  target="$(readlink "$LINK")"
  echo "link:   $LINK"
  echo "target: $target"
  if [ -S "$target" ]; then echo "target socket exists"; else echo "target socket is missing (stale link)"; fi
else
  echo "no forwarded agent link at $LINK"
fi

list_keys() {
  # $1 = socket path. timeout stops a dead socket from hanging the script.
  SSH_AUTH_SOCK="$1" timeout 5 ssh-add -l 2>&1
  rc=$?
  [ $rc -eq 124 ] && echo "ssh-add timed out: the socket exists but does not answer"
}

echo "== Keys the shell's agent can sign with"
[ -n "${SSH_AUTH_SOCK:-}" ] && list_keys "$SSH_AUTH_SOCK"

if [ -L "$LINK" ]; then
  echo "== Keys behind the Codex link"
  list_keys "$LINK"
fi

if [ -d /proc ]; then
  echo "== SSH_AUTH_SOCK seen by running codex processes (Linux only)"
  for pid in $(pgrep -f "codex" 2>/dev/null); do
    sock="$(tr '\0' '\n' < /proc/"$pid"/environ 2>/dev/null | sed -n 's/^SSH_AUTH_SOCK=//p')"
    [ -n "$sock" ] && echo "pid $pid: $sock"
  done
fi

if [ "${1:-}" = "--github" ]; then
  echo "== What GitHub thinks you are (uses whatever agent is active)"
  timeout 10 ssh -T -o BatchMode=yes git@github.com 2>&1 | head -1
fi

I ran it on Linux against a test agent in three states. With a live link it lists the same key twice, once through your shell and once through the Codex link. With a link pointing at a socket that no longer exists it reports a stale link. With a socket that accepts connections but never replies it prints the timeout message after five seconds instead of freezing. I did not have a real ChatGPT Desktop remote session to test against, so the path is the one quoted in issue #59694; if OpenAI moves it, change LINK.

Two notes for Mac build hosts. The /proc section does nothing on macOS, and the rest works there because timeout is the only extra tool it needs. If your Mac does not have timeout, install GNU coreutils through Homebrew, where it is called gtimeout, and edit the two lines that use it.

Run it with --github to see which identity GitHub reports. If the reply greets your personal username, the agent can do anything your account can do on GitHub.

Step 3: give the agent its own key

The cleanest fix is to stop forwarding your personal agent to agent hosts and give each host a key that can reach only what the agent needs. On GitHub that is a deploy key. The GitHub deploy key docs describe it as an SSH key attached to a single repository, read-only unless you tick write access.

On the build machine:

ssh-keygen -t ed25519 -C "agent@buildmac MyApp" -f ~/.ssh/myapp_agent

Then in the app repo on GitHub, open Settings, choose Deploy keys in the sidebar, click Add deploy key, paste the contents of ~/.ssh/myapp_agent.pub, and tick Allow write access only if the agent pushes branches itself. Click Add key.

Because a deploy key covers one repo, GitHub's docs suggest a host alias per key in ~/.ssh/config on the server:

Host github-myapp
  HostName github.com
  User git
  IdentityFile ~/.ssh/myapp_agent
  IdentitiesOnly yes

IdentitiesOnly yes matters here. The ssh_config manual says it makes ssh use only the configured identity "even if ssh-agent(1) ... offers more identities." Without it, a forwarded agent still gets tried first and your personal key quietly wins. Point the clone at the alias:

git remote set-url origin git@github-myapp:your-org/MyApp.git

Deploy keys have trade-offs that GitHub lists plainly: they usually have no passphrase, so a compromised server exposes them; they do not expire; and they stay active after the person who added them leaves. Put a calendar reminder to rotate them, and delete the key from the repo when the build machine is retired.

For the fastlane match repo, the match docs already describe the CI pattern: use git_private_key to pass a deploy key, remember that GitHub will not let you reuse the same deploy key on a second repo, and run match with readonly so it only fetches existing certificates and profiles. Their example is match(type: "appstore", readonly: is_ci). A read-only deploy key on the match repo, separate from the app repo key, means an agent can still build and sign a release but cannot push anything into your certificate store. AI Agents Took 300+ iOS Signing Certificates From 10 Shops shows what stolen signing files get used for.

Step 4: turn forwarding off where agents run

Once the host has its own key, switch off forwarding for that host on your Mac:

Host buildmac
  HostName 10.0.0.5
  ForwardAgent no

If you have ForwardAgent yes under Host *, move it down to the specific hosts that need it. OpenSSH uses the first value it finds for each option, so a specific Host block placed above Host * wins. Run forwardagent-check.sh again to confirm.

I could not confirm from OpenAI's documentation whether ChatGPT Desktop's remote connections follow ForwardAgent no from your config or forward the agent on their own. Issue #22567 describes the opposite problem in an earlier build, where the app did not honor ForwardAgent yes and Docker builds that needed the agent failed. So check from the remote side after you change the config: open a new remote session from the app and run agent-host-audit.sh. If the Codex link still lists your personal key, forwarding is happening regardless of your config, and the next step is your safety net.

Step 5: make every signature visible or short-lived

When you do need your personal agent on a remote host, the manual for ssh-add gives you three controls.

-c adds a key that needs confirmation before each use. The confirmation runs through ssh-askpass, and the man page says success is signaled by its exit status. I tested what happens when no askpass program is available: on Linux with OpenSSH 9.6, signing with a -c key failed with "agent refused operation." That is the safe failure, but it also means a -c key will simply stop working if your Mac has no askpass helper installed. Test it once with a harmless ssh -T git@github.com before relying on it.

-t sets a lifetime. ssh-add -t 1h ~/.ssh/id_ed25519 loads the key for an hour, and ssh-add prints "Lifetime set to 3600 seconds." A key that disappears after your work session cannot be used by an agent that keeps running overnight.

-h adds destination constraints, so a key can be used only through specific hosts or toward specific destinations. The man page notes that keys are not destination constrained by default. This needs OpenSSH support on both ends, so check the version on your build host before you count on it.

Two more commands help during a session. ssh-add -D removes all identities from the agent, which is a quick way to cut an agent off while it runs. ssh-add -d ~/.ssh/id_ed25519.pub removes one key. I confirmed both on the test agent: after removal, ssh-add -l printed "The agent has no identities."

The DEV post also suggests a hardware-backed key, created with ssh-keygen -t ed25519-sk on a FIDO2 security key, so each signature needs a physical touch. Combined with a deploy key on the agent host, that leaves your personal identity usable only when you are sitting there tapping the key.

Step 6: if you use two Macs, watch the link

The actual bug in issue #59694 is a reliability problem that looks like an auth problem. If you connect from a laptop and a desktop to the same remote account, the last client to connect owns the forwarded agent link, and if that client's socket stops answering, every git command through the link hangs. The symptoms are timeouts on git fetch or swift package resolve inside the agent's session while the same commands work in your own terminal.

The audit script spots this: the Codex link section prints the timeout message, while your shell's agent lists keys normally. The issue author recovered by repointing the link to the working socket and calls that temporary. A deploy key with IdentitiesOnly yes sidesteps the whole thing, because git on the host stops depending on any forwarded socket.

What changes when your own machine is a Mac

The scripts above were tested on Linux. The checks in this section were run on a Mac with macOS 26.0.1 and OpenSSH 10.0p2, using a throwaway key in a separate agent, because three details behave differently there.

Your key reloads itself. GitHub's guide for adding a key on macOS suggests AddKeysToAgent yes and UseKeychain yes under Host github.com, and a lot of Mac configs still carry those two lines. The ssh_config manual says the first adds a key to the running agent when it is loaded from a file, and the second makes macOS look for the passphrase in your keychain. Together they mean that clearing the agent with ssh-add -D lasts only until your next git fetch from your own terminal. The key comes back without a prompt, and if a remote agent session is open with forwarding on, it can use the key again.

The same manual says AddKeysToAgent also accepts a time interval, which sets the key's lifetime in the agent. On the test Mac, ssh -G reported addkeystoagent 3600 for a value of 1h. So you can keep the convenience and still have the key drop out by itself:

Host github.com
  AddKeysToAgent 1h
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

Confirmation needs a helper that macOS does not ship. The test Mac had no ssh-askpass in /usr/libexec or anywhere on the path. A key added with -c was accepted, and then every signature was refused, which matches the Linux result in Step 5:

$ ssh-add -t 1h k
Identity added: k (throwaway-test)
Lifetime set to 3600 seconds

$ ssh-add -D
All identities removed.

$ ssh-add -c k
Identity added: k (throwaway-test)
The user must confirm each use of the key

$ ssh-add -T k.pub
Agent signature failed for k.pub: agent refused operation

That is the safe way to fail. It also means that on a stock Mac a -c key cannot sign anything until you install an askpass helper and point SSH_ASKPASS at it. Find that out on a quiet afternoon with ssh-add -T, which runs a sign and verify test against the agent without connecting anywhere. The lifetime option needs no helper, so -t or the config line above is the control that works on every Mac.

The audit script needs one extra tool. The same Mac had neither timeout nor gtimeout, so install GNU coreutils before you run agent-host-audit.sh on a Mac build host, as noted in Step 2. Without it, the check that guards against a socket that never answers cannot run.

Confirm the fix from the agent's side

After Steps 3 and 4, open a new remote session and run three commands on the agent host. They take a few seconds and tell you whether the host now stands on its own key.

# On the agent host, inside a fresh remote session:
ssh-add -l                      # which identities can sign here
ssh -T git@github-myapp         # who GitHub says you are through the alias
git ls-remote origin HEAD       # the app repo still answers
CommandWhat you want to seeWhat means the fix did not take
ssh-add -l"The agent has no identities." or "Could not open a connection to your authentication agent."Your personal key's fingerprint and comment
ssh -T git@github-myappA greeting that names the repository the deploy key belongs to"Hi" followed by your own GitHub username
git ls-remote origin HEADOne line with a commit hashA hang or a timeout, which points back to the stale link in Step 6

GitHub's own test page shows the personal form of that greeting as "Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access." If you see your username there while using the alias, IdentitiesOnly yes is missing or the alias is not the one your remote points at. Run git remote -v and check that the URL starts with git@github-myapp:.

Then try one thing the agent should not be able to do. Ask it, or run yourself from that session, a git ls-remote against a repository the deploy key was not added to. It should be refused. If it succeeds, some other identity is still reachable from that host, and Step 2 will show you which.

Which steps you need for your setup

Your setupWhat to do
The agent runs only on the Mac in front of youNothing is forwarded to another machine. Run Step 1 anyway, so an old Host * rule does not surprise you the day you add a build host.
A Mac on your desk plus a Mac mini or cloud Mac that the agent works onSteps 1 to 4, then the Mac notes and the three checks above.
The agent works on a Linux boxSteps 1 to 4. The /proc part of the audit script works there and shows what running Codex processes inherited.
Two of your computers connect to the same remote accountStep 6, and move git on that host to a deploy key so it stops depending on whichever client connected last.
You have to keep your personal agent forwarded, for example through a jump hostStep 5. Give the key a lifetime first, then add confirmation or destination constraints if your hosts support them.

A short checklist for your build machine

  1. Run forwardagent-check.sh on your Mac and note every agent host with ForwardAgent=yes.
  2. Run agent-host-audit.sh --github on each agent host. Write down which keys it lists and which GitHub user answers.
  3. Create one deploy key per repo the agent needs, read-only unless it must push, with a host alias and IdentitiesOnly yes.
  4. Give the match repo its own read-only deploy key and run match with readonly on that host.
  5. Set ForwardAgent no for agent hosts, start a fresh remote session and run the audit again.
  6. If your personal key still shows up, load it with -t (and -c if you have a working askpass), or remove it with ssh-add -D while the agent runs.
  7. Put a reminder in your calendar to rotate deploy keys and to delete them when a build machine is retired.

None of this depends on how OpenAI resolves the open issue. If the forwarding stays, your agent host only holds keys for one repo. If OpenAI changes it, you still have a tidier build machine and a match repo that a stray command cannot overwrite.

FAQ

Does this mean OpenAI is collecting my SSH keys?

No source claims that. SSH agent forwarding never sends the private key to the remote host. It lets processes there ask your local agent to sign. The risk is what those processes can do with your identity while the session is open.

Is Claude Code or Cursor affected?

The reports are about ChatGPT Desktop's Codex remote connections. Any agent you run in an SSH session with ForwardAgent yes has the same ability to use your agent, because that is how OpenSSH forwarding works. The audit and fixes above apply to any of them.

Has OpenAI responded?

As of November 10, the sources I read report no statement. Issue #59694 is open with labels and no maintainer comment, and the earlier PR #28131 was closed without merging.

Do I still need my personal key on the build Mac?

Usually not. Builds, package resolution and match in read-only mode work with deploy keys. Keep your personal key for the moments you push from your own terminal.

A kit for the agent side

If you run Claude Code on these build machines too, Claude Code + Xcode: The Production iOS Workflow Kit is my $18 kit of AGENTS.md and CLAUDE.md templates, 8 rules, 6 commands and 10 iOS agents. One of the rules covers privacy and security, there are CI and release-readiness agents, and the workflow puts human approval gates around signing and destructive actions. It does not manage SSH keys for you; the steps above are still yours to do.

Sources