ADR-INFRA-012 — Running Privileged Commands for the Dev Container

By Engineering & Security Architecture Team•November 11, 2026•4 min read

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

Context

The dev container holds the pinned toolchain and the working copy of the code (ADR-INFRA-002). Editing, formatting and validation need no credential and run there. A plan or an apply does: it needs a cloud token, the state storage keys and the passphrases.

The password manager releases a credential only after a fingerprint approval, and that approval and the desktop app cannot be reached from inside the container. The container also hosts AI assistants and other extensions, so any value placed in its environment, its definition or its files is readable by all of them. ADR-INFRA-008 and ADR-INFRA-009 settled this for Git by forwarding a signing agent. That agent serves SSH keys only and cannot release a vault item, so the same route does not carry a cloud credential.

The question is how a plan or an apply gets its values while the toolchain and the code stay in the container and the container keeps no credential.

Decision Drivers (FRs & NFRs)

  • BRD-INFRA-002 BR-1.2, BR-1.3, BR-1.4 and BR-1.5 — no credential on disk, a physical approval for each release, memory-only for the length of the task, references only in the repository.
  • BRD-INFRA-003 BR-1.1, BR-1.2 and BR-1.4 — one toolchain at one version, a clean workstation, and a workspace that holds no production credential.
  • BRD-INFRA-004 BR-1.2 — assistants and agents get the narrowest access.
  • SR-INFRA-003 SR-F-03, SR-F-04, SR-F-08 and SR-NF-04 — no credential in the container definition, plan and apply released from the Mac, and the exposure window of a handed-over value.
  • SR-INFRA-002 SR-F-04, SR-F-05, SR-F-06 and SR-F-08 — the runner releases values to one child process after an approval, and the assistant may run it only around the infrastructure tools.
  • Workspace rules 06, 10 (section 4) and 12 — no credential retrieval code, a stored credential only where federation does not exist, and values only through the runner.

Decision — How a plan or an apply receives its credentials

Option 1 — Run on the Mac host from a second copy of the code

Pros:

  • The simplest path. Nothing crosses into the container.
  • The runner works exactly as SR-INFRA-002 describes.

Cons:

  • The Mac needs its own copy of the code, and the changes made in the container have to be pushed and pulled before every run.
  • The Mac needs the engine and the password-manager CLI at its own versions, which gives up the single pinned toolchain and the clean workstation.
  • The code that runs is not the code that was validated in the container, unless the copies are kept in step by hand.

Option 2 — The Mac runner starts the command inside the running container (CHOSEN)

Pros:

  • The approval, the release and the masking stay on the Mac, as in SR-INFRA-002. Each run needs a fresh fingerprint approval.
  • The values reach only the environment of the one process started in the container, and that process ends with the command. They are not in the container definition, its stored configuration, its image or its volume.
  • The variable names are passed without their values, so no value appears on a command line or in shell history.
  • The engine and the code are the container’s, so the command that runs is the one that was validated, and no second copy exists.
  • No new credential, no stored token and no new identity is introduced.

Cons:

  • A process in the container that runs as the same user can read the environment of the command while it runs. The window is the length of the command, and the limit is accepted.
  • Code changed inside the container runs with the values on the next plan, so the diff must be reviewed before each run.
  • The container must be running and the command must name it, so the long form needs a wrapper that builds the variable list from the reference template.
  • Anyone with access to the container runtime on the Mac can start the same command, so the Mac stays the trust boundary.

Option 3 — A service account token set in the container’s environment

Pros:

  • Runs inside the container with no Mac step and no approval.

Cons:

  • The token sits in the environment of every process in the container and in the stored container configuration for as long as it runs. Every assistant and extension can read it.
  • The vault it opens holds every credential the layer uses, so one read releases all of them.
  • No per-run approval, which breaks BR-1.3 of BRD-INFRA-002.
  • A committed definition that reads the token from the Mac breaks the rule that the container definition holds no credential.

Option 4 — The same token, typed into a terminal for each session

Pros:

  • Nothing is stored. The token disappears when the terminal closes.

Cons:

  • Every run starts with a paste of a long-lived value, and the person must hold it somewhere to paste it.
  • The container then holds a service identity while the terminal is open, which SR-INFRA-003 SR-F-03 rules out, and the vault it opens is still read as a whole.
  • Same-user processes can read it for as long as the terminal lives, which is longer than a single command.

Option 5 — The same token held in the Mac’s operating-system key store and read by a wrapper

Pros:

  • No paste and no per-run approval, so the daily flow is the quickest of the options.

Cons:

  • It creates a standing credential on the Mac outside the password manager’s hardware approval. Any process the person runs can read it.
  • It drops the per-run approval required by BR-1.3 of BRD-INFRA-002.
  • It needs a retrieval path from the operating system’s store, which workspace rules 06 and 12 forbid. Adopting it would first need those rules changed.

Option 6 — A separate unprivileged user inside the container runs the engine

Pros:

  • Stops processes of the main user, such as assistants, from reading the environment of the command, because the operating system refuses cross-user reads.

Cons:

  • It only holds if the main user has no administrator rights, and the base image grants them by default. Removing them changes how the container is built.
  • The workspace files need shared group permissions so both users can write, and Git needs to trust the folder for the second user.
  • It does not stop edited code from running with the values, so the review of the diff is still needed.

Option 7 — Start the IDE through the runner

Pros:

  • One approval at launch, and no wrapper for each command.

Cons:

  • The values live in the IDE’s environment and, through the container definition, in every process in the container for as long as the IDE stays open.
  • An IDE that is already running takes the request over, and the values never reach it, so the launch can fail silently.
  • The whole IDE and its extensions on the Mac receive the values as well.

Final Decision

Plan and apply run the engine inside the dev container, and the Mac runner starts that command in the container, handing over the values to that one process. Option 1 is rejected because it duplicates the code and the toolchain. Options 3, 4 and 7 are rejected because they leave a credential readable by every assistant in the container for longer than the command. Option 5 is rejected because it removes the per-run approval and relies on a retrieval path the workspace rules forbid.

The cost accepted is that a same-user process can read the command’s environment while it runs, that edited code runs with the values, and that the person needs the container running and a wrapper to build the command. Option 6 can be added later on top of this decision to close the first of those without changing anything else. The security gain over Options 3 and 4 is that no value outlives the command, and the approval on the Mac remains the control.