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

Use the URL global instead of the deprecated url.parse #18657

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

nicolo-ribaudo
Copy link
Contributor

Use the URL global instead of the deprecated url.parse

The Node.js url.parse API (https://nodejs.org/api/url.html#urlparseurlstring-parsequerystring-slashesdenotehost) is deprecated because it's prone to security issues (to the point that Node.js doesn't even publish CVEs for it anymore).

The official reccomendation is to instead use the global URL constructor, available both in Node.js and in browsers. Node.js filesystem APIs accept URL objects as parameter, so this also avoids a few URL->filepath conversions.

The changes in test/webserver.mjs are mostly because I needed to pass the URL to the hooks, and then at that point decided to just use it everywhere in the file instead of keeping the regexp-based parsing to get the filepath and query params.

The Node.js url.parse API (https://nodejs.org/api/url.html#urlparseurlstring-parsequerystring-slashesdenotehost)
is deprecated because it's prone to security issues (to the point that Node.js doesn't even publish CVEs for it anymore).

The official reccomendation is to instead use the global URL constructor, available both in Node.js and in browsers.
Node.js filesystem APIs accept URL objects as parameter, so this also avoids a few URL->filepath conversions.
@Snuffleupagus
Copy link
Collaborator

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/90765a0c7e04776/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/aed1bcba6b4767d/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/90765a0c7e04776/output.txt

Total script time: 30.39 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 14
  different first/second rendering: 1

Image differences available at: http://54.241.84.105:8877/90765a0c7e04776/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/aed1bcba6b4767d/output.txt

Total script time: 45.88 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 49

Image differences available at: http://54.193.163.58:8877/aed1bcba6b4767d/reftest-analyzer.html#web=eq.log

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

The src/-part seems OK to me, but I'd like Tim to look at the test/-changes since he's touched that code (somewhat) recently and definitely knows it better.

@timvandermeij
Copy link
Contributor

This looks like a nice improvement to me too, and I have tested this locally as well to make sure the behavior didn't change. Overall I think this is simpler and better. Thanks!

@timvandermeij timvandermeij merged commit 5d94047 into mozilla:master Aug 29, 2024
8 checks passed
@calixteman
Copy link
Contributor

As a side effect, this patch also fixed:
https://bugzilla.mozilla.org/show_bug.cgi?id=1904262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants