Opened 15 months ago
Last modified 15 months ago
#63329 new enhancement
Use check_ajax_referer() instead of check_admin_referer() for AJAX requests in media form handling.
| Reported by: | khushipatel15 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Security | Version: | 6.8 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | coding-standards, php-compatibility |
Description
This patch replaces the use of check_admin_referer( 'media-form' ) with check_ajax_referer( 'media-form' ) in the relevant media-handling code to better align with AJAX request security practices in WordPress.
The check_ajax_referer() function is specifically intended for verifying nonces on AJAX requests and provides a more appropriate response structure for such scenarios. It also ensures compatibility with how WordPress handles wp_die() in AJAX contexts, where it returns a -1 response instead of rendering an HTML error page.
Attachments (1)
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This patch shows use of ajax reference.