I have a custom Type with visitors without rights to read.
If I visit the page of an "adhesion-v1" as a visitor it's blocked. Ex : hidden link
But If I request the data with REST API, all data are exposed. Ex : hidden link
It can be considered as a data leak.
I check with all plugins disabled except Toolset. This issue is still present.
Can you help me ?
Another point, I don't know if it's related, but Application password are not handle in Rest API for this type. I check on /wp/v2/users/me or /wp/v2/posts it's related to my account with my application password. But in /wp/v2/adhesion-v1/ it's working like a visitor.
I tested this and found the same result: Access rules are not applied to REST requests, and unauthenticated REST requests will return details of posts that would be hidden if trying to visit the post URL.
I'm surprised this hasn't come up before.
The "solution" to prevent data leakage is to disable the REST API for this particular post type, but that doesn't help if you want authenticated users to be able to retrieve such posts via the REST API.
I'm checking with my colleagues to see if I am missing anything, and I'll get back to you.
You can go to Toolset > Post Types and edit the post type in question.
Under the Options you can uncheck the option to "show in REST" to disable the REST API for this particular post type.
Note, the REST API is required for the Gutenberg block editor, it would be necessary to switch to use the Classic editor for this post type to be able to disable REST.