fix(patch): cherry-pick 3627f47 to release/v0.42.0-preview.0-pr-26542 to patch version v0.42.0-preview.0 and create version 0.42.0-preview.1#26544
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the policy engine to ensure consistent behavior for redirected commands in automated approval modes. By removing the dependency on sandbox status for these specific modes, the engine now correctly maintains the intended trust level for agent actions, preventing unnecessary user prompts. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Size Change: -105 B (0%) Total Size: 34 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request updates the policy engine to allow shell redirections without user confirmation in both AUTO_EDIT and YOLO modes, even when a sandbox is not enabled, and adds a test case to verify this behavior in YOLO mode. Feedback identifies a security concern where AUTO_EDIT mode should still be restricted to sandbox environments to prevent unintended host file system access, whereas YOLO mode is intentionally designed to bypass such restrictions.
| if ( | ||
| sandboxEnabled && | ||
| (this.approvalMode === ApprovalMode.AUTO_EDIT || | ||
| this.approvalMode === ApprovalMode.YOLO) | ||
| this.approvalMode === ApprovalMode.AUTO_EDIT || | ||
| this.approvalMode === ApprovalMode.YOLO | ||
| ) { |
There was a problem hiding this comment.
The removal of the sandboxEnabled check in shouldDowngradeForRedirection allows shell redirections (e.g., >, >>, <) to be executed on the host system without user confirmation when in AUTO_EDIT mode. While YOLO mode intentionally allows this behavior even without a sandbox per project policy, AUTO_EDIT mode should still be restricted to sandbox environments for these operations to prevent unintended host file system access.
| if ( | |
| sandboxEnabled && | |
| (this.approvalMode === ApprovalMode.AUTO_EDIT || | |
| this.approvalMode === ApprovalMode.YOLO) | |
| this.approvalMode === ApprovalMode.AUTO_EDIT || | |
| this.approvalMode === ApprovalMode.YOLO | |
| ) { | |
| if ( | |
| (this.approvalMode === ApprovalMode.AUTO_EDIT && !(this.sandboxManager instanceof NoopSandboxManager)) || | |
| this.approvalMode === ApprovalMode.YOLO | |
| ) { |
References
- In YOLO mode, dangerous commands are intentionally allowed to proceed with an 'ALLOW' decision, even when no sandbox is active.
This PR automatically cherry-picks commit 3627f47 to patch version v0.42.0-preview.0 in the preview release to create version 0.42.0-preview.1.