fix(dsl): isolate formula environments - #842
Conversation
Expose only derived installation paths and a small set of build and locale variables to formula code. Apply the same environment to ENV reads, system commands, and captured subprocesses so parent credentials cannot cross the DSL boundary.
|
@rustytrees Thanks for the contribution! One small request: could you please instruct your agent to follow the PR template provided in the repository for PRs? It helps keep the PRs consistent and easier to review. Thanks! |
|
I published a runnable PoC for the parent-environment exposure fixed here: git clone https://github.com/rustytrees/malt-security-pocs.git
cd malt-security-pocs
git checkout bd0e2a4d088cc63c8a7ab1613e851d23808b5a4d
./scripts/run-poc.sh --malt /path/to/malt --expect vulnerable h08The runner uses Exact |
Description
Formula code now sees a small environment made from derived installation paths plus selected build and locale variables. Parent credentials and unrelated shell variables are unavailable through
ENVreads and are not inherited bysystemorsafe_popen_readchildren.Regression tests cover direct access to
MALT_GITHUB_TOKENand a child process that prints its environment.Related Issue
Closes #856.
Notes for Reviewers
Before the fix, the focused run had 64 passes and 2 failures. Verification after the fix completed with:
zig build test-one: 2,424 passedzig build test: 5,061 passed, 3 skippedzig build: 8 of 8 steps succeededgit verify-commitThe first full-suite attempt was interrupted with exit 130 after the local firewall held several test binaries. The retry completed with exit 0 after the firewall was cleared.