Closed mehulkaklotar closed 5 months ago
@felixarntz I have updated AC for this epic. It is ready for review now. Thanks!
Looks like XML file has this ruled enabled already.
<!-- Nonces. These are triggered on any GET/POST access items. -->
<rule ref="WordPress.Security.NonceVerification">
<!-- This is triggered on all GET/POST access, it can't be an error. -->
<type>warning</type>
</rule>
When I try to add separate check for this rule WordPress.Security.NonceVerification
is displaying duplicate messages for same errors.
Are we planning to create separate Check for this and remove the rule from XML file? Can someone please elaborate?
There are already WordPress.Security.NonceVerification.Missing
errors being reported as part of the plugin_review_phpcs
/ Plugin_Review_PHPCS_Check
check. No need to create a separate duplicate check for this.
So this is already WAI.
Description
Checks that nonce verification functions are used within form processing. This is a security check that ensures that core nonce functions are being used to verify the request to the server before processing. This will use the existing WordPress.Security.NonceVerification sniff in the WordPress Coding Standards.
Acceptance Criteria
Nonce_Verification_Check
should be created and exists atincludes/Checker/Checks
Nonce_Verification_Check
should extend theAbstract_PHP_CodeSniffer_Check
abstract classget_args()
and return an associative array of the required PHPCS arguments'sniffs' => 'WordPress.Security.NonceVerification'
'standard' => 'WordPress'
tests/testdata/plugins/test-plugin-with-errors\test-plugin-with-errors.php
file, which will come under theWordPress.Security.NonceVerification
error.Tests Coverage
get_args()
method returns the expected array of PHPCS arguments for the checkrun()
method adds warnings to the$check_result
when checking an invalid file - check reference hererun()
method does not add any warnings to the$check_result
when checking a valid file - check reference here