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

Re-evaluate need for nonces in REST API #412

Open
leopiccionia opened this issue Dec 20, 2022 · 1 comment
Open

Re-evaluate need for nonces in REST API #412

leopiccionia opened this issue Dec 20, 2022 · 1 comment
Assignees

Comments

@leopiccionia
Copy link
Collaborator

leopiccionia commented Dec 20, 2022

Currently, JEO sends a X-WP-Nonce header to most/all requests to WP REST API.

It's a good practice, but makes some improvements, like caching pages, much more cumbersome and error-prone.

For handling caching issues in its dashboard, PlenaMata uses a patched fork of JEO for months, maintained in the no-nonce branch. If it's proved that removing the nonces don't break other JEO installations, it could avoid having to maintain two different active branches of JEO and help prevent future issues similar to those currently faced by PlenaMata.

Nonces may be required for some tasks, like previewing private/drafted maps or layers. It should be tested on Carto layers (the reason the nonces were originally introduced), too. At worst, we could consider only sending nonces on-demand.

@leopiccionia
Copy link
Collaborator Author

In commit 2487af9, I've implemented a solution that consists of using nonces only for logged users.

Because documents for logged users are not cached by most plugin setups, it doesn't break caching, and allow logged users to view draft and private maps, story maps, etc.

Because Carto requests always run inside /wp-admin (and, therefore, requires a logged users), it's covered in previous case.

It seems like a good compromise, and my initial tests doesn't show any breakage.

@leopiccionia leopiccionia self-assigned this Apr 27, 2023
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

No branches or pull requests

1 participant