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

net: validate host name for server listen #54470

Merged
merged 1 commit into from
Aug 25, 2024

Conversation

jazelly
Copy link
Contributor

@jazelly jazelly commented Aug 21, 2024

Fixes: #54441

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. labels Aug 21, 2024
@jazelly jazelly force-pushed the validate-square-bracket-host branch from 9a98517 to a4b1c6e Compare August 21, 2024 05:29
@jazelly jazelly force-pushed the validate-square-bracket-host branch from a4b1c6e to 859a003 Compare August 21, 2024 06:31
lib/net.js Outdated Show resolved Hide resolved
@jazelly jazelly force-pushed the validate-square-bracket-host branch 2 times, most recently from 205e03b to 4036852 Compare August 21, 2024 07:31
@jazelly jazelly changed the title net: validate host name with square brackets net: validate host name for server listen Aug 21, 2024
Copy link

codecov bot commented Aug 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.33%. Comparing base (e4f61de) to head (9e8f849).
Report is 48 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #54470    +/-   ##
========================================
  Coverage   87.33%   87.33%            
========================================
  Files         648      649     +1     
  Lines      182321   182532   +211     
  Branches    34971    35029    +58     
========================================
+ Hits       159222   159421   +199     
- Misses      16374    16392    +18     
+ Partials     6725     6719     -6     
Files Coverage Δ
lib/net.js 92.66% <100.00%> (+0.02%) ⬆️

... and 52 files with indirect coverage changes

lib/net.js Outdated Show resolved Hide resolved
@jazelly jazelly force-pushed the validate-square-bracket-host branch 2 times, most recently from 9785834 to 6ff4d74 Compare August 21, 2024 12:58
@jazelly
Copy link
Contributor Author

jazelly commented Aug 21, 2024

PR comments addressed. Seems like this PR is more like validating host with regex. I have added extra test cases to cover the happy paths

@jakecastelli jakecastelli added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 22, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 22, 2024
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina
Copy link
Member

I have a rough feeling this might be semver-major. What was the error that was produced before this patch?

@jazelly
Copy link
Contributor Author

jazelly commented Aug 22, 2024

What was the error that was produced before this patch?

before it goes to dns look up and fails there

node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND [::]
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
Emitted 'error' event on Server instance at:
    at GetAddrInfoReqWrap.doListen [as callback] (node:net:2132:12)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:17) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: '[::]'
}

@jazelly jazelly force-pushed the validate-square-bracket-host branch from a050a83 to f2119ea Compare August 22, 2024 13:40
@mcollina mcollina added the semver-major PRs that contain breaking changes and should be released in the next major version. label Aug 22, 2024
@jazelly jazelly force-pushed the validate-square-bracket-host branch from f2119ea to 9e8f849 Compare August 22, 2024 23:50
@jakecastelli jakecastelli added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 23, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 23, 2024
@nodejs-github-bot
Copy link
Collaborator

@jakecastelli jakecastelli added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 23, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 25, 2024
@nodejs-github-bot nodejs-github-bot merged commit 52322aa into nodejs:main Aug 25, 2024
59 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 52322aa

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. needs-ci PRs that need a full CI run. net Issues and PRs related to the net 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.

server.listen's bind argument does not accept [::] for ipv6
8 participants