-
Notifications
You must be signed in to change notification settings - Fork 850
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
sandboxed modules cannot require with dot slash identifiers #44
Comments
I've added a test to my fork that demonstrates the same issue. |
It's very possible that I don't understand what "sandboxed" is supposed to mean, but here's what things look like to me. If a module uses an identifier that doesn't start with a dot to require another module, that required module is considered sandboxed. If a module uses an identifier that does start with a dot to require another, that required module is not considered sandboxed, and it can no longer require any other modules if require was installed with sandboxed true - when an id starts with a dot, the moduleUri is non-null and the resulting module is created with a null base which means that Is sandboxed really supposed to mean that modules can never use relative identifiers to require one another? |
Fixed by 16f2f34. Unfortunately I had to change public APIs in commonjs/module again, but this API changed anyway since 1.7R3. I didn't merge your test case because the testRelativeId test we already have is supposed to cover this. The reason it didn't was that modules were first loaded by absolute ID and only then by relative ID, and the sandbox test is only performed the first time around. I fixed this so the test now triggers the sandbox check. |
Thanks @hns for this change. Sandboxed require is working well for me again. |
Previously, it was possible to install a "sandboxed" require and require modules that used dot/slash identifiers to require other modules.
E.g.
main.js
dot-relative/main.js
dot-relative/sub/main.js
At 2442919:
The text was updated successfully, but these errors were encountered: