Repository navigation
Description
.dag: issue-dag/2
.id: flyingrobots/devcontainers#3
.kind: task
.type: feature
.blocked_by: [flyingrobots/devcontainers#2]
.size_hours: 8
source: Maintainer rule of 2026-11-08 (no host builds; ULTRAMAX PARANOIA hygiene)Feature
Read docs/hygiene.md sections 1 to 7 and 10.
Write bin/devrun (Python 3.9, standard library only): devrun <project> <repo> (--commit SHA | --history BASE..HEAD | --worktree) [--rust VERSION] [--fetch] [--network] [--export PATH ...] -- COMMAND.
Build the source tarball on the host: git archive, git bundle, or git ls-files. Check and rewrite every member on the host (no .git, no escaping symlink, no setuid or special file, owner 10001) before it reaches Docker.
Run phase 1 (cargo fetch --locked, network) and phase 2 (COMMAND, --network none) in separate containers named <project>-dev-run, with every privilege rule in section 2 and only the named volumes in section 5.
Wrap the run in git-locks (host/heavy-work and host/docker/<project>-dev/) with a timeout below the lease, and remove the container on every exit path.
Export only the declared paths, as regular files, into a fresh host folder outside every repository.
Add tests for the tar sanitizer and the argument handling, and one real-Docker smoke test.
Run every Docker command through the code under test or the workstation git-locks keys host/docker/devcontainers-dev/ and host/heavy-work. Never build or test on the host outside Docker.
1. Background Context
Builds and tests must not run on the host. Containers must not see or change any host repository (maintainer, 2026-11-08). The rules are in docs/hygiene.md.
2. Problem Description
No safe way exists to run a repository's gates in a container.
2b. Proposed Solution
A host-side runner that builds and checks the source tarball itself, then drives two short-lived, locked-down containers and exports only declared outputs.
2c. Alternatives considered and rejected
- Bind-mount the repository: rejected by the maintainer.
- Check the tarball inside the container: rejected, because a hostile archive must be refused before it reaches Docker.
2d. Acceptance Criteria
- The sanitizer refuses
.git, absolute or escaping symlinks, setuid and setgid bits, device files, and pipes, and it sets every owner to 10001. --historyproduces a clone whoseHEADequals the requested SHA and whoseorigin/mainequals the base.- Phase 2 runs with
--network none,--read-only,--cap-drop ALL,--security-opt no-new-privileges, user 10001, and limits. - A timeout or a failing command removes the container.
- Exports contain only regular files, in a fresh folder.
2e. Test Plan
Golden: devrun devcontainers . --commit HEAD -- true with a small test image.
Edges: an empty repository; a path with spaces; a commit that is not reachable.
Known failure modes: a tarball with a symlink to /etc; a .git file at a nested path.
Fuzz and stress: random tar member lists through the sanitizer.
3. Prerequisites
- Build the shared Rust base image flyingrobots/rust-dev #2: the base image.
4. Scope
In:
bin/devruncore: copy modes, sanitizer, privileges, network phases, lifecycle, locks, and exports.
Out:
- The Docker litter audit, receipts, and budgets (Add the Docker litter audit, run receipts, and budget checks to devrun #5).
Size: about 8 hours of focused work.
5. Why now
All local validation now goes through containers.
6. Risks
A gap in the sanitizer lets a hostile archive in. Test it with crafted archives.
7. Definition of Done
The runner is merged with tests, and a real run passes.
8. Stakeholders
- James Ross (maintainer).
Activity
[-]Write the guarded runner devrun with a Docker litter audit[/-][+]Write the guarded runner devrun (copy-in, isolation, network phases, lifecycle)[/+]flyingrobots commentedon Nov 8, 2026
Runner obligations from the Baker Street review of #6.
docs/hygiene.mdon that PR specifies them, and nothing enforces them untilbin/devrunlands. The currentfeat/devrunhead contradicts the first three./work. The copy is the root of a<project>-workvolume mounted at/work, with working directory/work. Todaybin/devruncopies into/scratch/work, under the persistent scratch volume./scratch/work,/scratch/inand/scratch/out, so a planted/scratch/.cargo/config.tomlsurvives. Cargo reads.cargo/config.tomlin the working directory and in every parent directory. A hostile run can also remove write permission from its own directories, so prep must restore it first, and it must fail if any entry is left..cargo/config*and norust-toolchain*files.cargo fetchmust run withRUSTUP_TOOLCHAIN=<image version>,RUSTC=/usr/local/cargo/bin/rustc, and emptyRUSTC_WRAPPERandRUSTC_WORKSPACE_WRAPPER. Evidence: in the image,cargo fetch --offlineran a repositorybuild.rustc-wrapper,build.rustcandpathtoolchain, and these overrides stopped all four hooks,rustc-workspace-wrapperincluded.host/docker/<project>-dev-run/, the workstation registry formhost/docker/<exact-container-name>/.GITHUB_ACTIONS=true, notCI=true./work/.cargo/config.tomland/scratch/.cargo/config.tomlwith an alias, and the next run must not see either.build.rustc,pathtoolchain) must not invoke it.Bring devrun up to the hygiene rules that landed with the base image