Files
nixos-core/scripts
kiskaadee 667f8d19b9 fix(appctl): eliminate eval injection and enforce manifest env key validation
Eliminates arbitrary shell command injection via workload manifest environment
variables and strictly enforces POSIX identifier validation during schema parsing.

Previously, `scripts/appctl` evaluated environment dictionaries from `app.yaml`
using `eval "$(python3 ...)"`, allowing command substitution (e.g. `$(...)`, backticks)
and unescaped quotes in manifest values to execute arbitrary commands with host
privileges. Furthermore, `core_manifest.py` accepted unconstrained variable keys,
risking environment corruption via platform-reserved identifiers.

- Replace `eval` in `scripts/appctl` with a zero-evaluation NUL-delimited stream
  piped directly into `export "$k=$v"`, preserving environment values strictly as data.
- Enforce POSIX variable naming regex (`^[a-zA-Z_][a-zA-Z0-9_]*$`) in `core_manifest.py`
  and reject reserved environment identifiers (`PATH`, `LD_PRELOAD`, `IFS`, etc.).
- Add adversarial regression tests in `test_security_invariants.py` and unit tests
  in `test_core_manifest.py` verifying command substitution resilience.
- Track Pre-P4 Security Gate tasks in `todo.txt`.

Part of Pre-P4 Security Gate (Milestone P4 readiness).
2026-10-14 23:05:42 -05:00
..