Ensure that privates are private.
- Remove JS code injection functionality from UtilsNativeHandler.
- Ensure that utils.expose only exposes public properties.
- Prevent privates from getting poisoned via arbitrary constructor invocations.
- Prevent privates from leaking through prototypes.
BUG=603748
Review URL: https://codereview.chromium.org/1903303002
Cr-Commit-Position: refs/heads/master@{#389292}
diff --git a/extensions/renderer/module_system.cc b/extensions/renderer/module_system.cc
index 9f708bf..dd13786 100644
--- a/extensions/renderer/module_system.cc
+++ b/extensions/renderer/module_system.cc
@@ -618,6 +618,10 @@
ToV8StringUnsafe(GetIsolate(), "Failed to create privates"));
return;
}
+ v8::Maybe<bool> maybe =
+ privates.As<v8::Object>()->SetPrototype(context()->v8_context(),
+ v8::Null(args.GetIsolate()));
+ CHECK(maybe.IsJust() && maybe.FromJust());
SetPrivate(obj, "privates", privates);
}
args.GetReturnValue().Set(privates);