Fix ContentImporter permission and post type checks#612
Open
apermo wants to merge 3 commits intolloc:masterfrom
Open
Fix ContentImporter permission and post type checks#612apermo wants to merge 3 commits intolloc:masterfrom
apermo wants to merge 3 commits intolloc:masterfrom
Conversation
Verify the user can read the source post before importing its content. Prevents leaking private post content across blogs. Closes lloc#610
Verify the post type is registered on the target blog before inserting. Returns early if the post type does not exist, preventing silent failures. Closes lloc#611
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces security and stability improvements to the content import process by adding a capability check for reading source posts and validating post types before insertion. A review comment suggests optimizing the blog switching logic in handle_import to fetch the post object while the context is already switched, which would eliminate redundant operations later in the execution flow.
check and post fetch Fetch source post in the same switch_to_blog call as the read_post capability check, removing a redundant blog switch cycle.
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.
Closes #610, closes #611
Summary
read_postcapability check on the source blog before importing content, preventing private content from leaking across blogspost_type_exists()check on the target blog before inserting, preventing silent failures when a custom post type is not registered on all blogsTest plan
composer test— all tests pass