Clean up MCP ability permission checks - #1666
Open
rajatgautam755421 wants to merge 1 commit into
Open
rajatgautam755421 wants to merge 1 commit into
rajatgautam755421 wants to merge 1 commit into
Conversation
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>
QA suite — BROKEN, not passedThe runner executed 0 tests. That is a broken harness, not a pass — Likely causes: the grep matched nothing, Automated check — no AI involved. It runs the tests in this branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
php -lon modified files.🤖 Generated with Claude Code