[wp-trac] [WordPress Trac] #44832: Lack of null check in wp-embed.js causes uncaught error to be thrown under certain circumstances.

WordPress Trac noreply at wordpress.org
Thu Aug 23 14:51:49 UTC 2018


#44832: Lack of null check in wp-embed.js causes uncaught error to be thrown under
certain circumstances.
--------------------------+-----------------------------
 Reporter:  dsifford      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Embeds        |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  javascript    |
--------------------------+-----------------------------
 The file and lines in question can be seen here:
 https://github.com/WordPress/WordPress/blob/5bbb3b38d96eb0aac29d3b368d541039a3b1fbb8
 /wp-includes/js/wp-embed.js#L31-L33

 The issue specifically is that currently the script assumes there will
 always be a data parameter on message. This is not true in the case of
 Google ReCAPTCHA (and I assume many other 3rd party scripts).

 In these cases, `data` is `null` and when attempting to access properties
 on `null`, an error is thrown.

 This all can be fixed by changing the if statement from what it is
 currently to:


 {{{
 if ( data && ! ( data.secret || data.message || data.value ) ) {
         return;
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44832>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list