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

fix: allowing for the usage of authenticated http proxies for https endpoints #6352

Closed
wants to merge 1 commit into from

Conversation

shawkins
Copy link
Contributor

Description

closes: #6350

Switched from using the full proxy authorization to the username and password - this could be viewed as a breaking change, but it is more straight-forward than adding a routine the parse those values back out.

The jdk client works as is with the existing code, but the system property -Djdk.http.auth.tunneling.disabledSchemes="" must be set for the header to get propogated to the tunneling request so I didn't add that test subclass yet.

The ability to set the socket policy per response ended up not being needed so that can be removed if desired.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@manusa
Copy link
Member

manusa commented Sep 18, 2024

Jetty tests are failing

@Override
public MockResponse peek() {
return new MockResponse().setSocketPolicy(SocketPolicy.EXPECT_CONTINUE);
return new MockResponse().setSocketPolicy(defaultSocketPolicy);
Copy link
Member

Choose a reason for hiding this comment

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

In #5632 this is removed since it's not necessary for the Vert.x server.

Is this required? I'm not sure how to port these changes to the other PR once we merge this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this required?

As far as I can tell that is needed to make the https tunnel actually work.

The test doesn't need to fully succeed to establish the tunnel - I've updated it to capture if the authentication header was sent we could just check for that and let the request fail fast.

@shawkins
Copy link
Contributor Author

Jetty tests are failing

Should be addressed now.

Copy link

sonarcloud bot commented Sep 19, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
42.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@manusa
Copy link
Member

manusa commented Sep 20, 2024

This PR is modifying some of our exposed interfaces.
This prevents me from back-porting the changes to a 6.13.4 version (which is a requirement by other downstream projects -LTS-).
Is it possible to fix the issue without modifying the interfaces and leaving the existentmethod signatures intact?

@cescoffier
Copy link

As @manusa it would be super appreciated if we can get a fix that can be backported in a micro-release.

@manusa
Copy link
Member

manusa commented Sep 20, 2024

As @manusa it would be super appreciated if we can get a fix that can be backported in a micro-release.

Yes, the main problem with the PR as it is right now is that it has source breaking changes (binary too ;))

Since @shawkins has already worked on this maybe he can adjust it to remove all breakages.

If not, we will implement a different fix -if possible-.

Once this is in, we can proceed with #6253

@shawkins
Copy link
Contributor Author

This PR is modifying some of our exposed interfaces.

Although unlikely it is possible that users are directly setting up the proxy authentication for their http clients - I wasn't sure how much of an api guarentee we would want to extend there. At least for 7.0+ it seems much more straight-forward to drop the old method.

Is it possible to fix the issue without modifying the interfaces and leaving the existentmethod signatures intact?

Leaving the existing signature in a straight-forward way means that we'll need to support parsing the username and password. Not a huge deal, just a pain. I would add that specifically to the back port.

@shawkins
Copy link
Contributor Author

shawkins commented Sep 20, 2024

To clarify things more. Supporting proxyAuthorization is more generally than just supporting basic. However only the OkHttp and JDK client (with an additional system property) seem to handle this situation as expected with https endpoints. Jetty and vertx form their connect requests without consulting the current headers.

So this pr is a minimal alignment of support that is common across all the clients, but we do loose the general proxyAuthorization support. Any other authentication types are no longer supported. I'm not aware however of needing to support anything other than basic.

So the full range of options for compatiblity are:

  • Add limited support for proxyAuthorization such that it maps to this username password support (mentioned above)
  • Add full support for proxyAuthorization - that will require these changes + the old code and some additional (java)docs explaining what takes presedence and what is supported by which clients and when
  • Get vertx to change its logic to not be based specifically on the username/password, but allow for an existing header to be passed to the connect request. Authenticated proxy access to https endpoints still wouldn't work for Jetty under this scenario. @cescoffier is vertx open to change here?

@cescoffier
Copy link

I think it would make sense. But I'm not sure when this could be done. (Cc @vietj )

@shawkins
Copy link
Contributor Author

Add full support for proxyAuthorization - that will require these changes + the old code and some additional (java)docs explaining what takes presedence and what is supported by which clients and when

#6371 retains proxyAuthorization and does not yet introduce new method(s). So closing with further work to be done under #6372 #6373

I think it would make sense. But I'm not sure when this could be done. (Cc @vietj )

Took more of a look at the changes involved with this and our potential direction here and determined this isn't worth pursuing. We'll go down the path of deprecating proxyAuthorization.

@shawkins shawkins closed this Sep 24, 2024
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.

Proxy authentication does not work with vertx client and https endpoint
3 participants