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

errors: remove input from ERR_INVALID_URL message #38614

Closed
wants to merge 1 commit into from

Conversation

moander
Copy link
Contributor

@moander moander commented May 9, 2021

The dynamic part in the message, if any, should be the reason explaining why the url is invalid and not the url it self.

Migrating from url.parse() to new URL() you may start to see ERR_INVALID_URL errors in logs and http responses where the message contains the full input url. I decided to propose this change after discovering a secret being exposed. It will produce more compact errors but it may also help avoid user error like this to become a common attack surface during migration to whatwg.

ERR_INVALID_URL also seems to stand out from the other more compact errors found in errors.js so I hope this change is welcome.

What do you guys think?

@github-actions github-actions bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. needs-ci PRs that need a full CI run. labels May 9, 2021
@targos
Copy link
Member

targos commented May 10, 2021

FWIW the input was added to the error in #11934

@targos
Copy link
Member

targos commented May 10, 2021

@nodejs/url

@moander moander force-pushed the patch-2 branch 3 times, most recently from cb10e91 to 09df9e4 Compare May 11, 2021 06:47
Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

LGTM with the failing test fixed.

Copy link
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

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

LGTM with a nit

lib/internal/errors.js Outdated Show resolved Hide resolved
Copy link
Contributor

@RaisinTen RaisinTen left a comment

Choose a reason for hiding this comment

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

The commit message should be

- errors: removed input from ERR_INVALID_URL message
+ errors: remove input from ERR_INVALID_URL message

as we use an imperative verb (https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines) but this can be fixed while landing.

@moander moander force-pushed the patch-2 branch 2 times, most recently from 34fc705 to f7da77c Compare May 12, 2021 18:04
Avoid potentially huge messages and leaked secrets.
@RaisinTen RaisinTen changed the title errors: removed input from ERR_INVALID_URL message errors: remove input from ERR_INVALID_URL message May 13, 2021
@nodejs-github-bot

This comment has been minimized.

@RaisinTen RaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 13, 2021
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented May 14, 2021

@jasnell
Copy link
Member

jasnell commented May 17, 2021

Landed in 417c31b

@jasnell jasnell closed this May 17, 2021
jasnell pushed a commit that referenced this pull request May 17, 2021
Avoid potentially huge messages and leaked secrets.

PR-URL: #38614
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
targos pushed a commit that referenced this pull request May 18, 2021
Avoid potentially huge messages and leaked secrets.

PR-URL: #38614
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. errors Issues and PRs related to JavaScript errors originated in Node.js core. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants