mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-28 05:55:17 -07:00
Implemented unified secrets sanitization and env. redaction options (#15348)
This commit is contained in:
committed by
GitHub
parent
2ac9fe08f7
commit
3b1dbcd42d
@@ -177,6 +177,7 @@ import {
|
||||
SimpleExtensionLoader,
|
||||
} from '../utils/extensionLoader.js';
|
||||
import { McpClientManager } from '../tools/mcp-client-manager.js';
|
||||
import type { EnvironmentSanitizationConfig } from '../services/environmentSanitization.js';
|
||||
|
||||
export type { FileFilteringOptions };
|
||||
export {
|
||||
@@ -284,6 +285,9 @@ export interface ConfigParameters {
|
||||
enableExtensionReloading?: boolean;
|
||||
allowedMcpServers?: string[];
|
||||
blockedMcpServers?: string[];
|
||||
allowedEnvironmentVariables?: string[];
|
||||
blockedEnvironmentVariables?: string[];
|
||||
enableEnvironmentVariableRedaction?: boolean;
|
||||
noBrowser?: boolean;
|
||||
summarizeToolOutput?: Record<string, SummarizeToolOutputSettings>;
|
||||
folderTrust?: boolean;
|
||||
@@ -340,6 +344,9 @@ export class Config {
|
||||
private mcpClientManager?: McpClientManager;
|
||||
private allowedMcpServers: string[];
|
||||
private blockedMcpServers: string[];
|
||||
private allowedEnvironmentVariables: string[];
|
||||
private blockedEnvironmentVariables: string[];
|
||||
private readonly enableEnvironmentVariableRedaction: boolean;
|
||||
private promptRegistry!: PromptRegistry;
|
||||
private resourceRegistry!: ResourceRegistry;
|
||||
private agentRegistry!: AgentRegistry;
|
||||
@@ -479,6 +486,10 @@ export class Config {
|
||||
this.mcpServers = params.mcpServers;
|
||||
this.allowedMcpServers = params.allowedMcpServers ?? [];
|
||||
this.blockedMcpServers = params.blockedMcpServers ?? [];
|
||||
this.allowedEnvironmentVariables = params.allowedEnvironmentVariables ?? [];
|
||||
this.blockedEnvironmentVariables = params.blockedEnvironmentVariables ?? [];
|
||||
this.enableEnvironmentVariableRedaction =
|
||||
params.enableEnvironmentVariableRedaction ?? false;
|
||||
this.userMemory = params.userMemory ?? '';
|
||||
this.geminiMdFileCount = params.geminiMdFileCount ?? 0;
|
||||
this.geminiMdFilePaths = params.geminiMdFilePaths ?? [];
|
||||
@@ -547,6 +558,7 @@ export class Config {
|
||||
terminalHeight: params.shellExecutionConfig?.terminalHeight ?? 24,
|
||||
showColor: params.shellExecutionConfig?.showColor ?? false,
|
||||
pager: params.shellExecutionConfig?.pager ?? 'cat',
|
||||
sanitizationConfig: this.sanitizationConfig,
|
||||
};
|
||||
this.truncateToolOutputThreshold =
|
||||
params.truncateToolOutputThreshold ??
|
||||
@@ -1069,6 +1081,15 @@ export class Config {
|
||||
return this.blockedMcpServers;
|
||||
}
|
||||
|
||||
get sanitizationConfig(): EnvironmentSanitizationConfig {
|
||||
return {
|
||||
allowedEnvironmentVariables: this.allowedEnvironmentVariables,
|
||||
blockedEnvironmentVariables: this.blockedEnvironmentVariables,
|
||||
enableEnvironmentVariableRedaction:
|
||||
this.enableEnvironmentVariableRedaction,
|
||||
};
|
||||
}
|
||||
|
||||
setMcpServers(mcpServers: Record<string, MCPServerConfig>): void {
|
||||
this.mcpServers = mcpServers;
|
||||
}
|
||||
@@ -1488,6 +1509,9 @@ export class Config {
|
||||
config.terminalHeight ?? this.shellExecutionConfig.terminalHeight,
|
||||
showColor: config.showColor ?? this.shellExecutionConfig.showColor,
|
||||
pager: config.pager ?? this.shellExecutionConfig.pager,
|
||||
sanitizationConfig:
|
||||
config.sanitizationConfig ??
|
||||
this.shellExecutionConfig.sanitizationConfig,
|
||||
};
|
||||
}
|
||||
getScreenReader(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user