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

module: validate paths early, use internal/errors.js #18359

Closed
wants to merge 4 commits into from

Conversation

joyeecheung
Copy link
Member

  • module: use internal/errors.js in module.require
  • module: validate request in require.resolve
  • module: validate request in require.resolve.paths

Fixes: #18352

First commit is taken from #18358 for better descriptions of errors.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

module

@nodejs-github-bot nodejs-github-bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. module Issues and PRs related to the module subsystem. labels Jan 24, 2018
@joyeecheung
Copy link
Member Author

red = '\u001b[31m';
}
const util = lazyUtil();
if (process.stdout.isTTY && process.stdout.getColorDepth() !== 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just pointing out that this was only executed once in the past, and is now executed each time through the code path.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I'll fix it

@joyeecheung
Copy link
Member Author

@joyeecheung joyeecheung added semver-major PRs that contain breaking changes and should be released in the next major version. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Jan 26, 2018
@joyeecheung
Copy link
Member Author

Rebased. CI before landing: https://ci.nodejs.org/job/node-test-pull-request/12793/

@joyeecheung
Copy link
Member Author

Landed in 3ec7921...9fb91fe. Thanks!

@joyeecheung joyeecheung removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 29, 2018
joyeecheung added a commit that referenced this pull request Jan 29, 2018
PR-URL: #18359
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
joyeecheung added a commit that referenced this pull request Jan 29, 2018
PR-URL: #18359
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
joyeecheung added a commit that referenced this pull request Jan 29, 2018
PR-URL: #18359
Fixes: #18352
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
joyeecheung added a commit that referenced this pull request Jan 29, 2018
PR-URL: #18359
Fixes: #18352
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
PR-URL: nodejs#18359
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
PR-URL: nodejs#18359
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
PR-URL: nodejs#18359
Fixes: nodejs#18352
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
PR-URL: nodejs#18359
Fixes: nodejs#18352
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. module Issues and PRs related to the module subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

module: require.resolve() / require.resolve.paths() to fail early?
4 participants