Skip to content

fix: add capability checks to AJAX handlers#223

Merged
sushmak02 merged 1 commit intorelease-candidatefrom
fix/ajax-capability-checks
Feb 24, 2026
Merged

fix: add capability checks to AJAX handlers#223
sushmak02 merged 1 commit intorelease-candidatefrom
fix/ajax-capability-checks

Conversation

@akshayurankar48
Copy link
Contributor

Summary

  • Add current_user_can('manage_options') to submit_request AJAX handler
  • Add current_user_can('edit_posts') to bsf_oembed_ajax_results AJAX handler
  • Fix submit_request control flow: bail early on nonce failure instead of running wp_mail() with empty fields
  • Add sanitize_text_field(wp_unslash()) to nonce verification inputs

Test plan

  • Verify support form still works for admins
  • Verify subscribers cannot access the support form AJAX endpoint
  • Verify oEmbed preview still works on post edit screens
  • Verify subscribers cannot call the oEmbed AJAX endpoint

Fixes #218

- Add current_user_can('manage_options') to submit_request handler
- Add current_user_can('edit_posts') to bsf_oembed_ajax_results handler
- Fix submit_request control flow: bail early on nonce failure instead
  of running wp_mail() with empty fields
- Add sanitize_text_field(wp_unslash()) to nonce verification inputs

Fixes #218
@akshayurankar48 akshayurankar48 changed the base branch from master to release-candidate February 24, 2026 01:54
@sushmak02 sushmak02 merged commit d3b9842 into release-candidate Feb 24, 2026
2 checks passed
@sushmak02 sushmak02 deleted the fix/ajax-capability-checks branch February 24, 2026 05:55
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.

Security: Add capability checks to AJAX handlers

2 participants