feat: add strict seatbelt profiles and remove unusable closed profiles#18876
feat: add strict seatbelt profiles and remove unusable closed profiles#18876SandyTao520 merged 2 commits intomainfrom
Conversation
…sable closed profiles
|
Hi there! Thank you for your contribution to Gemini CLI. To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md. This pull request is being closed because it is not currently linked to an issue. Once you have updated the description of this PR to link an issue (e.g., by adding How to link an issue: Thank you for your understanding and for being a part of our community! |
|
Hi @SandyTao520, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
Summary of ChangesHello @SandyTao520, 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 significantly refines the macOS seatbelt sandbox profiles for the CLI, prioritizing security and usability. It introduces new 'strict' profiles that enforce much tighter controls over file system access, limiting reads and writes to only necessary directories and files. Concurrently, it removes older 'closed' profiles that were impractical due to their complete network blocking. These changes aim to provide a more secure and functional sandboxing environment for the application. Highlights
Changelog
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces new, more secure strict-open and strict-proxied seatbelt sandbox profiles for macOS, which significantly improve security by restricting file reads to specific whitelisted paths and removing unusable *-closed profiles. However, the new strict-proxied profile currently allows unnecessary write access to sensitive user configuration files like .gitconfig and .npm. This could be leveraged for sandbox escape and should be addressed for tighter security. Additionally, while outside the scope of this PR, potential command injection vulnerabilities were noted in sandbox.ts and sandboxUtils.ts and are recommended for a separate security-focused PR.
|
Size Change: +5.55 kB (+0.02%) Total Size: 24.3 MB
ℹ️ View Unchanged
|
…iteral for .gitconfig writes
Summary
Add new
strict-openandstrict-proxiedseatbelt sandbox profiles that restrict both file reads and writes to the working directory. Removepermissive-closedandrestrictive-closedprofiles that block all network, making the CLI unusable.Details
Existing
restrictive-*profiles use(allow file-read*)which allows reading the entire filesystem. The newstrictprofiles whitelist reads to only TARGET_DIR, essential HOME dotfiles (.gemini,.npm,.cache,.nvm,.config), and system paths (/usr,/bin,/Library, etc.). Uses(allow file-read-metadata)globally for Node.js path traversal without exposing file contents.The
*-closedprofiles block all outbound network which prevents API calls entirely — removed as unusable.Related Issues
#18007
How to Validate
SEATBELT_PROFILE=strict-open gemini— verify CLI starts and worksls ~— should get "Operation not permitted"ls .— should work normallynpx vitest run packages/cli/src/utils/sandbox.test.ts packages/cli/src/utils/sandboxUtils.test.ts— 25 tests passPre-Merge Checklist