add nonces and capability checks on ajax endpoints (WP-1007)#623
Open
vsolovei-smartling wants to merge 4 commits into
Open
add nonces and capability checks on ajax endpoints (WP-1007)#623vsolovei-smartling wants to merge 4 commits into
vsolovei-smartling wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- route all TaxonomyLinksController responses through wordpressProxy - remove unused testConnectionNonce from wp_localize_script - replace $GLOBALS capture in ContentRelationsHandlerTest with anonymous class instance properties - rename nonce action smartling_instant_translation → smartling_translation across all check_ajax_referer/wp_create_nonce call sites Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PavelLoparev
reviewed
Jun 4, 2026
Comment on lines
+84
to
+88
| $this->wpProxy->check_ajax_referer('smartling_translation', '_wpnonce'); | ||
| if (!$this->wpProxy->current_user_can(SmartlingUserCapabilities::SMARTLING_CAPABILITY_WIDGET_CAP)) { | ||
| $this->returnError('permission.denied', 'Insufficient permissions', 403); | ||
| return; | ||
| } |
Contributor
There was a problem hiding this comment.
Can this be implemented as a middleware in WP?
Contributor
Author
There was a problem hiding this comment.
No, no such thing in WP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.