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(#3817): send servername for SNI on TLS by metcoder95 · Pull Request #3821 · nodejs/undici

Conversation

@metcoder95

@metcoder95 metcoder95 commented Nov 10, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This relates to...

Fixes #3817

Rationale

Changes

Features

Bug Fixes

Breaking Changes and Deprecations

Status

  • I have read and agreed to the Developer's Certificate of Origin
  • Tested
  • Benchmarked (optional)
  • Documented
  • Review ready
  • In review
  • Merge ready

Sorry, something went wrong.

Uh oh!

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

All reactions
@metcoder95
fix(#3817): send servername for SNI on TLS
4ce4aba
@metcoder95

metcoder95 commented Nov 10, 2024

Copy link
Copy Markdown
Member Author

The test should cover the problem, but if anything better, let me know

All reactions

Sorry, something went wrong.

Uh oh!

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

ronag
ronag approved these changes Nov 11, 2024
View reviewed changes
@DTrombett

DTrombett commented Nov 11, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

This does solve the certificate error but it still doesn't correctly pass the SNI, for example the following code returns a 404:

request("https://example.com", {
  dispatcher: new Agent().compose(interceptors.dns()),
}).then(res => res.body.text()).then(console.log);

Is this just a limitation of interceptors?

All reactions

Sorry, something went wrong.

Uh oh!

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

@ronag

ronag commented Nov 11, 2024

Copy link
Copy Markdown
Member

it still doesn't correctly pass the SNI, for example the following code returns a 404:

Not sure I follow. 404 is not an SNI error?

All reactions

Sorry, something went wrong.

Uh oh!

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

@ronag

ronag commented Nov 11, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

@metcoder95 don't we also need to update the host header to the original url before dns lookup? See https://github.com/nxtedition/nxt-undici/blob/45de148436285d5063ec78aaf6360d0c121fe8ad/lib/interceptor/dns.js#L71-L88

i.e. we convert a dns name to an ip adress before reaching the connection layer, however the intended dns name still needs to be represented in the host header.

metcoder95 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@DTrombett

DTrombett commented Nov 11, 2024

Copy link
Copy Markdown
Contributor

Yeah, I'm sorry, I confused the server name with host; the problem is indeed the Host header and can confirm it works fine when it is manually passed

All reactions

Sorry, something went wrong.

Uh oh!

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

mcollina
mcollina approved these changes Nov 11, 2024
View reviewed changes

@mcollina mcollina left a comment

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.

lgtm

Sorry, something went wrong.

Uh oh!

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

All reactions
@ronag

ronag commented Nov 11, 2024

Copy link
Copy Markdown
Member

the problem is indeed the Host header and can confirm it works fine when it is manually passed

Interesting that this PR doesn't fix that. Don't we always pass servername as host header?

All reactions

Sorry, something went wrong.

Uh oh!

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

ronag
ronag reviewed Nov 11, 2024
View reviewed changes
Comment thread test/interceptors/dns.js Resolved

Uh oh!

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

@metcoder95

metcoder95 commented Nov 11, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

the problem is indeed the Host header and can confirm it works fine when it is manually passed

Interesting that this PR doesn't fix that. Don't we always pass servername as host header?

Noup, I tried to assess that but we were always passing the resolved IP instead (which was set as the new origin). Maybe I overlooked that but can double check.

Update: Yeah, it wasn't doing it. It was setting the host header as the new origin instead of the servername.

Good catch on the host header, I will add it 👍

All reactions

Sorry, something went wrong.

Uh oh!

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

@metcoder95
fix: set host header to servername
0bf4b0d
@metcoder95
metcoder95 requested a review from ronag November 11, 2024 23:05
@metcoder95

metcoder95 commented Nov 11, 2024

Copy link
Copy Markdown
Member Author

@ronag ptal

All reactions

Sorry, something went wrong.

Uh oh!

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

@metcoder95
Merge branch 'main' into fix/3817
d714f07
ronag
ronag requested changes Nov 12, 2024
View reviewed changes

@ronag ronag left a comment

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.

You should do it regardless of https or http

Sorry, something went wrong.

Uh oh!

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

All reactions
ronag
ronag reviewed Nov 12, 2024
View reviewed changes
Comment thread lib/interceptor/dns.js Resolved

Uh oh!

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

@ronag

ronag commented Nov 19, 2024

Copy link
Copy Markdown
Member

@metcoder95 ping?

All reactions

Sorry, something went wrong.

Uh oh!

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

@metcoder95
Merge branch 'main' into fix/3817
b9a6f58
@metcoder95

metcoder95 commented Nov 19, 2024

Copy link
Copy Markdown
Member Author

Sorry, was off last week and still catching up. I'll work on this over the week

All reactions

Sorry, something went wrong.

Uh oh!

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

@metcoder95
refactor: attach regardless
6462224
@metcoder95 metcoder95 added the backport v6.x label Nov 20, 2024
@metcoder95
metcoder95 requested a review from ronag November 20, 2024 09:09
ronag
ronag approved these changes Nov 20, 2024
View reviewed changes
@ronag
ronag merged commit b93a834 into main Nov 20, 2024
@github-actions

github-actions Bot commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

The backport to v6.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-v6.x v6.x
# Navigate to the new working tree
cd .worktrees/backport-v6.x
# Create a new branch
git switch --create backport-3821-to-v6.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b93a83447a99fecf41a09c1b6857ae855a2254c9
# Push it to GitHub
git push --set-upstream origin backport-3821-to-v6.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-v6.x

Then, create a pull request where the base branch is v6.x and the compare/head branch is backport-3821-to-v6.x.

All reactions

Sorry, something went wrong.

Uh oh!

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

metcoder95 added a commit that referenced this pull request Nov 21, 2024
@metcoder95
fix(#3817): send servername for SNI on TLS (#3821)
1f6f91e
* fix(#3817): send servername for SNI on TLS

* fix: set host header to servername

* refactor: attach regardless

(cherry picked from commit b93a834)
mcollina pushed a commit that referenced this pull request Nov 22, 2024
@metcoder95
fix(#3817): send servername for SNI on TLS (#3821) [backport] (#3864)
a0220f1
* fix(#3817): send servername for SNI on TLS (#3821)

* fix(#3817): send servername for SNI on TLS

* fix: set host header to servername

* refactor: attach regardless

(cherry picked from commit b93a834)

* feat: missing interceptor

* fix: lint
@github-actions github-actions Bot mentioned this pull request Dec 3, 2024
[Release] v7.1.0 #3922
Merged
@github-actions github-actions Bot mentioned this pull request Dec 16, 2024
[Release] v7.1.1 #3952
Closed
@github-actions github-actions Bot mentioned this pull request Dec 18, 2024
[Release] v7.2.0 #3962
Merged
@Uzlopak
Uzlopak deleted the fix/3817 branch December 31, 2024 18:19
@github-actions github-actions Bot mentioned this pull request Mar 12, 2025
[Release] v6.21.2 #4092
Closed
@github-actions github-actions Bot mentioned this pull request May 12, 2025
[Release] v6.21.3 #4211
Closed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 29, 2026
feat(tee-worker): migrate TEE worker to Phala Cloud CVM FSM1/cipher-box#395
Merged
6 of 7 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Jun 19, 2026
fix : prevent DNS rebinding SSRF bypass in validateSafeUrl nisshchayarathi/gitverse-nextjs#2348
Closed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 20, 2026
fix(node): guard webhook delivery against SSRF targets ByteVeda/flexiq#491
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@ronag ronag ronag approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

backport v6.x

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

ERR_TLS_CERT_ALTNAME_INVALID with dns interceptor and https

Uh oh!

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

4 participants

@metcoder95 @DTrombett @ronag @mcollina
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 01402775 — 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.