fix: default folder trust to untrusted for enhanced security (#15943)

This commit is contained in:
Gal Zahavi
2026-01-06 10:09:09 -08:00
committed by GitHub
parent 9a3ff6510f
commit 6f4b2ad0b9
6 changed files with 103 additions and 78 deletions

View File

@@ -1428,22 +1428,13 @@ export class Config {
* 'false' for untrusted.
*/
isTrustedFolder(): boolean {
// isWorkspaceTrusted in cli/src/config/trustedFolder.js returns undefined
// when the file based trust value is unavailable, since it is mainly used
// in the initialization for trust dialogs, etc. Here we return true since
// config.isTrustedFolder() is used for the main business logic of blocking
// tool calls etc in the rest of the application.
//
// Default value is true since we load with trusted settings to avoid
// restarts in the more common path. If the user chooses to mark the folder
// as untrusted, the CLI will restart and we will have the trust value
// reloaded.
const context = ideContextStore.get();
if (context?.workspaceState?.isTrusted !== undefined) {
return context.workspaceState.isTrusted;
}
return this.trustedFolder ?? true;
// Default to untrusted if folder trust is enabled and no explicit value is set.
return this.folderTrust ? (this.trustedFolder ?? false) : true;
}
setIdeMode(value: boolean): void {