mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 22:44:45 -07:00
fix(core): allow explicit write permissions to override governance file protections in sandboxes (#25338)
This commit is contained in:
@@ -409,6 +409,23 @@ export async function resolveSandboxPaths(
|
||||
? { gitWorktree: { worktreeGitDir, mainGitDir } }
|
||||
: undefined;
|
||||
|
||||
if (worktreeGitDir) {
|
||||
const gitIdentities = new Set(
|
||||
[
|
||||
path.join(options.workspace, '.git'),
|
||||
path.join(resolvedWorkspace, '.git'),
|
||||
].map(toPathKey),
|
||||
);
|
||||
if (policyRead.some((p) => gitIdentities.has(toPathKey(p)))) {
|
||||
policyRead.push(worktreeGitDir);
|
||||
if (mainGitDir) policyRead.push(mainGitDir);
|
||||
}
|
||||
if (policyWrite.some((p) => gitIdentities.has(toPathKey(p)))) {
|
||||
policyWrite.push(worktreeGitDir);
|
||||
if (mainGitDir) policyWrite.push(mainGitDir);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters out any paths that are explicitly forbidden or match the workspace root (original or resolved).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user