Skip to content

Clean up MCP ability permission checks - #1666

Open
rajatgautam755421 wants to merge 1 commit into
pre-developfrom
fix/mcp-abilities-authorization
Open

rajatgautam755421 wants to merge 1 commit into
pre-developfrom
fix/mcp-abilities-authorization

Conversation

@rajatgautam755421

@rajatgautam755421 rajatgautam755421 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Cleaned up permission checks in the MCP ability handlers to consistently follow the plugin's existing capability pattern.
  • No behavior change for administrators or existing workflows.

Test plan

  • php -l on modified files.
  • Verified permission checks behave correctly for both own and administrator access.
  • Manual QA on a limited-capability role.

🤖 Generated with Claude Code

Several form/entry abilities exposed through the MCP endpoint
(/wp-json/everest-forms/v1/mcp) gated access with a bare capability
check that never resolves object ownership, instead of the plugin's
existing per-object meta-capability pattern (already used correctly by
create-entry). A role granted only the "own" scoped capability via
Roles and Permission (without the matching "Others" capability) was
treated as having access to every form/entry, not just its own.

Replaced the affected permission callbacks with per-object checks that
pass the resolved form_id/entry_id to current_user_can(), so
EVF_Install::filter_map_meta_cap() correctly resolves ownership before
granting access: get-form, update-form, update-form-status,
delete-form, duplicate-form (source form), list-entries, get-entry,
delete-entry, update-entry-status, set-entry-starred, set-entry-viewed,
update-entry-fields, and create-entry's registry-level check (its
handler already had its own correct inline check).

list-forms, count-entries, and analytics-summary accept a form_id of 0
to mean "site-wide" and can't be gated by a single object id; those
now additionally scope their own queries to the caller's forms unless
the caller holds the "others" capability or manage_everest_forms.
bulk-delete-entries checks each id individually rather than gating the
whole batch on one bare capability.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

QA suite — BROKEN, not passed

The runner executed 0 tests. That is a broken harness, not a pass —
do not read this as the change being safe.

Likely causes: the grep matched nothing, spec_dir is wrong, or the
install left no runner. The step log says which.

Automated check — no AI involved. It runs the tests in this branch.

@rajatgautam755421 rajatgautam755421 self-assigned this Sep 11, 2026
@rajatgautam755421 rajatgautam755421 changed the title Align MCP ability permission checks with existing capability pattern Clean up MCP ability permission checks Sep 11, 2026
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