GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: url parser should throw error on invalid ipv4 by anonrig · Pull Request #42915 · nodejs/node

Conversation

@anonrig

@anonrig anonrig commented Apr 29, 2022 •
edited by aduh95
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Fixes: #42914

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

shakogegia and bricss reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Apr 29, 2022
@anonrig
anonrig force-pushed the fix/url-ipv4 branch from 0af57b1 to 6a26d2e Compare April 29, 2022 16:57
Qard
Qard approved these changes Apr 29, 2022
View reviewed changes
@anonrig
anonrig force-pushed the fix/url-ipv4 branch from 6a26d2e to 30b5b9a Compare April 29, 2022 17:04
aduh95
aduh95 reviewed Apr 29, 2022
View reviewed changes
Comment thread test/parallel/test-whatwg-url-constructor.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@anonrig
anonrig force-pushed the fix/url-ipv4 branch from 30b5b9a to 76eeac3 Compare April 29, 2022 17:21
aduh95
aduh95 approved these changes Apr 29, 2022
View reviewed changes
@anonrig
anonrig force-pushed the fix/url-ipv4 branch from 76eeac3 to 6da540f Compare April 29, 2022 17:25
@aduh95 aduh95 added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Apr 29, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Apr 29, 2022
@nodejs-github-bot

nodejs-github-bot commented Apr 29, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/43780/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig
anonrig force-pushed the fix/url-ipv4 branch from 6da540f to a2e19dd Compare April 29, 2022 17:37
@Trott

Trott commented Apr 29, 2022

Copy link
Copy Markdown
Member

@nodejs/url

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Apr 29, 2022

Copy link
Copy Markdown
Member

It looks like this results in many other tests failing?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig

anonrig commented Apr 29, 2022

Copy link
Copy Markdown
Member Author

Hi @Trott I'm trying to pinpoint the reason behind why the C++ code does not work.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Apr 29, 2022

Copy link
Copy Markdown
Member

Hi @Trott I'm trying to pinpoint the reason behind why the C++ code does not work.

I'm not terribly familiar with that code or frankly C++ in general, plus I'm kinda occupied with other things right now, but a quick git blame on the relevant part of the file and a git shortlog on the file suggest that @TimothyGu or @addaleax might be people who can provide some direction/guidance. Neither of them are as active on the project as they once were, but they're both still around.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig
anonrig force-pushed the fix/url-ipv4 branch from a2e19dd to 4e446a9 Compare April 29, 2022 18:58
@anonrig

anonrig commented Apr 29, 2022

Copy link
Copy Markdown
Member Author

So, the problem was that when the parser saw more than 4 . character, it just forgot about the input being a ipv4 and just continued parsing the input as a domain. Because of this particular line:

bool is_ipv4;
ParseIPv4Host(decoded.c_str(), decoded.length(), &is_ipv4);
if (is_ipv4)
  return;

Another big issue is around this line. Since, if parse number fails, it should also return a FAILURE, but before it should define is_ipv4 = true.

int64_t n = ParseNumber(mark, pointer);
if (n < 0)
  return;
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig
anonrig force-pushed the fix/url-ipv4 branch from 4e446a9 to 0defa75 Compare April 29, 2022 19:49
@github-actions github-actions Bot mentioned this pull request Apr 30, 2022
CI Reliability 2022-04-30 nodejs/reliability#267
Open
27 tasks
targos
targos reviewed Apr 30, 2022
View reviewed changes
Comment thread test/fixtures/wpt/url/resources/urltestdata.json Outdated

@targos targos Apr 30, 2022

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

test/fixtures/wpt should be updated using https://github.com/nodejs/node-core-utils/blob/main/docs/git-node.md#git-node-wpt

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anonrig anonrig Apr 30, 2022

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This will introduce more failing tests. I've opened an additional issue in order to keep track of spec compliance and fix those issues.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@anonrig

anonrig commented Apr 30, 2022

Copy link
Copy Markdown
Member Author

@aduh95 can you re-run the failed test?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request May 1, 2022
CI Reliability 2022-05-01 nodejs/reliability#268
Open
29 tasks
@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label May 1, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label May 1, 2022
@nodejs-github-bot

