[wp-trac] [WordPress Trac] #63866: Always sanitize the first parameter of wp_verify_nonce
WordPress Trac
noreply at wordpress.org
Sat Aug 23 10:41:49 UTC 2025
#63866: Always sanitize the first parameter of wp_verify_nonce
-------------------------+------------------------------
Reporter: davidperez | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Security | Version:
Severity: normal | Resolution:
Keywords: 2nd-opinion | Focuses:
-------------------------+------------------------------
Comment (by rishabhwp):
Even simply replacing:
{{{#!php
$nonce = (string) $nonce;
}}}
with
{{{#!php
$nonce = sanitize_text_field( $nonce );
}}}
would work, as sanitize_text_field() internally performs the type casting
(see [https://core.trac.wordpress.org/browser/tags/6.8.2/src/wp-
includes/formatting.php#L5631 formatting.php#L5631]).
I’m happy to create a patch if that sounds reasonable.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63866#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list