Require confirmation for AI-driven interactive bash stdin and harden detection#169
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the pull request. A maintainer will review it when available. Please keep the PR focused, explain the why in the description, and make sure local checks pass before requesting review. Contribution guide: https://github.com/AI-Shell-Team/aish/blob/main/CONTRIBUTING.md |
|
This pull request description looks incomplete. Please update the missing sections below before review. Missing items:
|
Motivation
sudo/suby substring so prompt-injection (e.g.,echo sudo) cannot force the PTY handoff.Description
_needs_interactive_bashusingshlexto detect real command positions, wrappers, assignments and separators (file:src/aish/tools/code_exec.py).ToolPreflightAction.CONFIRMfromprepare_invocation(unless the exact command is already approved), and makeneed_confirm_before_execreturn True for interactive commands (file:src/aish/tools/code_exec.py).fail_opensandbox decisions by checking interactive detection before honoringfail_open(file:src/aish/tools/code_exec.py)./usr/bin/sudo,VAR=1 sudo,command sudo ...), avoid false positives for benign substrings, and assert the preflight confirmation behavior and exact-approved command behavior (file:tests/tools/test_bash_output_offload.py).Testing
python -m pytest tests/tools/test_bash_output_offload.py -qandpython -m pytest tests/tools/test_bash_output_offload.py tests/test_ask_user_tool.py -q, and all tests passed (13 passedfor the focused suite and31 passedfor the combined run).python -m ruff check src/aish/tools/code_exec.py tests/tools/test_bash_output_offload.py, which returned no issues.Codex Task