Skip to content

fix: replace esc_attr() misuse with proper input sanitization#224

Merged
sushmak02 merged 1 commit intorelease-candidatefrom
fix/input-sanitization
Feb 24, 2026
Merged

fix: replace esc_attr() misuse with proper input sanitization#224
sushmak02 merged 1 commit intorelease-candidatefrom
fix/input-sanitization

Conversation

@akshayurankar48
Copy link
Contributor

Summary

  • Replace esc_attr() on $_POST/$_GET with sanitize_text_field(), absint(), or intval() depending on data type
  • Add wp_unslash() before sanitization on superglobal access
  • Fix nonce values to use sanitize_text_field(wp_unslash()) before wp_verify_nonce()
  • Fix post IDs to use absint() instead of esc_attr()
  • Fix star ratings to use intval() instead of esc_attr()

Files changed

  • init.php — meta box save, file upload, oEmbed handler
  • functions.php — rating AJAX handlers
  • admin/index.php — settings reset handler

Test plan

  • Verify meta box save still works on post edit screens
  • Verify rating submission still works on frontend
  • Verify settings reset buttons work in admin dashboard
  • Verify oEmbed preview in post editor still works

Fixes #219

- Replace esc_attr() on $_POST/$_GET with sanitize_text_field(),
  absint(), or intval() depending on data type
- Add wp_unslash() before sanitization on superglobal access
- Fix nonce values to use sanitize_text_field(wp_unslash()) before
  wp_verify_nonce()
- Fix post IDs to use absint() instead of esc_attr()
- Fix star ratings to use intval() instead of esc_attr()

Fixes #219
@akshayurankar48 akshayurankar48 changed the base branch from master to release-candidate February 24, 2026 01:54
@sushmak02 sushmak02 merged commit c4b1d59 into release-candidate Feb 24, 2026
2 checks passed
@sushmak02 sushmak02 deleted the fix/input-sanitization branch February 24, 2026 05:57
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: Replace esc_attr() misuse with proper input sanitization

2 participants