Skip to content

Commit

Permalink
Merge pull request #227 from gardener/relax-rfc1035
Browse files Browse the repository at this point in the history
Allow domain labels starting with a digit
  • Loading branch information
MartinWeindel authored Nov 12, 2021
2 parents 3352e37 + 0287788 commit 6cb02a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/dns/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ func ValidateDomainName(name string) error {

labels := strings.Split(strings.TrimPrefix(check, "*."), ".")
for i, label := range labels {
if errs = validation.IsDNS1035Label(label); len(errs) > 0 {
if errs = validation.IsDNS1123Label(label); len(errs) > 0 {
return fmt.Errorf("%d. label %q of %q is not valid (%v)", i+1, label, name, errs)
}
}
metaLabels := strings.SplitN(strings.TrimPrefix(metaCheck, "*."), ".", 2)
if errs = validation.IsDNS1035Label(metaLabels[0]); len(errs) > 0 {
if errs = validation.IsDNS1123Label(metaLabels[0]); len(errs) > 0 {
return fmt.Errorf("1. label %q of metadata record of %q is not valid (%v)", metaLabels[0], name, errs)
}

Expand Down
1 change: 1 addition & 0 deletions pkg/dns/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestValidation(t *testing.T) {
{"\\052.a.b", true},
{"a-a.a9.a8.a7.a6.a5.a4.a3.a2.a1.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z", true},
{"_a.b", true},
{"1.2-3.b", true},
{"a123456789012345678901234567890123456789012345678901234567890abc.b", false}, // label too long
{"a.a123456789012345678901234567890123456789012345678901234567890abc.b", false}, // label too long
{"a12345678901234567890123456789012345678901234567890abcd.b", true},
Expand Down

0 comments on commit 6cb02a9

Please sign in to comment.