Repository navigation
fix(alias): preserve quoted words during alias reparse - #1439
Merged
chaliy merged 1 commit intoApr 24, 2026
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 0372dae | Commit Preview URL | Apr 24 2026, 08:17 AM |
chaliy
force-pushed
the
2026-04-24-propose-fix-for-alias-expansion-vulnerability
branch
from
April 24, 2026 08:16
6fb8a46 to
0372dae
Compare
chaliy
deleted the
2026-04-24-propose-fix-for-alias-expansion-vulnerability
branch
April 24, 2026 15:53
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
chaliy
added a commit
that referenced
this pull request
May 30, 2026
### Motivation - Alias expansion rebuilt a command string by serializing parsed `Word`/`Redirect` values via `Display`, dropping quoting context and allowing re-parsed arguments/redirects to be split or interpreted as shell syntax. ### Description - Add `format_word_for_alias_reparse` to emit quoted words with quoting/escaping preserved while keeping expansion parts intact. - Use `format_word_for_alias_reparse` when reconstructing alias-expanded arguments and when formatting redirect targets. - Keep unquoted words serialized via existing `Display` behavior to preserve previous semantics for non-quoted tokens. - Add two spec tests validating that quoted argument literalness and quoted redirect targets are preserved under `shopt -s expand_aliases` in `crates/bashkit/tests/spec_cases/bash/alias.test.sh`. ### Testing - Ran the bash spec suite test: `cargo test -p bashkit --test spec_tests bash_spec_tests -- --nocapture` which now passes (previous failing case fixed and overall spec tests passed). - Ran formatter check: `cargo fmt --check` which returned clean. - All changes are limited to `crates/bashkit/src/interpreter/mod.rs` and `crates/bashkit/tests/spec_cases/bash/alias.test.sh` and tests above succeeded. ------ [Codex Task](https://chatgpt.com/codex/cloud/tasks/task_e_69ead8dc5628832b9398ec5ef236c965)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Word/Redirectvalues viaDisplay, dropping quoting context and allowing re-parsed arguments/redirects to be split or interpreted as shell syntax.Description
format_word_for_alias_reparseto emit quoted words with quoting/escaping preserved while keeping expansion parts intact.format_word_for_alias_reparsewhen reconstructing alias-expanded arguments and when formatting redirect targets.Displaybehavior to preserve previous semantics for non-quoted tokens.shopt -s expand_aliasesincrates/bashkit/tests/spec_cases/bash/alias.test.sh.Testing
cargo test -p bashkit --test spec_tests bash_spec_tests -- --nocapturewhich now passes (previous failing case fixed and overall spec tests passed).cargo fmt --checkwhich returned clean.crates/bashkit/src/interpreter/mod.rsandcrates/bashkit/tests/spec_cases/bash/alias.test.shand tests above succeeded.Codex Task