harness: document sandbox threat model and credential permission requirements

This commit is contained in:
damocles 2026-05-22 10:57:13 +02:00
parent 66f1568e8f
commit a6bd4cf502

View file

@ -353,6 +353,19 @@
# fail inside the container. Enable sandbox-fallback so builds that
# can't set up the sandbox (no user-namespaces in nspawn) fall back
# to unsandboxed local builds rather than failing outright.
#
# Security note (issue #240): unsandboxed builds run as `nixbld` users
# (non-root) and can read any world-readable file in the container.
# Mitigations in place:
# - /root/.claude (claude session) is mode 700, root-owned - nixbld
# users cannot access it.
# - /state/forge-token (Forgejo API token) is written at mode 0600 by
# hive-c0re/src/forge.rs - nixbld users cannot access it.
# All future credential files written to agent state dirs MUST be mode
# 0600 or stricter. Do NOT create world-readable secret files.
# Long-term fix: enable user namespaces in nspawn containers
# (--private-users=inherit) so the nix sandbox actually works and
# sandbox-fallback becomes a true last resort.
nix.settings.sandbox-fallback = true;
# `claude-code` is unfree. Each per-agent container's nixosConfiguration