Files
nixos-core/todo.txt
T
kiskaadee 8356819f08 fix(gitops): harden compose validator against relative traversal, tenant escape, and breakouts
Closes containment and privilege escalation bypasses in validate_compose_security()
by enforcing strict path resolution, cross-tenant state isolation, and capability bans.

Previously, `validate_compose_security()` only inspected absolute host paths starting
with `/` or `~`, allowing relative traversal paths (`../../Core/nixos`) to skip
validation entirely. Furthermore, state root containment was evaluated against the
parent `~/var/lib/homelab`, allowing one workload to mount another workload's state,
and container breakouts (`cap_add`, `devices`, host namespaces, top-level `include`)
were not inspected.

- Resolve relative host paths against `allowed_root` and enforce containment strictly
  within either the workload root or the workload's dedicated state root
  (`~/var/lib/homelab/<app_name>/`), blocking cross-tenant state directory access.
- Reject container breakout capabilities (`cap_add`, `devices`), unconfined security
  profiles, host namespaces (`pid: host`, `ipc: host`, etc.), and top-level `include`.
- Reject `docker-compose.yml` symlinks that escape the workload root.
- Add 12 adversarial regression tests in `test_gitops_security.py`.
- Mark Pre-P4 compose hardening task completed in `todo.txt`.

Part of Pre-P4 Security Gate (Milestone P4 readiness).
2026-10-15 01:52:08 -05:00

27 lines
3.3 KiB
Plaintext

x 2026-10-13 (A) Create core_manifest.py schema and parser with strict transport validation (https, ssh, git) and ref classification in scripts/core_manifest.py +manifest @core
x 2026-10-13 (A) Implement unit tests for core_manifest.py covering valid manifests, invalid URLs, and ref types in tests/unit/test_core_manifest.py +test @core
x 2026-10-13 (B) Implement two-axis inspection engine in appctl evaluating local checkout state independently from upstream provenance +provenance @appctl
x 2026-10-13 (B) Implement bounded git ls-remote provenance resolver with 10s timeout for appctl status --fetch +provenance @appctl
x 2026-10-13 (B) Add unit tests for provenance resolution and timeout handling with mocked network fixtures in tests/unit/test_provenance.py +test @appctl
x 2026-10-13 (C) Promote scripts/appctl_engine_v2.py to authoritative scripts/appctl_engine.py +engine @appctl
x 2026-10-13 (C) Verify full test suite and update CLI wrappers for appctl v2 engine promotion +test @appctl
x 2026-10-13 (A) Reconcile appctl implementation inventory and document caller/dependency map in docs/plans/p4-readiness-plan.md +inventory @p4-gate
x 2026-10-13 (A) Define canonical command and error contract across dual transports in docs/plans/p4-readiness-plan.md +contract @p4-gate
x 2026-10-13 (A) Close authorization design enforcing token-everywhere policy in docs/plans/p4-readiness-plan.md +auth @p4-gate
x 2026-10-13 (B) Specify daemon execution and privilege boundaries for Docker, subprocesses, and filesystem roots in docs/plans/p4-readiness-plan.md +security @p4-gate
x 2026-10-13 (B) Define append-only audit telemetry schema, lifecycle, and failure handling semantics in docs/plans/p4-readiness-plan.md +audit @p4-gate
x 2026-10-13 (C) Establish P4 acceptance test matrix and definition of done before daemon implementation in docs/plans/p4-readiness-plan.md +test @p4-gate
x 2026-10-14 (A) Eliminate eval in scripts/appctl and enforce strict env key validation in scripts/core_manifest.py +security @appctl
x 2026-10-15 (A) Enforce deployments.yaml as sole registry and remove dynamic discovery fallback in scripts/gitops_dispatcher.py +registry @gitops
x 2026-10-15 (A) Harden validate_compose_security in scripts/gitops_dispatcher.py blocking relative traversal, cross-tenant mounts, and privilege escalation +compose @gitops
(A) Unify manifest parsing on core_manifest.py and eliminate duplicate parsers in scripts/appctl_engine.py +manifest @engine
(A) Scaffold asyncio daemon server supporting dual transports (Unix socket /run/homelab/appctl.sock and HTTP) in scripts/appctl_daemon.py +daemon @p4
(A) Implement unit and integration tests for dual-transport requests and error handling in tests/unit/test_appctl_daemon.py +test @p4
(B) Implement command-oriented operational router wiring domain actions to in-process appctl_engine.py methods and fixed subprocess executions +router @p4
(B) Implement token authentication middleware validating user-scoped Bearer tokens for mutating requests +auth @p4
(B) Implement append-only audit logger writing structured RFC JSONL records with fail-closed disk guard +audit @p4
(C) Re-implement scripts/appctl as a thin client dispatching JSON requests to the daemon Unix domain socket +cli @p4
(C) Create NixOS systemd unit module for homelab-appctl.service with strict sandboxing and socket management +nixos @p4