Skip to content

Commit

Permalink
fix: freeze globalThis in coreEval to enforce OCap discipline
Browse files Browse the repository at this point in the history
refs: #4642, #4352
  • Loading branch information
dckc authored and mergify-bot committed Mar 6, 2022
1 parent 748616f commit 02f401f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vats/src/core/chain-behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export const bridgeCoreEval = async allPowers => {
});

// Evaluate the code in the context of the globals.
const behavior = new Compartment(globals).evaluate(code);
const compartment = new Compartment(globals);
harden(compartment.globalThis);
const behavior = compartment.evaluate(code);
return behavior(powers);
}),
),
Expand Down

0 comments on commit 02f401f

Please sign in to comment.