public inbox for edbrowse-dev@edbrowse.org
 help / color / mirror / Atom feed
* [Edbrowse-dev] XHR same-domain restriction
@  Kevin Carhart
   ` Karl Dahlke
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Carhart @  UTC (permalink / raw)
  To: Edbrowse-dev



Speaking of securing the filesystem and following up on Dominique's 
message from a few days ago, do we want to implement the restriction that 
XHR is only allowed to load pages from the domain that you are currently on? 
If so, is this a workable phrasing to make the test?  Assuming an xhr 
object which I am referencing as 'this', this.url is a string.  So I turn 
it into our URL class in order to easily grab and test the host.

if (new URL(this.url).host == window.location.host)
{
allow fetchHTTP to run
} else {
prevent fetchHTTP from running
set this.aborted = true
throw a new error with a message
}

Here's a startwindow that makes this change if we want to do this.
http://carhart.net/~kevin/startwindow_20180311.zip

Tested on the dummy page http://carhart.net/~kevin/badxhr.html

Without the change, xhr.responseText gets the contents of http://pizza.com
With the change, it refuses to load http://pizza.com from carhart.net









^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~ UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
 [Edbrowse-dev] XHR same-domain restriction Kevin Carhart
 ` Karl Dahlke
   ` Dominique Martinet
     ` Karl Dahlke
       ` Dominique Martinet
         ` Kevin Carhart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).