Repository navigation
Conversation
|
📊 PR Size: size/L
|
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 refines the behavior of the 'YOLO' approval mode by allowing it to respect trusted environments while maintaining strict security boundaries. By enabling the system to bypass certain hardcoded prompts for build file edits and shell taint risks when in a trusted, active YOLO state, it improves the developer experience for autonomous workflows. The changes ensure that these overrides are safely gated by folder trust checks and administrative settings, preserving existing security invariants for untrusted or restricted contexts. 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
|
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
There was a problem hiding this comment.
Code Review
This pull request integrates the disableYoloMode configuration into the PolicyEngine and Scheduler via a new isYoloModeDisabled callback. It refactors the 'Build File Protection' and shell tool execution logic to bypass user confirmation prompts for build file modifications, untrusted flags, and taint risks only when an active, trusted YOLO mode is enabled (i.e., approval mode is YOLO, the folder is trusted, and YOLO mode is not disabled). Comprehensive unit tests have been added across the configuration, policy engine, scheduler, and shell tool modules to validate these behaviors under various combinations of trust and YOLO mode states. There are no review comments, so I have no feedback to provide.
Note: Security Review did not run due to the size of the PR.
|
Hi @DavidAPierce @spencer426 — reopening this cleanly as #30552 because #30268 hit the 14-day The branch is rebased on latest To unblock review and prevent another 14-day auto-close, could you let me know:
Thanks! |
574de2a to
384a440
Compare
|
Rebased onto latest @DavidAPierce @spencer426 @abhipatel12 @adamfweidman — since
Thanks! |
Summary
(Supersedes #30268, which passed
cla/google,E2E (Chained), and/gemini reviewwith 0 issues, but was auto-closed by the 14-day lifecycle bot over the Thanksgiving weekend while waiting forhelp wanted/eval-gatetriage.)Respect active, trusted YOLO mode (
--approval-mode=yolo/-y) in shell taint/build-file risk checks andPolicyEnginebuild file protection so autonomous interactive and headless (-y -p) YOLO runs are no longer interrupted by confirmation prompts or hard-denied (POLICY_VIOLATION) when editing build configuration files or running commands referencing external context (users are still hitting false-positive halts likegit log -n 1in YOLO mode on #29682).All indirect prompt-injection protections remain fully enforced in
default,auto_edit, andplanmodes, in untrusted folders (!isTrustedFolder()), when YOLO mode is administratively disabled (disableYoloMode/secureModeEnabled/isYoloModeDisabled()), when safety checkers (checkerRunner) deny/ask, and when higher-tier user/admin policy rules orBeforeToolhooks explicitly requireask_userordeny.Details
PolicyEngine&Config(packages/core/src/policy/types.ts,packages/core/src/policy/policy-engine.ts,packages/core/src/config/config.ts):isYoloModeDisabled?: () => booleantoPolicyEngineConfigand wired it fromConfig(isYoloModeDisabled: () => this.isYoloModeDisabled()), initializingthis.disableYoloModeprior toPolicyEngineconstruction.Build File Protectiondowngrade (ASK_USER/DENYonpackage.json,Makefile,BUILD.bazel, etc.) only whenthis.approvalMode === ApprovalMode.YOLO && this.isTrustedFolder() && !this.isYoloModeDisabled().ASK_USER/DENYpolicy rules and safety checkers continue to run unchanged.ShellToolInvocation(packages/core/src/tools/shell.ts):isActiveYoloMode()verifyingApprovalMode.YOLO,isTrustedFolder() !== false, and!isYoloModeDisabled().shouldConfirmExecute()to skip forcing confirmation forhasTaintedOrBuildFileRisk()when active YOLO mode is enabled (unlessforcedDecision === 'ask_user'from an explicit policy rule or hook).isCommandSubstitutionAllowed()so active YOLO mode delegates command substitution checks toPolicyEngine(yolo.tomlsetsallowCommandSubstitution = true) rather than unconditionally blocking onhasTaintedOrBuildFileRisk().hasTaintedOrBuildFileRisk()guard ingetPolicyUpdateOptions()so tainted commands never persist permanent"Always allow"rules.Scheduler(packages/core/src/scheduler/scheduler.ts):PolicyDecision.ALLOWtoASK_USER(interactive) orDENY(non-interactive/headless) forhasTaintedOrBuildFileRisk()only whenApprovalMode.YOLO,isTrustedFolder() !== false, and!isYoloModeDisabled().Security Invariants Preserved
default/auto_edit/planmodesASK_USER/DENYin headless)!isTrustedFolder())approvalMode === YOLOdisableYoloMode/secureModeEnabled)PolicyEngine,Scheduler, andShellToolInvocationASK_USER/DENYrules orBeforeToolhooks"Always allow"policy persistence for tainted commandsgetPolicyUpdateOptions()returnsundefined)--yolo/-y(interactive & headless-p)yolo.tomlwithout hardcoded interruptionRelated Issues
Fixes #30004
Related to #29682, #29680, #29687
Supersedes #30268
How to Validate
PolicyEngine,Config,ShellToolInvocation,Scheduler, and shell utils):npm test -w @google/gemini-cli-core -- src/policy/ src/config/config.test.ts src/tools/shell.test.ts src/scheduler/scheduler.test.ts src/utils/shell-utils.test.ts@google/gemini-cli-corebuild succeeded.lint:all), strict ESLint on modified files, and full monorepo typecheck:lint:allpassed (exit 0); 0 typecheck errors across all workspaces.nonInteractive) active trusted YOLO runs for build-file edits and tainted shell commandsisTrustedFolder() === false) still enforcing checks in YOLO modedisableYoloMode/isYoloModeDisabled() === true) still enforcing checks acrossPolicyEngine,Scheduler, andShellToolInvocationASK_USER/DENYrules andforcedDecision: 'ask_user'hooks still enforced in YOLO modePre-Merge Checklist
yolo.toml)