fix(core): ensure global temp directory is always in sandbox allowed paths#24638
fix(core): ensure global temp directory is always in sandbox allowed paths#24638
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 addresses issues where custom sandbox configurations were inadvertently excluding essential system paths, specifically the global temporary directory. By enhancing the sandbox configuration schema and updating the file system service to respect these additional allowed directories, the changes ensure that critical paths remain accessible within the sandbox environment while maintaining security boundaries. 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: -1.96 kB (-0.01%) Total Size: 34 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces the includeDirectories configuration for the sandbox, allowing for more granular control over accessible paths beyond the primary workspace. It updates the SandboxedFileSystemService to validate access against these directories and ensures the global temporary directory is always included in the allowed paths. However, two critical issues were identified: first, the includeDirectories and allowedPaths are not being correctly merged and propagated to the sandbox manager during initialization, which will cause legitimate access to be blocked. Second, the workspace path in the file system service should be resolved to its real path to prevent incorrect access denials and potential path traversal vulnerabilities when symlinks are involved.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…paths (google-gemini#24638) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…paths (google-gemini#24638) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…paths (google-gemini#24638) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
This PR ensures that the global Gemini temporary directory (
Storage.getGlobalTempDir()) is always included in the sandbox allowed paths, regardless of user configuration. This fixes test failures inpackages/core/src/config/config.test.tswhere custom sandbox paths were overriding the essential global temp directory.Details
packages/core/src/config/config.ts'sgetSandboxAllowedPathsto explicitly push the global temp directory if not already present.includeDirectoriessupport toSandboxConfigandConfigSchemato properly propagate allowed paths to the sandbox managers.SandboxedFileSystemServiceto validate paths against theseincludeDirectories.getOptions()to theSandboxManagerinterface and implemented it in all platform-specific managers (Linux, MacOS, Windows) andNoopSandboxManager.Related Issues
Fixes sandbox configuration issues where essential system paths were being excluded when custom
allowedPathswere provided.How to Validate
Run the unit tests for the core package:
npm test -w @google/gemini-cli-core -- src/config/config.test.tsAll 203 tests should pass.
Pre-Merge Checklist