ADR-INFRA-009 — Dev Container SSH Agent Transport

By Engineering & Security Architecture Team•October 23, 2026•3 min read

Status: Accepted Date: 2026-10-23 Authors: Engineering & Security Architecture Team

Context

ADR-INFRA-008 decides that the dev container reaches GitHub through the password manager’s SSH agent on the Mac, so the container never holds a key or token. That decision leaves open how the agent socket gets into the container. Two transports are available, and they differ in how long the socket exists, which agent it reaches, and what the committed configuration exposes.

The transport does not change what a process in the container can do. With either one, any process that can read the socket can ask the agent to sign, and each request is approved on the Mac. The private key never crosses. This decision is about the exposure around that, not about the key.

Decision Drivers (FRs & NFRs)

  • BRD-INFRA-003 BR-1.4 — a workspace away from the contributor’s device cannot reach production credentials.
  • SR-INFRA-003 SR-F-05 and SR-NF-03 — the agent socket is available to the container only for the length of an attached IDE session, and the committed definition mounts no host socket.
  • BRD-INFRA-004 BR-1.2 — AI assistants and agents in the container get the narrowest access.
  • Workspace rule 06 — the workspace environment holds no secret beyond what a rule allows.
  • Workspace rule 10, section 4 — prefer federation and short-lived access over stored keys.

Decision — How the agent socket reaches the container

Option 1 — IDE per-session forwarding (CHOSEN)

Pros:

  • The socket exists only while an IDE session is attached. The IDE creates it in the container’s temporary directory on attach and removes it on detach, so a stopped or detached container exposes nothing.
  • Nothing is committed that exposes a host socket. The container definition holds no mount and no socket path, so the repository cannot widen access by accident.
  • The agent reached is the one the IDE process was started with. A wrong value fails visibly, with an agent that lists no keys, instead of silently using another agent.
  • The IDE brokers the connection, so a shell started outside the IDE, such as docker exec, gets no agent unless the IDE session is attached.
  • Works on any container host the IDE can attach to, with no dependency on the container runtime’s own host-service sockets.

Cons:

  • The IDE must be started with the agent socket in its environment. A launch from the Dock or Spotlight does not read the shell profile, so a wrong start gives a container with no keys.
  • Only IDE sessions get the agent. A terminal attached with docker exec, or another IDE, gets none.
  • A crashed IDE session can leave a stale socket in the container until the window is reloaded or the container is rebuilt.
  • Anything running in the container during an attached session can use the socket, as with the other option.

Option 2 — Bind mount of the runtime’s host agent socket

Pros:

  • Independent of the IDE. Every process in the container, including docker exec shells and other tools, can reach the agent.
  • No IDE environment to get right, once the container runtime forwards the correct agent.
  • One committed line in the container definition makes the setup reproducible.

Cons:

  • The socket is a standing mount for as long as the container runs, attached or not. A detached container, a background task and any process started with docker exec can ask the agent to sign.
  • The container runtime forwards whichever agent it saw when it started. If that is the operating system’s default agent and not the password manager’s, other keys loaded there are reachable, and the failure is silent.
  • The mount path is committed configuration. It does not exist in a hosted Codespace, so the container fails to build there, and the fallback in SR-INFRA-003 SR-F-07 breaks.
  • Depends on a runtime-specific host path that differs between container runtimes and operating systems.
  • The socket file is owned by root inside the container, so a non-root user can get a permission error that needs an extra setup step.

Option 3 — Bind mount of the password manager’s own socket path

Pros:

  • Names the exact agent, so the runtime’s choice of agent does not matter.

Cons:

  • A Unix socket on the macOS filesystem is not usable through a bind mount into the Linux virtual machine that Docker Desktop runs, so it does not connect.
  • The path is specific to one user and one install, so a committed value breaks for everyone else.

Final Decision

The dev container receives the SSH agent through the IDE’s per-session forwarding. Option 2 is rejected because it leaves a standing socket in the container, can forward the wrong agent without any signal, and breaks the hosted fallback. Option 3 is rejected because it does not work on the target container runtime.

The cost accepted is that the IDE must be started with the correct agent socket in its environment, and that only attached IDE sessions can use the agent. The setup guide documents the start procedure. The security gain over Option 2 is narrower exposure, not a different trust model: any process in an attached container can still request signatures until the session ends, and the password manager’s per-use approval on the Mac remains the control.