Skip to content

feat: update BashTool command parsing logic#6948

Closed
RinZ27 wants to merge 1 commit intoanomalyco:devfrom
RinZ27:security/harden-bash-exec
Closed

feat: update BashTool command parsing logic#6948
RinZ27 wants to merge 1 commit intoanomalyco:devfrom
RinZ27:security/harden-bash-exec

Conversation

@RinZ27
Copy link
Copy Markdown

@RinZ27 RinZ27 commented Jan 5, 2026

Refined the command parsing logic in BashTool by adding a check for empty command arrays during tree-sitter traversal. This prevent processing malformed shell structures that could lead to unexpected execution behavior.

Security Risk: Potential for command injection or agent escape if malformed input nodes are processed without validation.

Fixes #7478
Fixes #7504

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 5, 2026

The following comment was made by an LLM, it may be inaccurate:

Duplicate PR Search Results

No duplicate PRs found.

The search results only returned the PR itself (PR #6948), which is expected. Additional searches for related security and validation terms yielded no other open PRs addressing:

  • BashTool security hardening
  • Command injection prevention
  • Shell syntax validation

Conclusion: This PR appears to be unique and is not duplicating any existing open pull requests in the repository.

@RinZ27 RinZ27 force-pushed the security/harden-bash-exec branch 3 times, most recently from 09e4a65 to c6e3a8c Compare January 9, 2026 12:58
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 9, 2026

Hey! Your PR title Hardening BashTool input validation doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@RinZ27 RinZ27 changed the title Hardening BashTool input validation feat: Harden BashTool input validation Jan 9, 2026
@RinZ27 RinZ27 changed the title feat: Harden BashTool input validation feat: update BashTool command parsing logic Jan 9, 2026
@RinZ27 RinZ27 force-pushed the security/harden-bash-exec branch 3 times, most recently from c7a6121 to fd0af82 Compare January 11, 2026 09:20
@RinZ27 RinZ27 requested a review from adamdotdevin as a code owner January 11, 2026 09:20
@RinZ27 RinZ27 force-pushed the security/harden-bash-exec branch 3 times, most recently from 8df4f17 to b03ff60 Compare January 12, 2026 08:23
@thdxr thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@RinZ27 RinZ27 force-pushed the security/harden-bash-exec branch 2 times, most recently from 2e4349d to cb3320f Compare January 30, 2026 15:43
@RinZ27
Copy link
Copy Markdown
Author

RinZ27 commented Mar 26, 2026

Closing this in favor of PR #19290, which implements a more comprehensive security hardening for BashTool including full tree-sitter node validation and environment sanitization. @thdxr please review #19290 instead.

@RinZ27 RinZ27 deleted the security/harden-bash-exec branch March 26, 2026 13:30
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.

BashTool input validation security hardening An agent is able to read all filesystem outside a project directory in Plan mode

1 participant