← Back to PRs

#21661: fix(agents): treat approval timeout as denial regardless of askFallback

by AI-Reviewer-QS open 2026-02-20 07:00 View on GitHub →
agents size: M
## Summary - When an exec approval request times out (`!decision`), the handler previously auto-approved the command if `askFallback === 'full'`, granting elevated permissions on timeout. - This removes the `askFallback === 'full'` auto-approve path in the timeout branch so that timeouts always result in denial with `deniedReason = "approval-timeout"`. - The `allowlist` fallback path is preserved: on timeout, allowlist-satisfied commands may still proceed, but unrestricted `full` fallback no longer auto-approves. ## Test plan - [ ] Verify that exec commands with `askFallback = 'full'` are denied when the approval request times out - [ ] Verify that `askFallback = 'allowlist'` still works correctly on timeout (allowlist-satisfied commands approved, others denied) - [ ] Verify that explicit user decisions (`allow-once`, `allow-always`, `deny`) are unaffected <!-- greptile_comment --> <h3>Greptile Summary</h3> Closes a security vulnerability where exec approval request timeouts would auto-approve commands when `askFallback = 'full'` is configured. The fix removes the auto-approval path on timeout, ensuring that timeouts always result in denial with `deniedReason = "approval-timeout"`. The `allowlist` fallback path is preserved correctly. - Removed unsafe auto-approval on timeout for `askFallback = 'full'` - Timeouts now consistently deny execution instead of granting elevated permissions - `allowlist` fallback continues to work as intended (allowlist-satisfied commands approved, others denied) Note: The parallel code in `bash-tools.exec-host-node.ts` still contains the same vulnerability (lines 206-208) and should be fixed in a follow-up. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge - it fixes a critical security vulnerability - The fix correctly closes a security hole where timeouts granted elevated permissions. However, the identical vulnerability exists in `bash-tools.exec-host-node.ts` and should be fixed as well. - Check `bash-tools.exec-host-node.ts` for the same vulnerability <sub>Last reviewed commit: f6abfea</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs