ADR-INFRA-008 — Dev Container Git Authentication
Status: Accepted Date: 2026-10-23 Authors: Engineering & Security Architecture Team
Context
The dev container must clone, pull and push the workspace and project repositories. ADR-INFRA-002 decides that the container holds no credential and that privileged commands run on the Mac, where the password manager asks for Touch ID. A Git login that needs a stored secret inside the container would break that decision.
The first version of the workspace gave the container a read-only service account token and used it to read a GitHub personal access token (PAT) at clone time. A service account token is a non-interactive key built for unattended pipelines. Any process in the container can read it from the environment, and using it replaces the biometric approval with a value that works without a person present. See BRD-INFRA-003, SR-INFRA-003 and BRD-INFRA-004.
The scope of this decision is Git access to GitHub only. A Git login signs a challenge, so it can be done without handing a secret to the container. Cloud API tokens (for example the Cloudflare token) are values that must be read, not signatures, and an SSH agent cannot deliver them. Those stay on the Mac and are released by op run with Touch ID, as decided in ADR-INFRA-003.
Decision Drivers (FRs & NFRs)
- BRD-INFRA-003 BR-1.4 — a workspace away from the contributor’s device cannot reach production credentials. Implemented by SR-INFRA-003.
- BRD-INFRA-004 BR-1.2 — AI assistants and agents are barred from reaching production, which a token in the container environment would undermine.
- Workspace rule 06 — the workspace environment holds no secret beyond what a rule allows.
- Workspace rule 10, section 4 — prefer federation or short-lived credentials over stored keys.
Decision — How the dev container authenticates to GitHub
Option 1 — Service account token in the container, PAT read at clone time
Pros:
- Works unattended, on a Mac, in a Codespace and in CI, with one mechanism.
- Needs no setup on the host beyond exporting one variable.
- No dependency on a desktop app: the password manager does not need to be installed, unlocked or integrated with the terminal on the host.
- Works for headless use, such as a dev container on a remote Docker host or an unattended task, where no person is there to approve.
Cons:
- The token sits in the container environment, readable by every process and extension, including an AI assistant.
- No Touch ID at use time, so any code in the container can read the vault the account covers.
- The PAT it unlocks is a long-lived bearer secret, scoped to whole repositories.
- Expiry and rotation of the service account become a recurring manual task.
- The blast radius is the whole vault the account can read, so a leaked environment variable exposes every secret in it, not one repository.
- The account is not tied to a person, so the password manager’s logs cannot attribute a read to an individual contributor. GitHub shows only the PAT’s owner.
- A malicious dependency, extension or AI agent in the container can send the environment to an outside host, and the value then works from anywhere until it is revoked.
Option 2 — PAT passed into the container from the Mac environment
Pros:
- Simple: one environment variable and one credential helper.
- Supports HTTPS remotes as they are, with no remote rewrite and no SSH key format to manage.
- Needs no agent process and no socket mount on the host.
Cons:
- The value is stored in the container’s metadata and visible to
docker inspectand to every process. - A bearer token is valid anywhere until it expires, so a leak is usable from outside the container.
- Breaks the rule that no secret is exported into a shell environment.
- The value is readable from the process environment (
/proc/<pid>/environ) by any process in the container, and appears in shell history if it is ever typed or exported by hand. - Anyone with access to the Docker socket can read it from the container metadata or an image export.
- A fine-grained PAT expires after one year at most and has no automatic renewal, so it fails at an unplanned moment and must be replaced by hand.
Option 3 — VS Code’s forwarded HTTPS credential helper
Pros:
- Works with no configuration; VS Code relays the host’s Git credentials.
Cons:
- The helper returns the real token to any process in the container that asks for it, so a plain
git credential fillreveals it. - Which token is returned depends on the host’s keychain state, which is not under the repository’s control.
- It works only while the container is attached through VS Code. A terminal attached with
docker exec, or another IDE, gets no Git authentication. - The host keychain releases the token without a prompt when the request comes from the container, so there is no per-use approval and no record of which process asked.
Option 4 — 1Password SSH agent forwarded from the Mac (CHOSEN)
Pros:
- The private key never leaves the password manager. VS Code forwards only the agent’s Unix socket, and Git inside the container sends a signing request through it.
- Each signing request is approved on the Mac, by Touch ID or Apple Watch according to the password manager’s authorization settings, so a process cannot sign silently while the vault is locked.
- Nothing to store, rotate or expire in the container: no token in the environment, nothing in the container metadata.
- Matches the intent of ADR-INFRA-002: the container can run Git but holds no credential.
- Any tool in the container that reads the forwarded socket variable can use it, including other terminals and sub-shells, not only the IDE. A tool outside VS Code needs the socket mounted separately.
- The password manager’s agent log on the Mac records each signing request with the requesting application and a timestamp, giving a per-use trail tied to the person.
- The key never exists in the container’s memory or disk. Only signature requests and their results cross the boundary.
Cons:
- Works for Git over SSH only. API tokens still come from
op runon the Mac and cannot be requested from inside the container. - Needs host setup: the SSH agent enabled in the password manager, the key added to GitHub, and the agent socket reachable by VS Code.
- Mac and desktop only. A Codespace has no agent to forward, so it can read public repositories or must use a separate, narrower credential.
- Approval is granted to the forwarded session. Depending on settings, one approval can cover several signing requests while the session lasts, so any process in the running container may sign during that window.
- An SSH key for a GitHub user covers every repository that user can reach. A repository-scoped deploy key narrows this but is one key per repository.
- Repository remotes must use SSH URLs, so the clone and sync scripts and the dev container definition change.
- A crashed container or VS Code session can leave a stale socket in the container, and Git then fails until the container is restarted or rebuilt.
- Private repositories outside the contributor’s own access, such as submodules from another organisation, need that key authorised there too. Public repositories need nothing extra.
- The host needs a one-time agent configuration, and the socket path differs between macOS and Linux hosts, so a setup script must handle both.
- The password manager protects the key with its own unlock and biometric, not with the Mac’s Secure Enclave, so the guarantee is the password manager’s and not the hardware’s.
Final Decision
The dev container authenticates to GitHub with the password manager’s SSH agent forwarded from the Mac. Option 1 is rejected because it puts a non-interactive, biometric-free key in the container. Option 2 is rejected for storing a bearer token in container metadata. Option 3 is rejected because any process in the container can read the token it returns.
The cost accepted is Mac-only Git access with host setup, remotes switched to SSH, and the narrower reach of an SSH signature: API tokens still need the host terminal. A Codespace is limited to unauthenticated or separately scoped access.
The dev container definition and the clone and sync scripts now use SSH remotes and the forwarded agent, with no token or PAT. How the agent socket reaches the container is decided in ADR-INFRA-009.