]> khamidou — GitHub mirrors - electron.git/commitdiff
Use except-iframe security by default.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 4 Mar 2014 12:12:10 +0000 (20:12 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 4 Mar 2014 12:12:43 +0000 (20:12 +0800)
browser/native_window.cc
renderer/atom_renderer_client.cc

index 85396ab7a5d2b8a4058047f6169b4cbdc3b2e34e..5f9d72f65d8f7de265556645ba1118872db56d54 100644 (file)
@@ -56,7 +56,7 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
     : content::WebContentsObserver(web_contents),
       has_frame_(true),
       is_closed_(false),
-      node_integration_("all"),
+      node_integration_("except-iframe"),
       has_dialog_attached_(false),
       weak_factory_(this),
       inspectable_web_contents_(
index e73e5e999f237f146138e1bac018629f3cf8a29e..d2d095c4fe399f8aa989f9f6fefbe6d4c2f621a6 100644 (file)
@@ -21,10 +21,11 @@ namespace atom {
 namespace {
 
 // Security tokens.
-const char* kExceptIframe = "except-iframe";
-const char* kManualEnableIframe = "manual-enable-iframe";
-const char* kDisable = "disable";
-const char* kEnableNodeIntegration = "enable-node-integration";
+const char* kSecurityAll = "all";
+const char* kSecurityExceptIframe = "except-iframe";
+const char* kSecurityManualEnableIframe = "manual-enable-iframe";
+const char* kSecurityDisable = "disable";
+const char* kSecurityEnableNodeIntegration = "enable-node-integration";
 
 // Scheme used by devtools
 const char* kChromeDevToolsScheme = "chrome-devtools";
@@ -32,17 +33,19 @@ const char* kChromeDevToolsScheme = "chrome-devtools";
 }  // namespace
 
 AtomRendererClient::AtomRendererClient()
-    : node_integration_(ALL),
+    : node_integration_(EXCEPT_IFRAME),
       main_frame_(NULL) {
   // Translate the token.
   std::string token = CommandLine::ForCurrentProcess()->
       GetSwitchValueASCII(switches::kNodeIntegration);
-  if (token == kExceptIframe)
+  if (token == kSecurityExceptIframe)
     node_integration_ = EXCEPT_IFRAME;
-  else if (token == kManualEnableIframe)
+  else if (token == kSecurityManualEnableIframe)
     node_integration_ = MANUAL_ENABLE_IFRAME;
-  else if (token == kDisable)
+  else if (token == kSecurityDisable)
     node_integration_ = DISABLE;
+  else if (token == kSecurityAll)
+    node_integration_ = ALL;
 
   if (IsNodeBindingEnabled()) {
     node_bindings_.reset(NodeBindings::Create(false));
@@ -164,7 +167,7 @@ bool AtomRendererClient::IsNodeBindingEnabled(WebKit::WebFrame* frame) {
     return true;
   else if (node_integration_ == MANUAL_ENABLE_IFRAME &&
            frame != NULL &&
-           frame->uniqueName().utf8().find(kEnableNodeIntegration)
+           frame->uniqueName().utf8().find(kSecurityEnableNodeIntegration)
                == std::string::npos)
     return false;
   else if (node_integration_ == EXCEPT_IFRAME && frame != NULL)