fix: remove rbash — too restrictive for practical use#2629
Merged
tusharmath merged 11 commits intoantinomyhq:mainfrom Mar 23, 2026
Merged
fix: remove rbash — too restrictive for practical use#2629tusharmath merged 11 commits intoantinomyhq:mainfrom
tusharmath merged 11 commits intoantinomyhq:mainfrom
Conversation
When the default shell is set to rbash, shell commands fail because rbash restricts many operations needed for normal command execution. This adds a resolve_shell() function that detects rbash and falls back to /bin/bash, /bin/zsh, or /bin/sh (in that order), applied in both the environment shell resolution and the command executor. Closes antinomyhq#2559 Signed-off-by: majiayu000 <1835304752@qq.com>
|
|
tusharmath
reviewed
Mar 22, 2026
Replace resolve_shell() fallback logic with simply using bash instead of rbash, as suggested in PR antinomyhq#2629 review. Signed-off-by: majiayu000 <1835304752@qq.com>
tusharmath
reviewed
Mar 22, 2026
The shell resolution is already handled in env.rs get_shell_path(), so the conditional in executor.rs was unnecessary duplication. Remove the restricted field from ForgeCommandExecutorService entirely. Signed-off-by: majiayu000 <1835304752@qq.com>
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.
Summary
Remove
rbash(restricted bash) as the shell used in restricted mode, as it was too restrictive to be useful and prevented normal operations from working.Context
Restricted mode (
--restricted/-rflag) was previously implemented by swapping the user's shell for/bin/rbash, the restricted variant of bash. While this sounds like a security feature,rbashblocks so many basic operations (path execution, directory changes, redirects) that the agent couldn't do anything meaningful. The intended security boundary is better enforced through the existing permissions feature, not at the shell binary level.Changes
crates/forge_infra/src/env.rs: Removed therbashbranch fromget_shell_path()— restricted mode now falls through to the same shell resolution as unrestricted mode (user's$SHELLor/bin/sh). Updated doc comment to reflect the new semantics.crates/forge_infra/src/executor.rs: Removed therbashoverride inprepare_command()that was forcingrbashregardless of the configured shell.crates/forge_main/src/cli.rs: Updated the--restrictedflag description to clarify it enables the permissions feature, not a restricted shell.crates/forge_services/src/tool_services/shell.rs: Removed stale doc comment referencingrbash.Testing
Links