Skip to content

Sensitive API endpoints are exposed publicly and endpoints throughout do not mirror access priviliges of WooCommerce REST API #210

@dsifford

Description

@dsifford

Describe the bug

This issue report is actually a combination of two separate, but similar issues:

  1. There are currently sensitive API endpoints exposed publicly that should not be allowed without admin-level authentication.
  2. 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

  1. Have wp-graphql and wp-graphql-woocommerce installed.
  2. 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
  1. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions