fix(core): conditionally expose additional_permissions in shell tool#23729
fix(core): conditionally expose additional_permissions in shell tool#23729
Conversation
Only expose the `additional_permissions` parameter in the `run_shell_command` schema when tool sandboxing is actually enabled in the configuration. This prevents the model from attempting to use sandbox expansion features when the sandbox is not active. Additionally, removes the hardcoded policy engine check for this parameter as it is no longer needed.
🧠 Model Steering GuidanceThis PR modifies files that affect the model's behavior (prompts, tools, or instructions).
This is an automated guidance message triggered by steering logic signatures. |
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 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 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 counter productive. 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: +302 B (0%) Total Size: 26.3 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces an enableToolSandboxing flag to conditionally include additional_permissions in shell tool declarations, propagating this new parameter across various tool definitions and configurations. A critical security regression has been identified, as the removal of a centralized check in the PolicyEngine means that sandbox expansion requests, previously downgraded to ASK_USER, could now be ALLOWed without user intervention in non-interactive modes, potentially granting unauthorized access.
Summary
This PR conditionally exposes the
additional_permissionsparameter in therun_shell_commandtool's schema, making it visible to the model only when tool sandboxing is enabled in the configuration (context.config.getSandboxEnabled()). It also removes a hardcoded policy engine check for sandbox expansion requests that is no longer needed.Details
Previously, the
additional_permissionsparameter was always included in therun_shell_commandschema, which could cause the model to attempt to use sandbox expansion features even when the sandbox was not active. This change ensures the schema accurately reflects the available capabilities based on the runtime configuration.Related Issues
How to Validate
additional_permissionsparameter should not be present in therun_shell_commandschema.additional_permissionsparameter should be present.npm run test -w @google/gemini-cli-core).Pre-Merge Checklist