Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
while reading the commonjs loader i noticed that
ModuleScript.isSandboxeddecides containment withURI.relativize, which only normalises literal dot segments on the raw path, while thefile:url handler percent-decodes the path again before it opens the file. so with a sandboxedrequirerooted atfile:///app/modules/, an id like%2e%2e/secretor..%2Fsecretpasses the check but loads and runs/app/secret.jsand hands its exports back to the script, whereas../secretand absolute ids are rejected as expected. the gate seems to be the right layer for this since the source providers don't know whether they are serving a sandboxedrequire, so this makes it look at the decoded relative path too and refuse any..segment (on either separator, for windows). the check still runs after the source has been compiled, as it already does for absolute ids, and i've left that ordering alone. added a case toRequireTestfor the three encoded spellings, which fails on master and passes here.