Skip to content

fix(mcp): keep loading api_key rows projected before the layered ACL - #993

Merged
jarvis9443 merged 2 commits into
mainfrom
fix/mcp-acl-loader-tolerates-stale-blocks
Aug 19, 2026
Merged

fix(mcp): keep loading api_key rows projected before the layered ACL#993
jarvis9443 merged 2 commits into
mainfrom
fix/mcp-acl-loader-tolerates-stale-blocks

Conversation

@jarvis9443

Copy link
Copy Markdown
Contributor

Follow-up to #992, which made allow required on every MCP ACL layer.

Required at the type level turned out to be too strong for the read path. Documents projected before the layered shape carry mcp_access: {"mode": "inherit"} and no allow, and nothing re-emits an api_key whose stored shape did not otherwise change. Such a row failed to deserialize, and the loader skips a row it cannot represent — so the key stopped authenticating for every kind of traffic, not just MCP. That is a much worse failure than losing tool access, and it would not have healed on its own.

The runtime loader now defaults a missing allow to empty, so a stale row loads as a layer allowing nothing: fail-closed on MCP while the key keeps serving LLM and A2A traffic. The write path is unchanged — the strict schema adds allow to required on both McpPolicy and the key's McpAccess, so neither a resources file nor the admin API can leave it out, and the published schemas/resources/*.json still document it as required. That is the usual split in this crate: the strict schema forbids, the lenient loader tolerates.

The control-plane side re-emits both collections once after its migration (api7/AISIX-Cloud#1335), so the stale documents are replaced rather than merely tolerated. This change is what keeps a key alive in the window before that runs.

A document written under the previous shape carries mcp_access.mode and
no allow list. With allow required at the type level that row failed to
deserialize, and the loader skips a row it cannot represent — so the key
stopped authenticating for every kind of traffic, not just MCP.

The runtime loader now defaults a missing allow to empty, which resolves
to a layer allowing nothing: fail-closed on MCP while the key keeps
working elsewhere. The write path is unchanged — the strict schema adds
allow to required on both layers, so neither a resources file nor the
admin API can leave it out.
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

This review includes 5 billable files. This on-demand review is free during your promotion.

Your included review limit has been reached. Run @coderabbitai review --use-credits to review the latest changes using usage credits.

  • Run review — free
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2bf1b44a-554f-4b57-ad8c-75edb6919a87

📥 Commits

Reviewing files that changed from the base of the PR and between 7a9fc86 and aa9e383.

📒 Files selected for processing (5)
  • CLAUDE.md
  • crates/aisix-core/src/models/mcp_policy.rs
  • crates/aisix-core/src/models/schema.rs
  • schemas/resources/api_key.schema.json
  • schemas/resources/mcp_policy.schema.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mcp-acl-loader-tolerates-stale-blocks

Comment @coderabbitai help to get the list of available commands.

…ired

The loader skips a row it cannot deserialize, and a skipped api_key row
stops authenticating every kind of traffic — so requiredness belongs in
the strict schema, with a fail-closed serde default on the struct.
@jarvis9443
jarvis9443 merged commit 86dd01e into main Aug 19, 2026
14 checks passed
@jarvis9443
jarvis9443 deleted the fix/mcp-acl-loader-tolerates-stale-blocks branch August 19, 2026 07:27
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.

1 participant