Skip to content

Commit

Permalink
validation: allow up to 200 chars of txt content
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanePrawn committed Feb 23, 2025
1 parent b7a0a8a commit 2702bfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion util.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func prepareConfig(conf DNSConfig) (DNSConfig, error) {

func sanitizeString(s string) string {
// URL safe base64 alphabet without padding as defined in ACME
re, _ := regexp.Compile(`[^A-Za-z\-\_0-9]+`)
re, _ := regexp.Compile(`[^A-Za-z\-\_\.0-9]+`)
return re.ReplaceAllString(s, "")
}

Expand Down
4 changes: 3 additions & 1 deletion validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func validSubdomain(s string) bool {

func validTXT(s string) bool {
sn := sanitizeString(s)
if utf8.RuneCountInString(s) == 43 && utf8.RuneCountInString(sn) == 43 {
cnt := utf8.RuneCountInString(s)
cnt_sn := utf8.RuneCountInString(sn)
if (43 <= cnt && cnt <= 200 && cnt_sn == cnt) {
// 43 chars is the current LE auth key size, but not limited / defined by ACME
return true
}
Expand Down

0 comments on commit 2702bfb

Please sign in to comment.