Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WP Best Practices to include guidance on blocking /wp-json/wp/v2/users to anonymous users #9167

Merged
merged 6 commits into from
Aug 13, 2024

Conversation

jazzsequence
Copy link
Contributor

@jazzsequence jazzsequence commented Aug 12, 2024

Fixes #8314

Summary

  • WordPress Best Practices - Adds a section on how to add a filter which blocks access to the /users endpoint for unauthenticated users.
  • Avoid WordPress Login Attacks - Adds a section about blocking anonymous access to the /users endpoint, and why you might want to do it, which links back to the above section in the Best Practices doc.

@jazzsequence jazzsequence changed the title 8314-block-rest-users Update WP Best Practices to include guidance on blocking /wp-json/wp/v2/users to anonymous users Aug 12, 2024
Copy link

⚡ Deployed with Pantheon Decoupled

This build was successfully deployed with Pantheon. You can track the build logs here.

👀 Preview: https://pr-9167-documentation.appa.pantheon.site
🛠️ Manage in Pantheon: https://dashboard.pantheon.io/site/2b30153f-e8b1-4427-b076-6109e704ba5d/overview

@jazzsequence jazzsequence marked this pull request as ready for review August 12, 2024 15:49
@jazzsequence jazzsequence requested a review from a team as a code owner August 12, 2024 15:49
@jazzsequence jazzsequence self-assigned this Aug 12, 2024
Copy link

⚡ Deployed with Pantheon Decoupled

This build was successfully deployed with Pantheon. You can track the build logs here.

👀 Preview: https://pr-9167-documentation.appa.pantheon.site
🛠️ Manage in Pantheon: https://dashboard.pantheon.io/site/2b30153f-e8b1-4427-b076-6109e704ba5d/overview

Copy link

⚡ Deployed with Pantheon Decoupled

This build was successfully deployed with Pantheon. You can track the build logs here.

👀 Preview: https://pr-9167-documentation.appa.pantheon.site
🛠️ Manage in Pantheon: https://dashboard.pantheon.io/site/2b30153f-e8b1-4427-b076-6109e704ba5d/overview

@rachelwhitton
Copy link
Member

@jazzsequence I see we already have a similar example in this doc here: https://docs.pantheon.io/guides/wordpress-developer/wordpress-best-practices#disable-anonymous-access-to-wordpress-rest-api

Is checking for access to the list_users capability the only difference between the two methods? Do we need both?

@jazzsequence
Copy link
Contributor Author

@rachelwhitton One is to disable the REST API entirely to anonymous users. The other only disables the /users endpoint. The first is a sledgehammer, the second is a scalpel. It depends on what you're doing (or not doing) with the API but since this came in customers wanting to know how to do this, obviously the disabling the entire API solution was insufficient. I don't think it hurts to do both.

@rachelwhitton
Copy link
Member

@jazzsequence gotcha, that makes sense. I updated the headers for clarity. LGTM 👍

Copy link

⚡ Deployed with Pantheon Decoupled

This build was successfully deployed with Pantheon. You can track the build logs here.

👀 Preview: https://pr-9167-documentation.appa.pantheon.site
🛠️ Manage in Pantheon: https://dashboard.pantheon.io/site/2b30153f-e8b1-4427-b076-6109e704ba5d/overview

@jazzsequence jazzsequence merged commit 8a1a609 into main Aug 13, 2024
9 of 12 checks passed
@jazzsequence jazzsequence deleted the 8314-block-rest-users branch August 13, 2024 15:21
Copy link

⚡ Deployed with Pantheon Decoupled

This build was successfully deployed with Pantheon. You can track the build logs here.

👀 Preview: https://pr-9167-documentation.appa.pantheon.site
🛠️ Manage in Pantheon: https://dashboard.pantheon.io/site/2b30153f-e8b1-4427-b076-6109e704ba5d/overview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WordPress REST API Best Practices
2 participants