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

feat(NODE-2939): add new hostname canonicalization opts #3131

Merged
merged 26 commits into from Feb 17, 2022

Conversation

durran
Copy link
Member

@durran durran commented Feb 4, 2022

Description

NODE-2939
Also syncs NODE-2443 and NODE-2563

Updates CANONICALIZE_HOST_NAME options to accept true, false, "none", "forward", "forwardAndReverse".

What is changing?

When canonicalizing the host name when using GSSAPI, the driver will now behave as follows for these values:

  • true or "forwardAndReverse": Performs a forward DNS lookup of the host and a reverse lookup of the IP address to obtain the hostname. If the reverse lookup fails the driver falls back to a cname lookup.
  • "forward": Performs a cname lookup of the host.
  • false or "none": Does no hostname canonicalization.

When syncing the spec tests some other auth spec tests we hadn't synced yet were there, so I decided to leave them and skip the single failure.

Is there new documentation needed for these changes?

None

What is the motivation for this change?

DRIVERS-1803 / NODE-2939

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: <type>(NODE-xxxx)<!>: <description>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

src/cmap/auth/gssapi.ts Outdated Show resolved Hide resolved
@durran durran force-pushed the NODE-2939-hostname-canonicalization branch 2 times, most recently from 342e819 to 77a4f37 Compare February 4, 2022 15:01
test/unit/assorted/auth.spec.test.ts Outdated Show resolved Hide resolved
src/cmap/auth/mongo_credentials.ts Outdated Show resolved Hide resolved
src/cmap/auth/gssapi.ts Outdated Show resolved Hide resolved
src/cmap/auth/mongo_credentials.ts Outdated Show resolved Hide resolved
@durran durran force-pushed the NODE-2939-hostname-canonicalization branch from 4fea7eb to 48025aa Compare February 10, 2022 21:28
@durran durran requested a review from nbbeeken February 10, 2022 21:38
@durran durran added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Feb 10, 2022
nbbeeken
nbbeeken previously approved these changes Feb 10, 2022
@durran durran added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Feb 10, 2022
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

I'm leaving some comments here because we pulled in more specs than just this ticket, so we should tag the corresponding tickets on this PR and then close them when this merges

test/spec/auth/connection-string.json Show resolved Hide resolved
test/spec/auth/connection-string.json Show resolved Hide resolved
test/spec/auth/connection-string.json Show resolved Hide resolved
test/unit/assorted/auth.spec.test.ts Show resolved Hide resolved
@dariakp dariakp changed the title feat(NODE-2939): update hostname canonicalization opts feat(NODE-2939): add new hostname canonicalization opts Feb 10, 2022
src/cmap/auth/gssapi.ts Outdated Show resolved Hide resolved
test/manual/kerberos.test.js Outdated Show resolved Hide resolved
@durran durran requested a review from dariakp February 11, 2022 12:33
@durran durran force-pushed the NODE-2939-hostname-canonicalization branch from ff3fc90 to 3c6d586 Compare February 11, 2022 13:06
src/cmap/auth/gssapi.ts Outdated Show resolved Hide resolved
test/manual/kerberos.test.js Outdated Show resolved Hide resolved
src/cmap/auth/gssapi.ts Show resolved Hide resolved
src/cmap/auth/gssapi.ts Show resolved Hide resolved
test/manual/kerberos.test.js Outdated Show resolved Hide resolved
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

Let's make sure we rebase after #3138 goes in, because the credential option parsing will be affected

@durran durran force-pushed the NODE-2939-hostname-canonicalization branch from 0979fbb to 20c8d55 Compare February 14, 2022 14:20
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

@durran Thanks for updating the tests! Would it be worthwhile/possible to add the expectations on the fallback behavior at each point in each case? Just to make sure we don't accidentally break that in the future? Edit: if possible, we'd also want to confirm that the final response correctly uses the reply of the respective functions (like, we'd want to stub the reply from the reverse lookup to return something different than the forward, and then make sure we use the reverse response)

src/cmap/auth/gssapi.ts Outdated Show resolved Hide resolved
@durran
Copy link
Member Author

durran commented Feb 14, 2022

@durran Thanks for updating the tests! Would it be worthwhile/possible to add the expectations on the fallback behavior at each point in each case? Just to make sure we don't accidentally break that in the future? Edit: if possible, we'd also want to confirm that the final response correctly uses the reply of the respective functions (like, we'd want to stub the reply from the reverse lookup to return something different than the forward, and then make sure we use the reverse response)

We actually didn't want to stub the later case, which is why I opened https://jira.mongodb.org/browse/BUILD-14646 to get an integration test for it afterwards. But I can write a test that stubs out all the return values in the meantime.

src/index.ts Outdated Show resolved Hide resolved
@durran durran force-pushed the NODE-2939-hostname-canonicalization branch from 1fe21b2 to 140c651 Compare February 15, 2022 18:37
@durran durran requested a review from nbbeeken February 15, 2022 19:09
src/index.ts Outdated Show resolved Hide resolved
nbbeeken
nbbeeken previously approved these changes Feb 15, 2022
test/manual/kerberos.test.js Outdated Show resolved Hide resolved
@durran durran requested a review from dariakp February 15, 2022 21:56
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

LGTM - great job with the new tests!

@durran durran merged commit d0390d0 into main Feb 17, 2022
@durran durran deleted the NODE-2939-hostname-canonicalization branch February 17, 2022 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
5 participants