Skip to content

Conversation

@savonarola
Copy link
Contributor

@savonarola savonarola commented Jul 23, 2025

Hello!
If server_name_indication is passed, then the server provides us the appropriate certificate. So we need to match the passed SNI value with the certificate, not the connect host.

@savonarola savonarola changed the title Fix default default options Fix default ssl options in presence of SNI Jul 23, 2025
@benoitc benoitc requested a review from Copilot July 24, 2025 11:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes SSL certificate verification when Server Name Indication (SNI) is used. The change ensures that when SNI is specified in the SSL options, the certificate is verified against the SNI hostname rather than the connection hostname.

  • Updates merge_ssl_opts/2 to determine the correct hostname for certificate verification based on SNI configuration
  • Extracts the SNI value from override options and uses it as the verification host when SNI is enabled
Comments suppressed due to low confidence (1)

src/hackney_connection.erl:140

  • [nitpick] The variable name 'SNI' is an acronym that could be more descriptive. Consider renaming it to 'SniHostname' or 'SniValue' to better indicate that it represents the hostname value for SNI.
    SNI -> SNI

@benoitc benoitc merged commit 9c0f258 into benoitc:master Jul 24, 2025
5 checks passed
@benoitc
Copy link
Owner

benoitc commented Jul 24, 2025

thznk you for your change!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants