{"record":{"id":"e25f26d6dd59dee7","repo":"google-gemini/gemini-cli","slug":"configuration-untrusted-workspace-detected-stri-e25f26","errorCode":null,"errorMessage":"[Configuration] Untrusted workspace detected. Stripping repository adminPolicyPaths definitions to prevent unintended admin policy override.","messagePattern":"\\[Configuration\\] Untrusted workspace detected\\. Stripping repository adminPolicyPaths definitions to prevent unintended admin policy override\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/a2a-server/src/config/config.ts","lineNumber":302,"sourceCode":"\n  const approvalMode =\n    getEnvLocal('GEMINI_YOLO_MODE') === 'true'\n      ? ApprovalMode.YOLO\n      : ApprovalMode.DEFAULT;\n\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,","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/0bd1d439751478771c45d3d0895a6a9760554bf4/packages/a2a-server/src/config/config.ts#L284-L320","documentation":"Security warning from loadConfig: when the workspace is not trusted, repository-defined adminPolicyPaths are stripped to prevent a cloned repo from escalating privileges via admin policy files. Loading proceeds; only repo-supplied adminPolicyPaths are ignored.","triggerScenarios":"loadConfig called with trusted=false while settings.adminPolicyPaths is present in project settings; folder trust not enabled (folderTrust=false and GEMINI_FOLDER_TRUST!=true).","commonSituations":"Repositories that ship admin policy paths for internal tooling being cloned and run without trust; CI environments where the trust env var is absent; upgrading to a version that introduced adminPolicyPaths stripping.","solutions":["Enable workspace trust (settings.folderTrust=true or GEMINI_FOLDER_TRUST=true and pass trusted=true to loadConfig)","Move adminPolicyPaths to user-level/global settings so they survive the strip","Remove repo-level adminPolicyPaths if unnecessary","Ignore if intentional: admin policy overrides simply remain at defaults"],"exampleFix":"// before\n// untrusted workspace + project settings: { \"adminPolicyPaths\": [\"./admin.json\"] } -> stripped\n// after\nexport GEMINI_FOLDER_TRUST=true\n// or user-level settings:\n{ \"folderTrust\": true, \"adminPolicyPaths\": [\"/abs/path/admin.json\"] }","handlingStrategy":"validation","validationCode":"export function assertAdminPolicyPathsSurvive(settings: { adminPolicyPaths?: unknown; folderTrust?: boolean }): void {\n  const trusted = settings.folderTrust === true || process.env['GEMINI_FOLDER_TRUST'] === 'true';\n  if (!trusted && settings.adminPolicyPaths) {\n    throw new Error('Workspace is untrusted: repository adminPolicyPaths will be stripped. Enable folderTrust or move admin policies 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":["Treat adminPolicyPaths as privileged: only trust workspaces you own","Prefer user-level settings for admin policy paths","Check the loadConfig warning logs after startup","Avoid GEMINI_FOLDER_TRUST=true in shared/CI environments"],"tags":["security","configuration","workspace-trust","policy"],"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"}