Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion WordPress/Sniffs/Security/NonceVerificationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,10 @@ private function has_nonce_check( $stackPtr, array $cache_keys, $allow_nonce_aft
continue;
}

$content_lc = \strtolower( $this->tokens[ $i ]['content'] );

// If this is one of the nonce verification functions, we can bail out.
if ( isset( $this->nonceVerificationFunctions[ $this->tokens[ $i ]['content'] ] ) ) {
if ( isset( $this->nonceVerificationFunctions[ $content_lc ] ) ) {
/*
* Now, make sure it is a call to a global function.
*/
Expand Down
7 changes: 7 additions & 0 deletions WordPress/Tests/Security/NonceVerificationUnitTest.1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -486,3 +486,10 @@ enum MyEnum {
echo $_POST['foo']; // OK.
}
}

// Good, has a nonce check. Ensure the check is case-insensitive as function names are case-insensitive in PHP.
function ajax_process() {
CHECK_AJAX_REFERER( 'something' );

update_post_meta( (int) $_POST['id'], 'a_key', $_POST['a_value'] );
}
Loading