{"record":{"id":"a74e0579f1d022cf","repo":"google-gemini/gemini-cli","slug":"configuration-untrusted-workspace-detected-stri-a74e05","errorCode":null,"errorMessage":"[Configuration] Untrusted workspace detected. Stripping repository policyPaths definitions to prevent unintended policy override.","messagePattern":"\\[Configuration\\] Untrusted workspace detected\\. Stripping repository policyPaths definitions to prevent unintended policy override\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/a2a-server/src/config/config.ts","lineNumber":297,"sourceCode":"        '[Config] Checkpointing is enabled but git is not installed. Disabling checkpointing.',\n      );\n      checkpointing = false;\n    }\n  }\n\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    }","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/0bd1d439751478771c45d3d0895a6a9760554bf4/packages/a2a-server/src/config/config.ts#L279-L315","documentation":"Security warning from loadConfig: when the workspace is not trusted, repository-defined policyPaths are stripped so a cloned repo cannot override the server's policy files. Loading proceeds; only the repo-supplied policyPaths are ignored.","triggerScenarios":"loadConfig invoked with trusted=false while settings.policyPaths is set in project settings; trust flag (folderTrust / GEMINI_FOLDER_TRUST) not enabled.","commonSituations":"Running the server on a checked-out repo that ships policyPaths in its project settings; forgetting to export GEMINI_FOLDER_TRUST=true in a dev container; newly enforced folder-trust feature after an upgrade silently disables repo policies.","solutions":["Enable workspace trust (settings.folderTrust=true or GEMINI_FOLDER_TRUST=true and trusted=true when calling loadConfig)","Relocate policyPaths to user-level/global settings that are not subject to the untrusted-workspace strip","Remove repo-level policyPaths if not needed to silence the warning","Treat as informational: policies simply fall back to defaults"],"exampleFix":"// before\n// project settings: { \"policyPaths\": [\"./policies.json\"] } in untrusted workspace -> stripped\n// after\nexport GEMINI_FOLDER_TRUST=true\n// or move to user-level settings:\n{ \"folderTrust\": true, \"policyPaths\": [\"/abs/path/policies.json\"] }","handlingStrategy":"validation","validationCode":"export function assertPolicyPathsSurvive(settings: { policyPaths?: unknown; folderTrust?: boolean }): void {\n  const trusted = settings.folderTrust === true || process.env['GEMINI_FOLDER_TRUST'] === 'true';\n  if (!trusted && settings.policyPaths) {\n    throw new Error('Workspace is untrusted: repository policyPaths will be stripped. Enable folderTrust or relocate 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":["Grant folder trust before relying on repo-supplied policyPaths","Keep policy files at user level for repeatable environments","Verify the resulting Config's policy engine state after loadConfig","Audit repos for policyPaths before running the server on them"],"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-14T05:17:10.506Z"}