-
Notifications
You must be signed in to change notification settings - Fork 471
RootQuery to ContentNode connection returns posts it shouldn't #1679
Copy link
Copy link
Open
Labels
component: model layerRelating to the Model LayerRelating to the Model Layerhas: workaroundA temporary workaround has been providedA temporary workaround has been providedneeds: discussionRequires a discussion to proceedRequires a discussion to proceedobject type: postRelating to the Post Object TypesRelating to the Post Object Typesscope: securitySecuring against vulnerabilities and threatsSecuring against vulnerabilities and threatsstale?May need to be revalidated due to prolonged inactivityMay need to be revalidated due to prolonged inactivitytype: bugIssue that causes incorrect or unexpected behaviorIssue that causes incorrect or unexpected behavior
Metadata
Metadata
Assignees
Labels
component: model layerRelating to the Model LayerRelating to the Model Layerhas: workaroundA temporary workaround has been providedA temporary workaround has been providedneeds: discussionRequires a discussion to proceedRequires a discussion to proceedobject type: postRelating to the Post Object TypesRelating to the Post Object Typesscope: securitySecuring against vulnerabilities and threatsSecuring against vulnerabilities and threatsstale?May need to be revalidated due to prolonged inactivityMay need to be revalidated due to prolonged inactivitytype: bugIssue that causes incorrect or unexpected behaviorIssue that causes incorrect or unexpected behavior
Type
Projects
Status
💬 In Discussion
The
RootQueryToContentNodeconnection is returning posts ofpost_typesthat are not public.For example, with the WPGatsby plugin active, the following query from a public user:
Is returning nodes of the
ActionMonitorType, a non-public post_type.The Model Layer for SURE needs to be fixed to ensure non-public posts are not being returned, even if an underlying query asks for them.
We should also optimize the connection queries to only ask for things we know the user can ask for.
Some context that might be helpful to resolving this:
The post types that are queried for are centrally checked in the Connection Resolver here: https://github.com/wp-graphql/wp-graphql/blob/develop/src/Data/Connection/PostObjectConnectionResolver.php#L56-L57. Limiting this centrally to public post types could help.
Here (https://github.com/wp-graphql/wp-graphql/blob/develop/src/Model/Post.php#L329-L331) the Post model is allowing posts of any post type to be public, as long as they're published