Disclaimer: This document was largely generated with the assistance of an LLM, using best-effort analysis and established security practices. AI-generated security documentation can contain errors or omissions — as can human-written documentation. Treat this as a starting point for your own assessment, not a definitive audit. Corrections and pull requests are welcome.
This document describes the security model for construct, focusing on how
credentials are handled and what guarantees (and non-guarantees) the tool
provides.
~/.construct/.env ─┐
.construct/.env ─┴─► in-memory map ──► per-key temp file (0600) ──► /run/secrets/<KEY>
│
entrypoint wrapper
│
env var inside container
-
At rest — credentials are stored as plain text in
~/.construct/.env(global) and/or.construct/.env(per-repo). Both files are created with0600permissions (owner read/write only). No encryption is applied. -
In transit to the container — at run time, each
AuthEnvVarcredential is written to its own0600temp file inside aconstruct-secrets-*temp directory. The entire directory is bind-mounted read-only at/run/secretsinside the container. The temp directory is removed withos.RemoveAllonce the agent container exits. -
Inside the container — credentials are mounted as read-only files at
/run/secrets/<KEY>via a bind mount (-v secretsDir:/run/secrets:ro). A generic entrypoint wrapper (/usr/local/bin/construct-entrypoint) reads each file and exports it as an environment variable beforeexec-ing the tool command.
| Threat | Status |
|---|---|
Credential values visible in docker inspect <container> |
✅ Protected — secrets are not env vars at the Docker layer |
Credential values in docker run process args (ps aux) |
✅ Protected — --secret src=file is used instead of -e KEY=val |
| Threat | Status |
|---|---|
| Credentials at rest on the host | ❌ Plain text in .env files; protected only by filesystem permissions |
Credentials visible inside the container via /proc/1/environ |
❌ The entrypoint exports them as env vars; any process inside the container can read them |
| Host user with Docker socket access | ❌ Anyone who can run docker on the host can inspect volumes and networks |
| DinD daemon TLS | ❌ The inner Docker daemon runs without TLS on port 2375; accessible to anything on the session bridge network |
| Temp secret files during the session | 0600 and removed on exit; a root process or another process running as the same user on the host could read them during the session |
- Restrict access to the Docker socket (
/var/run/docker.sock) to trusted users only. - Set
0600on~/.construct/.env(done automatically byconstruct config set). - Do not commit
.construct/.envto version control. Add it to.gitignore. - Rotate credentials if the host is shared or considered compromised.
- Prefer short-lived credentials (e.g. temporary tokens) where the tool supports them.
- Threat model — full catalogue of threats, mitigations, residual risks, and trade-offs
- ADR 001 — Docker secrets for credentials