nodejs-github-bot commented May 1, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/43802/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented May 1, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Microscopic nit-pick on the commit message. Can be ignored (someone can fix it while landing if they feel strongly about it), but FYI for future stuff: First word should be an imperative verb (so an action). Instead of "should validate...", just "validate....".

anonrig reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig

anonrig commented May 1, 2022

Copy link
Copy Markdown
Member Author

Thank you @Trott. You're absolutely right! I'll definitely take this feedback into consideration in my next commit. BTW, one of the test always goes to timeout. Is this a common problem or related to this pull request?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented May 1, 2022

Copy link
Copy Markdown
Member

one of the test always goes to timeout. Is this a common problem or related to this pull request?

I haven't looked to see what test you are talking about specifically, but test reliability is definitely an issue we struggle with, so likely a common problem.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig @Trott
url: validate ipv4 part length
87d0d7a
PR-URL: nodejs#42915
Fixes: nodejs#42914
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@Trott
Trott force-pushed the fix/url-ipv4 branch from 0defa75 to 87d0d7a Compare May 1, 2022 20:28
@Trott
Trott merged commit 87d0d7a into nodejs:master May 1, 2022
@Trott

Trott commented May 1, 2022

Copy link
Copy Markdown
Member

Landed in 87d0d7a

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented May 1, 2022

Copy link
Copy Markdown
Member

Thanks for the contribution! 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig
anonrig deleted the fix/url-ipv4 branch May 1, 2022 20:37
@anonrig

anonrig commented May 1, 2022

Copy link
Copy Markdown
Member Author

Thanks @Trott!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request May 2, 2022
CI Reliability 2022-05-02 nodejs/reliability#269
Open
30 tasks
@sepehrst

sepehrst commented May 2, 2022

Copy link
Copy Markdown

@anonrig @aduh95 @targos @Trott This is not the right fix.
It now throws on new URL('http://256.256.256.256.com')
Sorry I don't have the time to open an issue.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented May 2, 2022

Copy link
Copy Markdown
Contributor

This PR changed quite a lot between the time I reviewed it and the time it landed, and #42915 (comment) looks like a blocker to me. I think we should revert.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aduh95 added a commit to aduh95/node that referenced this pull request May 2, 2022
@aduh95
url: revert "validate ipv4 part length"
05dcc02
This reverts commit 87d0d7a.

Refs: nodejs#42915
@aduh95 aduh95 mentioned this pull request May 2, 2022
url: revert "validate ipv4 part length" #42940
Merged
@targos targos added the dont-land-on-v18.x label May 2, 2022
@github-actions github-actions Bot mentioned this pull request May 3, 2022
CI Reliability 2022-05-03 nodejs/reliability#270
Open
33 tasks
@richardlau richardlau added dont-land-on-v14.x labels May 3, 2022
@github-actions github-actions Bot mentioned this pull request May 4, 2022
CI Reliability 2022-05-04 nodejs/reliability#271
Open
34 tasks
nodejs-github-bot pushed a commit that referenced this pull request May 5, 2022
@aduh95
url: revert "validate ipv4 part length"
a3ff4bf
This reverts commit 87d0d7a.

Refs: #42915

PR-URL: #42940
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@F3n67u F3n67u mentioned this pull request Jun 4, 2022
test, url: update WHATWG URL parser to align with latest spec #43190
Merged
danielleadams pushed a commit that referenced this pull request Jun 11, 2022
@anonrig @danielleadams
url: validate ipv4 part length
939a812
PR-URL: #42915
Fixes: #42914
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this pull request Jun 11, 2022
@aduh95 @danielleadams
url: revert "validate ipv4 part length"
8fc42d3
This reverts commit 87d0d7a.

Refs: #42915

PR-URL: #42940
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@danielleadams danielleadams mentioned this pull request Jun 11, 2022
v18.4.0 proposal #43385
Merged
@RafaelGSS RafaelGSS mentioned this pull request Oct 14, 2022
2022-10-18, Version 19.0.0 (Current) #44626
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Qard Qard Qard approved these changes
@aduh95 aduh95 aduh95 approved these changes
+1 more reviewer
@targos targos targos left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. whatwg-url Issues and PRs related to the WHATWG URL implementation.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

URL parser does not validate ipv4 with more than 4 parts

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@anonrig @nodejs-github-bot @Trott @sepehrst @aduh95 @Qard @targos @richardlau
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.