wp-media / wp-rocket

Performance optimization plugin for WordPress
https://wp-rocket.me
GNU General Public License v2.0
700 stars 219 forks source link

If the RUCSS safelist textarea contains too many rows we get a 401 response from SaaS setting the nulled version message #6989

Open alfonso100 opened 2 months ago

alfonso100 commented 2 months ago

Before submitting an issue please check that you’ve completed the following steps: Yes - Made sure you’re on the latest version Yes - Used the search feature to ensure that the bug hasn’t been reported before

Describe the bug If you set a huge amount of safelists, let's say over 1000 lines, we will get a 401 here https://github.com/wp-media/wp-rocket/blob/975503df515ea4650cc4791e7018519315e32c86/inc/Engine/Common/JobManager/APIHandler/APIClient.php#L93

This causes the license to be marked as nulled and RUCSS disabled:

We couldn't generate the used CSS because you're using a nulled version of WP Rocket. You need an active license to use the Remove Unused CSS feature and further improve your website's performance.

Once we reach this state, since the license is valid and there is no way of re-enabling the Remove Unused CSS option to clean the list, the only ways to recover the original state are

if the customer exports the list, the JSON file will contain the same amount of CSS safelists, that will be adding the problem back

WId7tnY

https://i.imgur.com/WId7tnY.png

To Reproduce Steps to reproduce the behavior:

  1. Add this list as RUCSS safelists: https://jmp.sh/eYZQzccg
  2. Save settings
  3. wait until we get a response from the SaaS
  4. See the nulled license message

Expected behavior If possible we could limit the lines that can be safelisted to a maximum that's safe for the SaaS requests Alternatively, we could check if the response code could be different for these casses

Additional context Slack thread: https://wp-media.slack.com/archives/C08N8J6VC/p1727120607657599 ticket: https://secure.helpscout.net/conversation/2715490951/513783?viewId=2952229

Acceptance Criteria (for WP Media team use only) Clear instructions for developers, to be added before the grooming

piotrbak commented 1 month ago

@mostafa-hisham WDYT?