Skip to content

[management] remove regex check from validateDomain() #4000

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

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

Conversation

zvpunry
Copy link

@zvpunry zvpunry commented Jun 17, 2025

The regex blocked labels that are allowed by rfc1035 like "x", "x1", "x--x" and possibly some more.

The regex check was also redundant because it is directly followed by dns.IsDomainName(domain)

Describe your changes

I only removed the regex check from validateDomain().

This change still requires an update to management/server/nameserver_test.go because it tests for the too strict domain validation.

Issue ticket number and link

#3996

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

@CLAassistant
Copy link

CLAassistant commented Jun 17, 2025

CLA assistant check
All committers have signed the CLA.

@zvpunry
Copy link
Author

zvpunry commented Jun 19, 2025

The offending tests are for the following dns records, which are expected to fail:

"*.example"
"."
"test--example.com"
"-example.com"
"example.com-"
"example?,.com"
"space .example.com"
"example.com "

But according to https://www.rfc-editor.org/rfc/rfc2181#section-11 these are valid DNS names and shouldn't result in an error.

@zvpunry zvpunry force-pushed the zvpunry/validateDomain branch 2 times, most recently from ed852c7 to e0d2f86 Compare July 11, 2025 10:33
@zvpunry zvpunry force-pushed the zvpunry/validateDomain branch from 67d6102 to 401a45c Compare July 15, 2025 14:56
zvpunry added 2 commits July 15, 2025 16:58
The regex blocked labels that are allowed by rfc1035
like "x", "x1", "x--x" and possibly some more.

The regex check was also redundant because it is directly
followed by dns.IsDomainName(domain)
After removing too strict checks from validateDomain(),
some tests failed because they expected errors for otherwise
valid domain names.

This removes the offending tests and adds a test for the maximum length
of a domain name.
@zvpunry zvpunry force-pushed the zvpunry/validateDomain branch from 401a45c to ab14c11 Compare July 15, 2025 15:05
Copy link

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.

2 participants