-
Notifications
You must be signed in to change notification settings - Fork 67
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
shim: reject dynamic import expressions #127
Comments
What's a "dynamic import.meta expression"? |
@erights , could you remind me what this note was for? I know it's related to https://github.com/tc39/proposal-import-meta , but as @ljharb said that appears to only be specced to appear in module code, and I don't think our evaluator is providing such an environment. |
@ljharb is correct, As for the |
@ljharb Yes, you're correct. We are deleting the dot from the conservative regexp, whose purpose was to catch this case. Thanks! |
@jfparadis we addressed this in 2efdf0b, right? Do we feel safe closing this now? |
The vulnerability has been prevented in the shim. We should close this topic. |
This is related to the Shim implementation, closing since it was moved into https://github.com/Agoric/realms-shim. |
ES6 module -style
import
(from module code), at least in a browser environment, could load data from the network, in a way that violates our confinement rules. Until we have a story about how an import trap should work, we need to reject ES6 imports.Static import statements are already illegal in "script code", and our eval parses the strings as script code. However we need the shim code to reject dynamic import expressions and dynamic import.meta expressions. We can use a regular expression to reject the word
import
followed by any amount of whitespace or newlines followed by either//
or/*
or(
or.
(the comment-initiating sequences might eventually be followed by a comment-terminator and then the()
call). This will reject some otherwise legal comments or literal strings that mention imports (making the dynamic import expression "tahoo": something you can't even talk about in this code, much less invoke).If there's a parser, for extra credit, just reject when the AST includes an identifier spelled
import
. This would remove the false rejections.The text was updated successfully, but these errors were encountered: