Overview
When enabled, Trusted Folders prevents Qwen Code from:- Executing tools that require user approval (shell, edit, write_file) in untrusted folders
- Loading project-level
.envfiles from untrusted folders - Using aggressive approval modes (YOLO, auto-edit) in untrusted folders
Enabling Folder Trust
Folder trust is disabled by default. Enable it in your user settings:~/.qwen/settings.json
Trust Levels
Qwen Code supports three trust levels:Trust this specific folder only.Example: Trust
~/projects/my-app but not its parent directory.Trust the parent directory, making all sibling and child folders trusted.Example: Trust
~/projects so all projects within it are automatically trusted.Explicitly mark a folder as untrusted, overriding parent trust.Example: Untrust
~/projects/suspicious-repo even though ~/projects is trusted.Configuration File
Trust rules are stored in~/.qwen/trustedFolders.json:
~/.qwen/trustedFolders.json
File Location
- Default:
~/.qwen/trustedFolders.json - Override via environment variable:
Managing Trust
Via Interactive Prompt
When you open an untrusted folder, Qwen Code will prompt you:Manually Editing trustedFolders.json
You can directly edit~/.qwen/trustedFolders.json:
- Use absolute paths
- Paths are case-sensitive
- Use forward slashes (
/) on all platforms - On Windows, use:
C:/Users/username/projects(not backslashes)
Via IDE Integration
When using Qwen Code through VS Code, Zed, or JetBrains IDEs, trust status is inherited from the IDE’s workspace trust feature.Trust Rules Evaluation
Qwen Code evaluates trust using the following logic:- IDE Trust (highest priority): If running in an IDE that provides workspace trust, use that value.
-
Explicit DO_NOT_TRUST: If the exact path is marked
DO_NOT_TRUST, the folder is untrusted. -
TRUST_FOLDER: If the exact path is marked
TRUST_FOLDER, the folder is trusted. -
TRUST_PARENT: If any parent directory is marked
TRUST_PARENT, the folder is trusted. - No matching rule: If no rule matches, the folder is untrusted (when trust is enabled).
Example Evaluation
Given this configuration:/home/user/projects/my-app→ Trusted (parent is trusted)/home/user/projects/another-app→ Trusted (parent is trusted)/home/user/projects/suspicious→ Untrusted (explicitly marked)/home/user/Downloads/random→ Untrusted (no matching rule)
Behavior in Untrusted Folders
Approval Mode Override
In untrusted folders, approval mode is forced todefault (prompt before execution):
Tool Execution
Tools requiring approval will always prompt:bash/run_shell_command- Always requires approvaledit- Always requires approvalwrite_file- Always requires approval
read- Works without approvalglob- Works without approvalgrep- Works without approvalls- Works without approval
Environment Variables
Project-level.env files are not loaded in untrusted folders:
.qwen/.envin project - Not loaded.envin project - Not loaded~/.qwen/.env(user-level) - Always loaded~/.env(home directory) - Always loaded
Workspace Settings
Project-level settings are ignored in untrusted folders:.qwen/settings.jsonin project - Ignored~/.qwen/settings.json(user-level) - Always applied
Use Cases
Trust All Personal Projects
~/projects are trusted.
Trust Specific Work Projects
Trust Everything Except Downloads
Trust Per-Organization
Security Best Practices
- Enable folder trust if you work with code from unknown sources.
-
Use TRUST_PARENT for directories where you manage all projects:
-
Use DO_NOT_TRUST for directories where you clone external code:
- Review trust before using YOLO mode - Check if the folder is trusted before enabling auto-approval.
-
Combine with .qwenignore - Use
.qwenignoreto prevent Qwen Code from reading sensitive files even in trusted folders.
Checking Trust Status
You can check if the current folder is trusted by attempting a privileged operation. Qwen Code will indicate if the folder is untrusted:Disabling Folder Trust
To disable folder trust:~/.qwen/settings.json
- All folders are treated as trusted
trustedFolders.jsonis ignored- Project
.envfiles are loaded from all directories - Approval mode settings work as configured
IDE Integration
VS Code
Qwen Code respects VS Code’s workspace trust:- If the workspace is trusted in VS Code, Qwen Code trusts it
- If the workspace is untrusted in VS Code, Qwen Code does not trust it
- IDE trust takes precedence over
trustedFolders.json
Zed
Similar to VS Code, Qwen Code inherits trust status from Zed’s workspace trust.JetBrains IDEs
Qwen Code inherits trust status from JetBrains’ trusted projects feature.Troubleshooting
Folder Not Trusted Despite Configuration
-
Check the path in
trustedFolders.jsonis absolute and correct: -
Ensure paths use forward slashes:
-
Verify JSON syntax is valid:
Can’t Load Project .env
If project.env files aren’t loading:
- Check if folder trust is enabled
- Verify the folder is trusted
- Move sensitive keys to
~/.qwen/.env(always loaded)
Tools Always Require Approval
In untrusted folders, tools will always require approval. Either:- Trust the folder in
trustedFolders.json - Use
--approval-mode defaultexplicitly - Work with read-only tools that don’t require approval
