Rev884, Improve security by stop accepting postMessage if opener present

This commit is contained in:
HelloZeroNet 2016-02-03 00:12:57 +01:00
parent c11d4f2632
commit 4cea7ebcda
3 changed files with 12 additions and 1 deletions

View file

@ -8,7 +8,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.3.6"
self.rev = 881
self.rev = 884
self.argv = argv
self.action = None
self.config_file = "zeronet.conf"

View file

@ -1,6 +1,11 @@
class Wrapper
constructor: (ws_url) ->
@log "Created!"
if window.opener
@log "Security error: Opener present, exiting..."
document.write("Forbidden: Opener present.")
document.body.innerHTML = "Forbidden: Opener present."
return
@loading = new Loading()
@notifications = new Notifications($(".notifications"))

View file

@ -762,6 +762,12 @@ jQuery.extend( jQuery.easing,
this.onMessageInner = __bind(this.onMessageInner, this);
this.onMessageWebsocket = __bind(this.onMessageWebsocket, this);
this.log("Created!");
if (window.opener) {
this.log("Security error: Opener present, exiting...");
document.write("Forbidden: Opener present.");
document.body.innerHTML = "Forbidden: Opener present.";
return;
}
this.loading = new Loading();
this.notifications = new Notifications($(".notifications"));
this.fixbutton = new Fixbutton();