wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Add a check for big base64 images

Open monbauza opened this issue 2 years ago • 10 comments

Moved from https://yoast.atlassian.net/browse/IM-1909 Reporter: @manuelaugustin

Description

We’ve encountered cased where people put very large base64-encoded data urls in their text (see attachment).

This not only crashes our analysis, but might also break browsers. So it’s bad practice to do this.

Detailed information provided by @Jono :

Best practice is to base64 encode small images so that the trade-off on not having to make a network request is positive. For large/complex images, that trade-off doesn't work out; you cripple the browser (and ship a mountain of bytes), and, break/bypass a whole bunch of browser heuristics.

This might be a common problem:

[It might be] common to copy/paste in a big base64 image, especially if it's moving between canvases (e.g., Google search > MS Word > Gutenberg)

The solution to this problem needs to be discussed.

  • We could implement check for base64 images above a certain size in our Paper early in the analysis loop to display a warning about too large base64 images crippling your website (and our analysis).
  • We could also replace the src value for a base64 image to something else.

Here's an example file containing a base64 image: description.txt

monbauza avatar May 15 '23 08:05 monbauza

Comment from Hanna Worku:

Would this work as a new condition the the Images assessment?

monbauza avatar May 15 '23 08:05 monbauza

Please inform the customer of conversation # 1010926 when this conversation has been closed.

monbauza avatar May 15 '23 08:05 monbauza

The SEO data optimization failed for the above customer with error "too much recursion" because one of their posts has a big base64 image. The response for /wp-json/yoast/v1/prominent_words/get_content was truncated (Firefox).

image

monbauza avatar May 15 '23 08:05 monbauza

Please inform the customer of conversation # 1031752 when this conversation has been closed.

monbauza avatar Jul 03 '23 08:07 monbauza

Please inform the customer of conversation # 1049204 when this conversation has been closed.

suascat avatar Aug 22 '23 11:08 suascat

Please inform the customer of conversation # 1058610 when this conversation has been closed.

suascat avatar Sep 25 '23 06:09 suascat

Please inform the customer of conversation # 1152149 when this conversation has been closed.

suascat avatar Jul 15 '24 22:07 suascat

Please inform the customer of conversation # 1249261 when this conversation has been closed.

amboutwe avatar May 14 '25 22:05 amboutwe

Please inform the customer of conversation # 1259115 when this conversation has been closed.

amboutwe avatar May 22 '25 00:05 amboutwe

Please inform the customer of conversation # 1263084 when this conversation has been closed.

amboutwe avatar Jun 07 '25 00:06 amboutwe