ADR-INFRA-013 — Separate Deployer User, Code Guard and Locked Assistant Policy
Status: Accepted Date: 2026-11-15 Authors: Engineering & Security Architecture Team
Context
ADR-INFRA-012 runs the engine inside the container with values released on the Mac. It accepted two limits: a process of the same user can read the engine’s environment while it runs, and edited code runs with the values. Both matter once an assistant works in the same container. An assistant, or an extension it installs, runs as the same user and can edit the .tf files the engine will run. Code in those files can run a program, load a provider that does, or send a value to a host the code chooses, without anyone reading the value.
This decision closes those two limits. It is cloud-neutral: the same pattern applies to any provider whose engine is OpenTofu. Specified in SR-INFRA-010.
Decision Drivers (FRs & NFRs)
- BRD-INFRA-004 BR-1.2 and BR-1.5 — the assistant cannot read a released value or make the engine send it elsewhere.
- BRD-INFRA-002 — no credential on disk, memory-only for the length of the task.
- Workspace rules 06, 10 and 11 section 9 — the assistant runs only in the dev container as the unprivileged user, and never runs
plan,applyor the guard.
Decision — How is the engine kept apart from an assistant in the same container?
Option 1 — Same user, review the diff before each run
Pros:
- Nothing to build. This is the state accepted by ADR-INFRA-012.
Cons:
- Review is the only control. A missed line in a long diff, or a module downloaded at
init, runs with every value. - Any process of that user can read the engine’s environment during the run.
Option 2 — A separate deployer user, a root-owned guard and a locked assistant policy (CHOSEN)
Pros:
- The operating system refuses
vscodeany read ofdeployer’s processes, plans, state or provider data. - The guard checks the code that will actually run, in a copy only
deployercan write, so a later edit cannot slip in. - A provider allowlist, a read-only lock file and an engine configuration with no local provider folder stop a new provider from running.
- The policy files are root-owned, so neither the assistant nor
vscodecan switch them off. They change only through a reviewed merge and a rebuild. - The assistant’s deny rules and env-guard hook are installed as managed settings, which outrank every other source.
- The same scripts serve every container and every provider. Only the allowlist changes.
Cons:
vscodelosessudo, so anything needing root happens in the build, and a policy change needs a rebuild.- The guard is pattern-based, so the plan is still read by a person before every apply (SR-NF-04).
- Workspace folders need shared group permissions so both users can work, and the guard needs a copy step, which costs time on large projects.
- The Mac scripts are trusted code that the container can push to, so a pulled change to them is read before use (SR-NF-03).
Option 3 — The engine in a separate container
Pros:
- A stronger boundary than a second user, with its own filesystem and no shared volume.
Cons:
- Two containers to build, start and keep in step, and a way to get reviewed code into the second one.
- More moving parts than a one-person workspace needs. Not built.
Option 4 — No assistant anywhere
Pros:
- Removes the risk at the source.
Cons:
- Gives up the speed benefit and pushes people to unofficial tools (ADR-INFRA-004).
Final Decision
Option 2. Every dev container is built the same way, in a fixed order: install the engine and password-manager CLI, install the assistant, install the managed policy, install the guard, and last remove vscode’s administrator rights, failing the build if they remain. The assistant’s managed policy is the whole project settings file, with hooks and permission rules from every other source ignored (ADR-AI-003). No container applies production: tofu-guard refuses any production run, and production is changed only by GitHub Actions workflows (ADR-INFRA-004). Option 3 is the next step if the same-container boundary proves too weak.
The cost accepted is a rebuild for every policy change, a pattern-based guard, and trust in the host scripts. The gain over ADR-INFRA-012 is that its two accepted limits do not depend on a person catching a bad line.
Supplements ADR-INFRA-012, whose Option 6 this implements.