mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-30 23:14:32 -07:00
fix: enforce folder trust for workspace settings, skills, and context (#17596)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -43,6 +43,10 @@ export class ContextManager {
|
||||
}
|
||||
|
||||
private async loadEnvironmentMemory(): Promise<void> {
|
||||
if (!this.config.isTrustedFolder()) {
|
||||
this.environmentMemory = '';
|
||||
return;
|
||||
}
|
||||
const result = await loadEnvironmentMemory(
|
||||
[...this.config.getWorkspaceContext().getDirectories()],
|
||||
this.config.getExtensionLoader(),
|
||||
@@ -68,6 +72,9 @@ export class ContextManager {
|
||||
accessedPath: string,
|
||||
trustedRoots: string[],
|
||||
): Promise<string> {
|
||||
if (!this.config.isTrustedFolder()) {
|
||||
return '';
|
||||
}
|
||||
const result = await loadJitSubdirectoryMemory(
|
||||
accessedPath,
|
||||
trustedRoots,
|
||||
@@ -101,9 +108,7 @@ export class ContextManager {
|
||||
}
|
||||
|
||||
private markAsLoaded(paths: string[]): void {
|
||||
for (const p of paths) {
|
||||
this.loadedPaths.add(p);
|
||||
}
|
||||
paths.forEach((p) => this.loadedPaths.add(p));
|
||||
}
|
||||
|
||||
getLoadedPaths(): ReadonlySet<string> {
|
||||
|
||||
Reference in New Issue
Block a user