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

Resolve trusted proxy host names to all available A/AAAA records #43188

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ahus1
Copy link
Contributor

@ahus1 ahus1 commented Sep 10, 2024

Closes #42782

During my tests, I found that CNAMEs are resolved implicitly already, so no manual extra where necessary to handle those.

I might need some help for additional tests, as I don't know how to best mock a DNS.

Closes quarkusio#42782

Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
@ahus1 ahus1 force-pushed the is-42782-fix-dns-lookup-trusted-proxies branch from a53d50f to ba879ae Compare September 10, 2024 15:11
Copy link
Member

@cescoffier cescoffier left a comment

Choose a reason for hiding this comment

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

LGTM, but yes, a bit more testing would be great.

Unfortunately, testing DNS is hard. @vietj how do you do that in Vert.x?

@ahus1 Look at https://github.com/eclipse-vertx/vert.x/blob/master/vertx-core/src/test/java/io/vertx/test/fakedns/FakeDNSServer.java.

@vietj
Copy link

vietj commented Sep 13, 2024

You can look at the FakeDNSServer in vertx core tests (or reuse it) to do proper testing.

@michalvavrik
Copy link
Member

Changes LGTM. +1 for test, I remember I didn't know how to make one.

@geoand
Copy link
Contributor

geoand commented Sep 24, 2024

@ahus1 do you plan to add a test like @cescoffier mentions?

Closes quarkusio#42782

Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
@ahus1
Copy link
Contributor Author

ahus1 commented Sep 24, 2024

I had a look at FakeDNSServer. In commit 61f8329 I copied it over as I didn't find it available in a dependency, and used it in a first test which is green. A future commit might clear the bits that are not needed. As this is more like a PoC for a DNS based test, I kept it for now.

It still tests only part of the code, as it is not testing IPv6 as the caller is using IPv4 all the time. Also event.remoteAddress()).ipAddress() is always available, so no resolving of the remote address is necessary. It seems I need some help here to also test those code paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Out of scope
Development

Successfully merging this pull request may close these issues.

Lookup of trusted proxies by hostname broken due to DNS issues in Vert.x
5 participants