Skip to content

Commit

Permalink
use initSafeStandardObjects() instead of initStandardObjects() to avo…
Browse files Browse the repository at this point in the history
…id execution of arbitrary (java) code
  • Loading branch information
rbri committed Jan 24, 2020
1 parent dfa6ffc commit 0ffc3f7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static String evaluate(final String content, final URL url) {
final Context cx = Context.enter();
try {
final ProxyAutoConfig config = new ProxyAutoConfig();
final Scriptable scope = cx.initStandardObjects();
final Scriptable scope = cx.initSafeStandardObjects();

config.defineMethod("isPlainHostName", scope);
config.defineMethod("dnsDomainIs", scope);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private void init(final WebWindow webWindow, final Context context) throws Excep

final Window window = new Window();
((SimpleScriptable) window).setClassName("Window");
context.initStandardObjects(window);
context.initSafeStandardObjects(window);

final ClassConfiguration windowConfig = jsConfig_.getClassConfiguration("Window");
if (windowConfig.getJsConstructor() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public DedicatedWorkerGlobalScope() {
*/
DedicatedWorkerGlobalScope(final Window owningWindow, final Context context, final BrowserVersion browserVersion,
final Worker worker) throws Exception {
context.initStandardObjects(this);
context.initSafeStandardObjects(this);

final ClassConfiguration config = AbstractJavaScriptConfiguration.getClassConfiguration(
DedicatedWorkerGlobalScope.class, browserVersion);
Expand Down

0 comments on commit 0ffc3f7

Please sign in to comment.