Add support for filter param to comments query#2192
Add support for filter param to comments query#2192patrickgalbraith wants to merge 6 commits intoWP-API:developfrom
Conversation
|
Ran into an issue with |
There was a problem hiding this comment.
I think we need these filters behind edit_posts, or even generally think about capabilities more, because a public request shouldn't be able to query for the comments of a private post.
Done I just used the one found in the posts controller as an example.
Shouldn't the following code that was already there ensure that isn't a problem: |
Not necessarily. I think this pull request will need a lot of thought as to the security implications, and many more tests, before we can consider merging it. |
I was assuming that the For example can you explain what the difference would be between the following from a security point of view: $comments_query_1 = new WP_Comment_Query(array(
'post_id' => 1
));
$comments_query_2 = new WP_Comment_Query(array(
'post_name' => 'sample-post'
));Ultimately you can easily retrieve any comment by querying with it's ID so any way to exploit this should also apply when getting comments by ID I will add a test for accessing private post comments similar to |
|
@danielbachhuber I've added test cases to ensure comments are inaccessible when using filters to select comments on private posts. |
|
Assigned to myself for review |
|
I would like to see what happens with #2770 so we can apply it here as well. |
|
On hold pending the outcome of #2799 |
|
In #core-restapi today this PR came up in the context of #2066, in which a decision was made not to support Edit: missed the "on hold" above, will re-open depending on outcome of #2799. |
Only added support for some of the
comments_queryparameters but this will allow listing comments by post slug etc...See #2066