Skip to content

add nonces and capability checks on ajax endpoints (WP-1007)#623

Open
vsolovei-smartling wants to merge 4 commits into
masterfrom
WP-1007-verify-capability-checks-ajax
Open

add nonces and capability checks on ajax endpoints (WP-1007)#623
vsolovei-smartling wants to merge 4 commits into
masterfrom
WP-1007-verify-capability-checks-ajax

Conversation

@vsolovei-smartling
Copy link
Copy Markdown
Contributor

No description provided.

vsolovei-smartling and others added 3 commits June 3, 2026 20:15
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>
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;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be implemented as a middleware in WP?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, no such thing in WP

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.

2 participants