fix(sandbox): make ~/.gitconfig read-only in the macOS sandbox#28221
fix(sandbox): make ~/.gitconfig read-only in the macOS sandbox#28221ompatel-aiml wants to merge 2 commits into
Conversation
|
📊 PR Size: size/XS
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request restricts write access to ~/.gitconfig under macOS Seatbelt sandbox profiles and introduces Human-In-The-Loop (HITL) confirmation requirements (ASK_USER) for modifying .gemini and .gitconfig paths within the workspace. The reviewer identified a critical security vulnerability where the path-checking loop can short-circuit on an ASK_USER decision, potentially bypassing subsequent DENY validations for other paths in multi-path tool calls. A refactoring of the check method was suggested to accumulate ASK_USER decisions and prioritize DENY outcomes.
Remove ~/.gitconfig from the file-write* allow list in all six macOS Seatbelt profiles so the sandboxed process can no longer modify the user's global git config (git config can drive command execution via aliases, core.pager, core.hooksPath, etc.). Read access is unchanged, so normal git operations are unaffected.
12627ad to
3c236de
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request removes the .gitconfig file path from various macOS sandbox configuration files, including the permissive, restrictive, and strict profiles for both open and proxied modes. This change prevents the sandboxed environment from accessing the user's global Git configuration. There are no review comments, and I have no feedback to provide.
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 improves the security posture of the application by restricting write access to the user's global Git configuration file within the macOS sandbox environment. By making 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
|
Summary
Remove
~/.gitconfigfrom the macOS Seatbelt sandbox's writable set so a sandboxed process can no longer modify the user's global git config. Git config can drive command execution (aliases,core.pager,core.hooksPath, etc.), so making it read-only under the sandbox closes that vector. Read access is unchanged, so normal git operations are unaffected.Details
packages/cli/src/utils/sandbox-macos-*.sb(all six profiles): remove the~/.gitconfigentry from the(allow file-write* …)block. Read access is preserved (the strict profiles keep it infile-read*; the others allow broad reads).~/.gitconfigbecomes read-only. No API/CLI breaking changes.Related Issues
N/A
How to Validate
Validated locally on macOS Seatbelt against all six profiles. Using a throwaway
HOME_DIRthat contains a.gitconfigfile, apply each profile withsandbox-exec(supplying each profile's(param …)values; keepINCLUDE_DIR_*pointed at a separate dir so the only thing that could permit a~/.gitconfigwrite is the rule under test):Result for every profile (permissive / restrictive / strict × open / proxied):
~/.gitconfig~/.gitconfigPre-Merge Checklist