Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reenable indirect eval #26

Closed
wants to merge 1 commit into from
Closed

fix: reenable indirect eval #26

wants to merge 1 commit into from

Conversation

michaelfig
Copy link
Member

closes #25

The issue preventing indirect eval was that the scoped evaluator looks up eval on the proxy target, but it is not defined in either the safeGlobal, nor endowments. This fix makes it work again (if it did before) but needs a careful review.

@michaelfig michaelfig requested a review from erights July 18, 2019 18:45
@michaelfig
Copy link
Member Author

@erights, would you please have a look at this?

@erights
Copy link
Member

erights commented Jul 22, 2019

Sorry!
I'll have this reviewed by tomorrow morning.

Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly questions so far.

// explain/spec
const scopeTarget = create(safeGlobal, {
...getOwnPropertyDescriptors(endowments),
eval: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to have this eval override what may have been contributed as an eval in the endowments? I think it's better to enable the endowments to override this setting, in which case eval: safeEval would be an overridable default.

I do see in the todo comments above that we should ban eval from the endowments, in which case this isn't an observable issue. However, I can no longer reconstruct why we should prohibit it.

Did we not put eval: safeEval on the safeGlobal? Recently, I've been thinking that the scopeTarget is a better place anyway, for both the safe eval and the safe Function constructor. But that has not been the plan. Does the safe Function constructor appear on the safeGlobal? In any case, they should both appear in the same place.

Thus, if we do place Function on the scopeTarget, it should go either before or after the endowments, in the same position as eval.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today I experimented with putting safe eval and Function constructor on the scopeTarget. Some tests are now failing because they expect to do r.global.Function(...) or new r.global.Function(...), and cannot find the Function constructor there.

What should be the expected behaviour? I can certainly rewrite the tests to use r.evaluate('Function')(...) and new (r.evaluate('Function'))(...), but I need to make sure the plan for this whole scopeTarget versus safeGlobal thing is fully-baked.

// todo (shim limitation): scan endowments, throw error if endowment
// overlaps with the const optimization (which would otherwise
// incorrectly shadow endowments), or if endowments includes 'eval'. Also
// prohibit accessor properties (to be able to consistently explain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is stale. Nothing in this PR causes it to be stale, since it is in a todo anyway. However, our safe module plans depend on our ability to install accessors on the scopeTarget.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the comment.

test/module/evaluators.js Show resolved Hide resolved
@michaelfig
Copy link
Member Author

This turns out to be a bad interaction between realms-shim and https://github.com/Agoric/SES

SES doesn't whitelist the eval global, so it's stripped away before client code can actually use it. Continuing this discussion at https://github.com/Agoric/SES/issues/131

@michaelfig michaelfig closed this Jul 24, 2019
@michaelfig michaelfig deleted the 25-indirect-eval branch July 24, 2019 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

indirect eval fails
2 participants