Skip to content

feat: update BashTool command parsing logic - #6948

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

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

Conversation

@RinZ27

@RinZ27RinZ27 commented Jan 5, 2026

Copy link
Copy Markdown

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

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.

@github-actions

Copy link
Copy Markdown
Contributor

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.

@RinZ27RinZ27 changed the title Hardening BashTool input validationfeat: Harden BashTool input validationJan 9, 2026
@RinZ27RinZ27 changed the title feat: Harden BashTool input validationfeat: update BashTool command parsing logicJan 9, 2026
@thdxr
thdxrforce-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7CompareJanuary 30, 2026 14:37
@RinZ27

Copy link
Copy Markdown
Author

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 freeto 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.

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

1 participant

@RinZ27