Skip to content

fix(mcp): restore trust+isTrustedFolder permission check in getDefaultPermission#2642

Merged
LaZzyMan merged 1 commit into
QwenLM:mainfrom
huww98:fix/mcp-trust-permission
Mar 25, 2026
Merged

fix(mcp): restore trust+isTrustedFolder permission check in getDefaultPermission#2642
LaZzyMan merged 1 commit into
QwenLM:mainfrom
huww98:fix/mcp-trust-permission

Conversation

@huww98
Copy link
Copy Markdown
Collaborator

@huww98 huww98 commented Mar 24, 2026

TLDR

The trust: true setting on MCP servers stopped working in v0.13.0 after the permission system refactor (PR #2283). This PR restores the original behavior.

Screenshots / Video Demo

image
  • Above: this PR, auto allow
  • Below: v0.13.0, ask

Dive Deeper

Root Cause

PR #2283 (feat/support-permission) refactored MCP tool confirmation from the old shouldConfirmExecute() API to the new getDefaultPermission() + getConfirmationDetails() split.

The original shouldConfirmExecute() had an explicit trust check:

if (this.cliConfig?.isTrustedFolder() && this.trust) {
  return false; // server is trusted, no confirmation needed
}

The refactored getDefaultPermission() omitted this check entirely, leaving only a comment: "Note: trust/isTrustedFolder logic is now handled by PM rules". However, no PM rules were ever generated from the trust setting, making trust: true completely non-functional — the field is stored, passed through the entire config → mcp-client → DiscoveredMCPTool → Invocation chain, but never consulted during permission evaluation.

Fix

Restore the original two-condition check in getDefaultPermission():

  • trust === true on the MCP server config
  • isTrustedFolder() on the workspace (security gate)

Both conditions must be true, preserving the security invariant that trust settings (including user-level ~/.qwen/settings.json) cannot bypass confirmation in untrusted workspaces.

Reviewer Test Plan

Add to your project's .qwen/settings.json (trusted workspace):

{
  "mcpServers": {
    "my-server": {
      "command": "...",
      "trust": true
    }
  }
}

MCP tools from my-server should now execute without a confirmation dialog. Before this fix they always prompted regardless of the trust setting.

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker - -
Podman - -
Seatbelt - -

Linked issues / bugs

Related to #861


🤖 Generated with Qoder

…tPermission

The trust/isTrustedFolder logic was accidentally dropped during the
permission system refactor in feat/support-permission (PR QwenLM#2283).

Previously, shouldConfirmExecute() returned false (no confirmation) when
both conditions were met:
  - MCP server config has trust: true
  - The workspace folder is trusted (isTrustedFolder())

The refactor replaced shouldConfirmExecute() with getDefaultPermission() but
left out the trust check entirely, adding a comment claiming 'trust logic is
now handled by PM rules' — however no PM rules were ever generated from the
trust setting, making trust: true completely non-functional.

This fix restores the original behavior: MCP tools from a trusted server
(trust: true) auto-approve only when the workspace is also trusted, preserving
the security gate that prevents trust settings from bypassing confirmation in
untrusted folders.
Copy link
Copy Markdown
Collaborator

@LaZzyMan LaZzyMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@LaZzyMan LaZzyMan merged commit 28e6288 into QwenLM:main Mar 25, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants