[wp-trac] [WordPress Trac] #48077: Plugin install fails from popup modal on localhost installs

WordPress Trac noreply at wordpress.org
Thu Sep 19 23:11:56 UTC 2019

#48077: Plugin install fails from popup modal on localhost installs
 Reporter:  garrett-eclipse          |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  low                      |   Milestone:  5.3
Component:  Upgrade/Install          |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-screenshots has-     |     Focuses:  javascript,
  patch commit                       |  administration

Comment (by garrett-eclipse):

 Replying to [comment:7 afragen]:
 > @garrett-eclipse I did some digging and you’ve already solved this
 issue. 😉
 > https://github.com/afragen/github-updater/issues/491
 > {{{
 > function allow_unsafe_urls ( $args ) {
 >       $args['reject_unsafe_urls'] = false;
 >       return $args;
 > }
 > add_filter( 'http_request_args', 'allow_unsafe_urls' );
 > }}}

 Thanks @afragen I don't believe that's related to this and wouldn't think
 we'd want a filter to support local development.

 That being said I did attempt it but was unsuccessful with TwentyNineteen
 and applying that filter (2016 wow how time flies).

 The issue as illustrated by the fix in
 48077.diff] is all JS related so isn't being run by the reject_unsafe_urls
 filters. The issue in the JS is the check on the postMessage event which
 didn't take into account the potential of there being a port on it. The
 patch addresses this discrepancy in the JS conditional check by allowing
 the port to be present in expectedOrigin by using document.location.host
 instead of document.location.hostname.

Ticket URL: <https://core.trac.wordpress.org/ticket/48077#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list