Add authorization check on destination post during content import#668
Add authorization check on destination post during content import#668miyanialkesh7 wants to merge 1 commit into
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Hello @miyanialkesh7, thanks for helping. Please do smaller PRs by grouping them so I can review them more easily. Thanks! |
|
Hey @lloc, There is a checkbox available with every change. So, you can take your time to review the file by file, and if everything is good, then you can easily push those changes to the main/master branch. Please refer to the screenshot below
|
|
How GitHub works is clear to me. ;-) What I want is different, though. Every PR should have a precise scope. Yours seems to have at least 3, which is problematic whenever I have to revert changes for some reason. Also, for the ABSPATH check, please have a look here for reference: WordPress/WordPress-Coding-Standards#1850 A quote from a comment by Juliette:
|
The content-import filter already verified the requesting user could read the source post and validated the nonce, but never checked whether they were allowed to edit the destination post before writing imported content into it. Add an explicit current_user_can( 'edit_post', $dest_post_id ) check alongside the existing checks.
5690792 to
dc7616c
Compare
|
Hi @lloc, thanks for the feedback — I've made both changes:
This PR should now be a small, single-purpose diff. Let me know if there's anything else you'd like adjusted. |

Summary
current_user_can( 'edit_post', $dest_post_id )check inContentImporter.phpalongside the existing checks.Scope note
Per review feedback on this PR, I've narrowed it down to just this authorization fix. The other changes that were previously bundled in here (ABSPATH guards, i18n fixes, PHPCS/Plugin Check suppressions) have been split out:
Test plan
edit_postcapability on the destination postedit_postcapability on the destination post