Skip to content

fix(dsl): confine mutation path variants - #836

Open
rustytrees wants to merge 1 commit into
indaco:mainfrom
rustytrees:security/dsl-mutation-confinement
Open

fix(dsl): confine mutation path variants#836
rustytrees wants to merge 1 commit into
indaco:mainfrom
rustytrees:security/dsl-mutation-confinement

Conversation

@rustytrees

@rustytrees rustytrees commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

Pathname and FileUtils mutation variants now use resolved boundary checks instead of lexical prefixes. The checks confine symlink destinations and targets for scalar, array, and hash forms.

The regression tests cover mkpath, unlink, install_symlink, ln_sf, and rm, including intermediate directory symlinks and outside targets.

Related Issue

Closes #855.

Notes for Reviewers

Verification completed:

  • Focused DSL builtins: 72 passed
  • zig build test-one: 2,424 passed
  • zig build test: 5,067 passed, 3 skipped
  • Commit signature verified with git verify-commit

Apply resolved boundary checks to Pathname and FileUtils mutation variants that only used lexical checks. Validate symlink destinations and targets for scalar, array, and hash forms so formula steps cannot mutate files outside the prefix through planted links.
@indaco

indaco commented Aug 13, 2026

Copy link
Copy Markdown
Owner

@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!

@rustytrees

Copy link
Copy Markdown
Contributor Author

I published a runnable PoC for the Pathname.mkpath confinement failure 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 h03

The runner uses malt migrate with an isolated synthetic Homebrew keg because Malt's tap installer does not execute def post_install. Migration reaches executeDslPostInstallFields, the native interpreter, and Pathname.mkpath. On exact efd2b99, the formula created /tmp/malt-security-poc-h03/created outside MALT_PREFIX. With the combined patched build containing this PR, migration completed and installed the package, but the outside directory remained absent.

This PoC dynamically covers Pathname.mkpath. The regression tests in this PR provide the broader coverage for Pathname.unlink, Pathname.install_symlink, FileUtils.ln_sf, FileUtils.rm, and the alternate argument forms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: native DSL mutation variants can write or delete outside the prefix

2 participants