Skip to content

fix: sanitize declarative post-install output - #846

Open
rustytrees wants to merge 1 commit into
indaco:mainfrom
rustytrees:security/post-install-output-sanitization
Open

fix: sanitize declarative post-install output#846
rustytrees wants to merge 1 commit into
indaco:mainfrom
rustytrees:security/post-install-output-sanitization

Conversation

@rustytrees

@rustytrees rustytrees commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

Declarative run-step stdout and stderr now pass through the existing terminal sanitizer. The Ruby-like DSL and declarative execution paths share the same child-pump implementation. JSON stdout suppression and MALT_ALLOW_RAW_POST_INSTALL=1 keep their existing behavior.

A formula controls both the executable and arguments for a declarative run step. Before this change, the child inherited the terminal directly and could emit OSC 52 clipboard writes or other active terminal controls. The regression runs a keg-local echo helper with an OSC 52 payload. Before the fix, the captured stream still contained byte 0x1b. After the fix, the visible text remains but the escape sequence is removed.

Related Issue

Closes #848.

Notes for Reviewers

The PoC run exited 1 with 2,424 of 2,425 tests passing. Verification after the fix completed with:

  • zig build: 8 of 8 steps succeeded
  • zig build test-one: 2,425 passed
  • zig build test-bin: 331 of 331 steps succeeded
  • zig build test: 331 of 331 steps succeeded; 5,060 tests passed and 3 skipped

The first full-suite attempt inherited HTTPS connections opened before a local firewall correction and was stopped with exit 130. A fresh run after the correction completed with the results above.

Pipe declarative run-step stdout and stderr through the same terminal sanitizer used by the native DSL. This prevents formula-controlled OSC 52 and other active terminal sequences from reaching the user by default.

Keep JSON stdout suppression and the explicit raw-output opt-out intact, and add a regression that captures the bytes emitted by a hostile run step.
@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!

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: declarative post-install output can inject terminal control sequences

2 participants