Skip to content

fix(amazonq): limit workspace agent config permissions to servers in its folder - #3062

Open
laileni-aws wants to merge 4 commits into
Amazon-Q-Developer:feature/laileni-fixesfrom
laileni-aws:fix/mcp-workspace-permissions
Open

laileni-aws wants to merge 4 commits into
Amazon-Q-Developer:feature/laileni-fixesfrom
laileni-aws:fix/mcp-workspace-permissions

Conversation

@laileni-aws

Copy link
Copy Markdown
Collaborator

No description provided.

@codecov-commenter

codecov-commenter commented Nov 16, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 98.35165% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../language-server/agenticChat/tools/mcp/mcpUtils.ts 98.35% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@laileni-aws
laileni-aws force-pushed the fix/mcp-workspace-permissions branch from 0abc7d7 to 1091fa4 Compare November 17, 2026 04:23
…its folder

A workspace agent config, or a workspace mcp.json, now applies server permissions and default
enablement only to the MCP servers that it defines: a '*' in its tools enables only those
servers, and its other glob entries and its entries for other servers are skipped. A skipped
entry that names a loaded server is logged. A workspace file does not load a server whose name
has a glob character. A permission entry that is not a string is skipped in every agent config.

Adds tests.
…er name has a glob character

A workspace mcp.json server whose name has '*' or '?' is now skipped before the duplicate
check, so it no longer replaces a global mcp.json server that has the same key. Server names
lose '*' and '?' when they become keys, so 'tracker*' and 'tracker' have the same key.

The default enablement of a legacy mcp.json server no longer has a fallback for a server
without a config file path, which every legacy server has.

Adds tests for this, for permission entries across two workspace folders, and for a server
whose config file or original name is not known.
@laileni-aws
laileni-aws changed the base branch from feature/security-fixes-v2 to feature/laileni-fixes November 18, 2026 20:38
@laileni-aws
laileni-aws force-pushed the fix/mcp-workspace-permissions branch from fc52861 to fb5d76d Compare November 18, 2026 20:38
… permissions

saveServerSpecificAgentConfig strips a server existing tools and allowedTools entries before it
writes the new ones. It now skips an entry that is not a string instead of calling startsWith on
it, which threw a TypeError. Loading already skips such entries, so they are left in the file
rather than dropped.

Adds a test.
@laileni-aws
laileni-aws marked this pull request as ready for review November 19, 2026 21:06
@laileni-aws
laileni-aws requested a review from a team as a code owner November 19, 2026 21:06
…MCP server list

- Report in the MCP server list how many permission entries of a workspace agent config were
  ignored, without their text; the log still names each entry
- Decide whether a config file is the global one without case on Windows, as loadMcpServerConfigs
  does
- Ignore a wildcard entry that starts with "@" in a workspace agent config with one warning
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