Skip to content

Commit

Permalink
fix(SwingSet): ensure the registerEndOfCrank doesn't allow sandbox es…
Browse files Browse the repository at this point in the history
…cape
  • Loading branch information
michaelfig committed Feb 26, 2020
1 parent e390c35 commit 053c56e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/SwingSet/src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,28 @@ function makeSESEvaluator(registerEndOfCrank) {
'@agoric/nat': Nat,
});

const realmRegisterEndOfCrank = s.evaluate(
`\
function realmRegisterEndOfCrank(fn) {
try {
registerEndOfCrank(fn);
} catch (e) {
// do nothing.
}
}`,
{ registerEndOfCrank },
);

return src => {
// FIXME: Note that this replaceGlobalMeter endowment is not any
// worse than before metering existed. However, it probably is
// only necessary to be added to the kernel, rather than all
// static vats once we add metering support to the dynamic vat
// implementation.
// Same for registerEndOfCrank.
// FIXME: Same for registerEndOfCrank.
return s.evaluate(src, {
require: r,
registerEndOfCrank,
registerEndOfCrank: realmRegisterEndOfCrank,
replaceGlobalMeter,
})().default;
};
Expand Down

0 comments on commit 053c56e

Please sign in to comment.