{"record":{"id":"fc5cf4a3d253410f","repo":"google-gemini/gemini-cli","slug":"configuration-untrusted-workspace-detected-stri-fc5cf4","errorCode":null,"errorMessage":"[Configuration] Untrusted workspace detected. Stripping repository tools definitions to prevent unintended tool enablement.","messagePattern":"\\[Configuration\\] Untrusted workspace detected\\. Stripping repository tools definitions to prevent unintended tool enablement\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/a2a-server/src/config/config.ts","lineNumber":307,"sourceCode":"\n  if (!trusted) {\n    if (settings.mcpServers) {\n      logger.warn(\n        '[Configuration] Untrusted workspace detected. Stripping repository mcpServers definitions to prevent unintended command execution.',\n      );\n    }\n    if (settings.policyPaths) {\n      logger.warn(\n        '[Configuration] Untrusted workspace detected. Stripping repository policyPaths definitions to prevent unintended policy override.',\n      );\n    }\n    if (settings.adminPolicyPaths) {\n      logger.warn(\n        '[Configuration] Untrusted workspace detected. Stripping repository adminPolicyPaths definitions to prevent unintended admin policy override.',\n      );\n    }\n    if (settings.tools) {\n      logger.warn(\n        '[Configuration] Untrusted workspace detected. Stripping repository tools definitions to prevent unintended tool enablement.',\n      );\n    }\n    if (settings.telemetry) {\n      logger.warn(\n        '[Configuration] Untrusted workspace detected. Stripping repository telemetry definitions to prevent unintended data routing.',\n      );\n    }\n    settings = {\n      ...settings,\n      mcpServers: undefined,\n      policyPaths: undefined,\n      adminPolicyPaths: undefined,\n      tools: undefined,\n      telemetry: undefined,\n    };\n  }\n  const safeMcpServers = settings.mcpServers;","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/0bd1d439751478771c45d3d0895a6a9760554bf4/packages/a2a-server/src/config/config.ts#L289-L325","documentation":"Security warning from loadConfig: when the workspace is not trusted, repository-defined tools settings (core/exclude/allowed tool lists) are stripped so a cloned repo cannot enable or disable tools. Loading proceeds; the repo's tools configuration is ignored.","triggerScenarios":"loadConfig called with trusted=false while settings.tools exists in project settings; workspace trust not granted (folderTrust/GEMINI_FOLDER_TRUST not set).","commonSituations":"Cloned repo ships tools allowlists in project settings; running in a sandbox/CI where trust was never granted; after enabling folder-trust enforcement, previously working tool enablement silently stops.","solutions":["Enable workspace trust (settings.folderTrust=true or GEMINI_FOLDER_TRUST=true and trusted=true on loadConfig)","Move the tools configuration to user-level/global settings, which are not stripped","Remove repo-level tools settings if not required","Accept the warning: the server runs with default tool configuration"],"exampleFix":"// before\n// untrusted workspace + project settings: { \"tools\": { \"core\": [\"write_file\"] } } -> stripped\n// after\nexport GEMINI_FOLDER_TRUST=true\n// or user-level settings:\n{ \"folderTrust\": true, \"tools\": { \"core\": [\"write_file\"] } }","handlingStrategy":"validation","validationCode":"export function assertToolsSurvive(settings: { tools?: unknown; folderTrust?: boolean }): void {\n  const trusted = settings.folderTrust === true || process.env['GEMINI_FOLDER_TRUST'] === 'true';\n  if (!trusted && settings.tools) {\n    throw new Error('Workspace is untrusted: repository tools configuration will be stripped. Enable folderTrust or move tools config to user settings.');\n  }\n}","typeGuard":"function isTrustedWorkspace(s: { folderTrust?: boolean }): boolean {\n  return s.folderTrust === true || process.env['GEMINI_FOLDER_TRUST'] === 'true';\n}","tryCatchPattern":null,"preventionTips":["Place tools allow/exclude lists in user-level settings","Enable folder trust deliberately per workspace","Diff effective tool config against expectations after loadConfig","Do not enable trust automatically for cloned repos"],"tags":["security","configuration","workspace-trust","tools"],"backgroundTag":"untrusted-workspace-settings-stripped","analyzedSha":"0bd1d439751478771c45d3d0895a6a9760554bf4","analyzedAt":"2026-09-01T05:28:28.590Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}