8000 certificate callback can't differentiate IPv6 and a port · Issue #6510 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

certificate callback can't differentiate IPv6 and a port #6510

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

Closed
ehuss opened this issue Feb 26, 2023 · 4 comments
Closed

certificate callback can't differentiate IPv6 and a port #6510

ehuss opened this issue Feb 26, 2023 · 4 comments

Comments

@ehuss
Copy link
Contributor
ehuss commented Feb 26, 2023

The change introduced in #6503 prevents determining which part of the host string is an IPv6 address and which is the port number.

cc @fxcoudert

Reproduction steps

  1. Clone a repo using an IPv6 address with a port. For example, ssh://user@[::1]:2022/somerepo
  2. Have a certificate callback function.

Expected behavior

The certificate callback function can determine what is the host and what is the port.

I'm guessing there is reluctance to make an API breaking change to the callback function to add the port as a separate parameter? That would ultimately be my preference, but I can understand if there are concerns about API changes. However, this resulted in a behavioral change which is roughly equivalent to an API breaking change. Code expecting the value to be a host string no longer works.

Actual behavior

The host string is passed as ::1:2022 preventing a reliable way to determine which part is the IP address and which part is the host.

Version of libgit2 (release number or SHA1)

1.6.1

Operating system(s) tested

Any

@fxcoudert
Copy link
Contributor

A possible solution is to return [host]:port when host contains the : character?

@ehuss
Copy link
Contributor Author
ehuss commented Feb 27, 2023

Since I suspect most certificate callback routines need to extract the host and port separately, instead of expecting them to parse a string I would suggest just making the port a separate parameter (or pass in some structure which can be extended in the future).

Since changing the format of the host string may break existing implementations, I think for me it would be preferred to make that breakage explicit via an API change (or add an alternate callback with the different API if breakage is too much of a concern).

@ethomson ethomson mentioned this issue Feb 27, 2023
@ethomson
Copy link
Member

I'm going to revert #6503. We'll sort this out for v1.7.

@ethomson
Copy link
Member

Fixed in https://github.com/libgit2/libgit2/releases/v1.6.2 and opened #6515 to track a proper fix.

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

No branches or pull requests

3 participants
0