mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 06:25:16 -07:00
Allow @-includes outside of workspaces (with permission) (#18470)
This commit is contained in:
committed by
GitHub
parent
e73288f25f
commit
262e8384d4
@@ -1880,9 +1880,22 @@ export class Config {
|
||||
* Validates if a path is allowed and returns a detailed error message if not.
|
||||
*
|
||||
* @param absolutePath The absolute path to validate.
|
||||
* @param checkType The type of access to check ('read' or 'write'). Defaults to 'write' for safety.
|
||||
* @returns An error message string if the path is disallowed, null otherwise.
|
||||
*/
|
||||
validatePathAccess(absolutePath: string): string | null {
|
||||
validatePathAccess(
|
||||
absolutePath: string,
|
||||
checkType: 'read' | 'write' = 'write',
|
||||
): string | null {
|
||||
// For read operations, check read-only paths first
|
||||
if (checkType === 'read') {
|
||||
if (this.getWorkspaceContext().isPathReadable(absolutePath)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Then check standard allowed paths (Workspace + Temp)
|
||||
// This covers 'write' checks and acts as a fallback/temp-dir check for 'read'
|
||||
if (this.isPathAllowed(absolutePath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user