-
-
Notifications
You must be signed in to change notification settings - Fork 141
Description
Describe the bug
This issue report is actually a combination of two separate, but similar issues:
- There are currently sensitive API endpoints exposed publicly that should not be allowed without admin-level authentication.
- The access levels of endpoints created by this plugin do not mirror the access levels of similar endpoints in the WooCommerce REST API.
To Reproduce
- Have
wp-graphql
andwp-graphql-woocommerce
installed. - Send an unauthenticated request similar to the following (assuming your local site is running behind
localhost:8080
):
$ curl -X POST -H 'Content-Type: application/json' -d '
{
"query": "query { products { nodes { id name totalSales } } }"
}' http://localhost:8080/graphql
- See that I am able to get information pertaining to
totalSales
Expected behavior
At minimum, totalSales
should not be allowed to be queried by unauthenticated users.
At best, products should not be allowed, which is a mirror of WooCommerce REST API.
It's understandable though that maybe this graphql API should be a bit more laxed with its endpoints, being that maybe some people are using it to run a headless wordpress site. I can see why having products available to everyone would be needed. But some of the attributes of product
should not be allowed to everyone (particularly totalSales
) but perhaps also some of the others as well.
Addendum: I'm also now noticing that the field catalogVisibility
is also publicly visible in responses, which begs the question: Are products that are unpublished also publicly visible? If so, that's another big dealbreaker.
Screenshots
N/A
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
Additional context
None I can think of, but happy to provide more if needed.
See also: wp-graphql/wp-graphql#1071 (comment)
cc: @jasonbahl