Skip to content

Fix shell injection in cd commands via proper path quoting#11620

Open
atharvasindwani23 wants to merge 1 commit into
warpdotdev:masterfrom
atharvasindwani23:atharvasindwani23/fix-cd-path-shell-quoting
Open

Fix shell injection in cd commands via proper path quoting#11620
atharvasindwani23 wants to merge 1 commit into
warpdotdev:masterfrom
atharvasindwani23:atharvasindwani23/fix-cd-path-shell-quoting

Conversation

@atharvasindwani23
Copy link
Copy Markdown

Summary

  • Replaced unsafe format!("cd \"{path}\"") with shell_words::quote in open_repo_folder and AI conversation restoration
  • Double-quoted interpolation allows shell expansion of $, backticks, \, and " in directory paths — a path like /tmp/my$(id)/project would execute arbitrary commands
  • Now uses shell_words::quote which is already used correctly elsewhere in the codebase for the same purpose (e.g. workspace/view.rs:7437)

Test plan

  • Open a repo folder whose path contains a $ character (e.g. /tmp/my$var/repo) — verify cd executes without shell expansion
  • Restore an AI conversation whose working directory contains special characters — verify correct cd
  • Verify normal paths (no special chars) continue working as before

Replace double-quoted path interpolation (`cd "$path"`) with
`shell_words::quote` to prevent shell expansion of `$`, backticks,
and other metacharacters in directory paths. This matches the
quoting approach already used elsewhere in the codebase (e.g.
workspace/view.rs, context_chips/display_chip.rs).
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 24, 2026

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Atharva Sindwani.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 24, 2026

@atharvasindwani23

This PR is not linked to an issue that is marked with ready-to-implement.

Issue-state enforcement details:

  • Associated same-repo issues checked: none

  • Required readiness label: ready-to-implement

To continue, link this PR to a same-repo issue such as Closes #123 in the PR description, and make sure that issue has ready-to-implement.

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 24, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atharvasindwani23

This PR is not linked to an issue that is marked with ready-to-implement.

Issue-state enforcement details:

  • Associated same-repo issues checked: none

  • Required readiness label: ready-to-implement

To continue, link this PR to a same-repo issue such as Closes #123 in the PR description, and make sure that issue has ready-to-implement.

Powered by Oz

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

Labels

external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant