Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance/BatcacheWhitelistedParams: remove the sniff #774

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Aug 24, 2023

  • Remove the sniff.
  • Remove the related test in the WordPressVIPMinimum/ruleset-test.inc file.
  • Remove the error silencing from VIP-Go.
  • Remove the related test in the WordPress-VIP-Go/ruleset-test.inc file.
    This one is a little more involved. Basically the call to wp_verify_nonce(), which is being removed, was "silencing" the nonce verification error for other tests as well, most notably for the tests on line 83-85, due to most tests being in the global scope.
    Looking at it more closely, turns out that line 83 wasn't testing what it was supposed to be testing.
    The error which was previously being thrown on line 83 was about the nonce verification being missing, while the test is annotated to be about the WordPress.Security.ValidatedSanitizedInput[.InputNotSanitized] error, which wasn't being thrown.
    Adding a nonce verification check on some empty lines above these tests gets rid of the nonce verification errors, but now left line 83 not testing anything at all (as no key is accessed in the superglobal).
    Adding a random key gets us the error which was intended to be thrown on this line, but now also adds the "missing validation" error. IMO, this is correct (better than it was before), so I'm also updating the test expectations for line 83.

Fixes #613

@jrfnl jrfnl added this to the 3.0.0 milestone Aug 24, 2023
@jrfnl jrfnl requested a review from a team as a code owner August 24, 2023 15:01
* Remove the sniff.
* Remove the related test in the `WordPressVIPMinimum/ruleset-test.inc` file.
* Remove the error silencing from VIP-Go.
* Remove the related test in the `WordPress-VIP-Go/ruleset-test.inc` file.
    This one is a little more involved. Basically the call to `wp_verify_nonce()`, which is being removed, was "silencing" the nonce verification error for other tests as well, most notably for the tests on line 83-85, due to most tests being in the global scope.
    Looking at it more closely, turns out that line 83 wasn't testing what it was supposed to be testing.
    The error which was previously being thrown on line 83 was about the nonce verification being missing, while the test is annotated to be about the `WordPress.Security.ValidatedSanitizedInput[.InputNotSanitized]` error, which wasn't being thrown.
    Adding a nonce verification check on some empty lines above these tests gets rid of the nonce verification errors, but now left line 83 not testing anything at all (as no key is accessed in the superglobal).
    Adding a random key gets us the error which was intended to be thrown on this line, but now also adds the "missing validation" error. IMO, this is correct (better than it was before), so I'm also updating the test expectations for line 83.
@GaryJones GaryJones force-pushed the 3.0/fix/613-remove-batcache-sniff branch from 18a2f4b to 7eabe1b Compare August 24, 2023 15:11
Copy link
Contributor

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GaryJones GaryJones merged commit a7006ed into develop Aug 24, 2023
@GaryJones GaryJones deleted the 3.0/fix/613-remove-batcache-sniff branch August 24, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove BatcacheWhitelistedParamsSniff
2 participants