edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] XHR same-domain restriction
@ 2018-03-12  5:09 Kevin Carhart
  2018-03-12  6:33 ` Karl Dahlke
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Carhart @ 2018-03-12  5:09 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:[~2018-03-14  1:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-12  5:09 [Edbrowse-dev] XHR same-domain restriction Kevin Carhart
2018-03-12  6:33 ` Karl Dahlke
2018-03-12  7:17   ` Dominique Martinet
2018-03-12 12:38     ` Karl Dahlke
2018-03-12 12:57       ` Dominique Martinet
2018-03-14  1:54         ` 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 NNTP newsgroup(s).