Skip to content

DRIVERS-3329: Configurable DNS domain validation for SRV records#1950

Open
sleepyStick wants to merge 8 commits into
mongodb:masterfrom
sleepyStick:DRIVERS-3329
Open

DRIVERS-3329: Configurable DNS domain validation for SRV records#1950
sleepyStick wants to merge 8 commits into
mongodb:masterfrom
sleepyStick:DRIVERS-3329

Conversation

@sleepyStick

@sleepyStick sleepyStick commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Please complete the following before merging:

  • Is the relevant DRIVERS ticket in the PR title?

@rozza rozza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks good, I have one comment about if an invalid srvAllowedHostsSuffix should throw an error explicitly? (if so should we update the yml?)

Also the yml and json has diverged for srvAllowedHostsSuffix-without_dot_pass - which is probably the lint error.

example, `srvAllowedHostsSuffix=.mydomain.net`. If the value does not begin with a `.`, for example,
`srvAllowedHostsSuffix=mydomain.net`, the `.` MUST be automatically prepended prior to validation. If this option is not
present, the domain MUST be inferred from the hostname. This option MUST only be configurable at the level of a
`MongoClient`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just to clarify, if a host is invalid eg: ..example.com should this error or just return an empty list of hosts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh good question, my current implementation has it eventually erroring (with a configuration error) when the driver goes to validate the SRV hosts -- i didn't add a new "check valid host" type of function. (though this probably wouldn't be too hard with some regex? if you think it'd be beneficial to add something like this.) My initial thought process was this new parameter is just a user configurable way to denote what the domain should be (as opposed to the previous, now default, logic) -- they should know what they're doing if they're using this param and if they happened to make a typo / silly mistake, the existing "invalid SRV host" error message that occurs when there is an invalid host given the previous logic would still apply.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the eventually error part will cover this, so no need for a regex. I can never understand regexes and someone always seems to find a usecase where the regex fails where it shouldn't!

@sleepyStick sleepyStick marked this pull request as ready for review June 16, 2026 19:50
@sleepyStick sleepyStick requested review from a team as code owners June 16, 2026 19:50
@@ -0,0 +1,4 @@
"uri": "mongodb+srv://test12.test.build.10gen.cc/?srvAllowedHostsSuffix=uild.10gen.cc"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A comment about why this URI causes an error would be helpful. Similar to the comment on "srvAllowedHostsSuffix-mismatch.yml".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call -- added!


#### srvAllowedHostsSuffix

This option is used to validate hosts. If present, its value MUST be treated as the domain for DNS validation. For

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Optional: Consider linking to the Querying DNS section, which is where the DNS validation is described.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added! thanks!

Comment thread source/initial-dns-seedlist-discovery/initial-dns-seedlist-discovery.md Outdated
Comment thread source/initial-dns-seedlist-discovery/initial-dns-seedlist-discovery.md Outdated
@codeowners-service-app

Copy link
Copy Markdown

Assigned vector-of-bool for team dbx-spec-maintainers-connection-string because aclark4life is out of office.

@Jibola Jibola requested a review from rozza June 22, 2026 15:37
sleepyStick and others added 5 commits June 22, 2026 11:40
…covery.md

Co-authored-by: Matt Dale <9760375+matthewdale@users.noreply.github.com>
…covery.md

Co-authored-by: Matt Dale <9760375+matthewdale@users.noreply.github.com>
@sleepyStick sleepyStick requested a review from matthewdale June 22, 2026 19:07
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.

3 participants