Bläddra i källkod

Return detailed dns-persist-01 errors to ACME clients

Validation records can be provisioned by a party other than the ACME
client, so include the reason a record was rejected in the error detail
to make them easier to fix.
Josh Drake 1 månad sedan
förälder
incheckning
0dd0f97ca8
4 ändrade filer med 37 tillägg och 36 borttagningar
  1. 14 14
      acme/challenge.go
  2. 21 20
      acme/challenge_test.go
  3. 1 1
      acme/order.go
  4. 1 1
      acme/order_test.go

+ 14 - 14
acme/challenge.go

@@ -439,7 +439,7 @@ func dnsPersist01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.J
 		return WrapErrorISE(err, "error loading account")
 		return WrapErrorISE(err, "error loading account")
 	}
 	}
 	if !acc.IsValid() {
 	if !acc.IsValid() {
-		return storeError(ctx, db, ch, true, NewError(ErrorUnauthorizedType,
+		return storeError(ctx, db, ch, true, NewDetailedError(ErrorUnauthorizedType,
 			"account %s is not valid", acc.ID))
 			"account %s is not valid", acc.ID))
 	}
 	}
 
 
@@ -448,7 +448,7 @@ func dnsPersist01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.J
 	// current request.
 	// current request.
 	accountURL := acc.GetLocation()
 	accountURL := acc.GetLocation()
 	if accountURL == "" {
 	if accountURL == "" {
-		return storeError(ctx, db, ch, true, NewError(ErrorUnauthorizedType,
+		return storeError(ctx, db, ch, true, NewDetailedError(ErrorUnauthorizedType,
 			"account %s does not have the stored location required by %s challenges", acc.ID, ch.Type))
 			"account %s does not have the stored location required by %s challenges", acc.ID, ch.Type))
 	}
 	}
 
 
@@ -456,7 +456,7 @@ func dnsPersist01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.J
 	// at the base domain.
 	// at the base domain.
 	domain, err := x509util.SanitizeName(strings.TrimSuffix(strings.TrimPrefix(ch.Value, "*."), "."))
 	domain, err := x509util.SanitizeName(strings.TrimSuffix(strings.TrimPrefix(ch.Value, "*."), "."))
 	if err != nil || len(domain) > 253 {
 	if err != nil || len(domain) > 253 {
-		return storeError(ctx, db, ch, true, NewError(ErrorMalformedType,
+		return storeError(ctx, db, ch, true, NewDetailedError(ErrorMalformedType,
 			"invalid DNS name %s", ch.Value))
 			"invalid DNS name %s", ch.Value))
 	}
 	}
 
 
@@ -507,7 +507,7 @@ func dnsPersist01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.J
 	}
 	}
 	if record == nil {
 	if record == nil {
 		if recordErr == nil {
 		if recordErr == nil {
-			recordErr = NewError(ErrorUnauthorizedType,
+			recordErr = NewDetailedError(ErrorUnauthorizedType,
 				"no TXT record found at %s for issuer domain names %s", host, strings.Join(ch.IssuerDomainNames, ", "))
 				"no TXT record found at %s for issuer domain names %s", host, strings.Join(ch.IssuerDomainNames, ", "))
 		}
 		}
 		return storeError(ctx, db, ch, false, recordErr)
 		return storeError(ctx, db, ch, false, recordErr)
@@ -566,7 +566,7 @@ func parseDNSPersist01Record(txt string, issuerDomainNames []string, accountHash
 			tag, value, ok := strings.Cut(param, "=")
 			tag, value, ok := strings.Cut(param, "=")
 			tag, value = strings.Trim(tag, " \t"), strings.Trim(value, " \t")
 			tag, value = strings.Trim(tag, " \t"), strings.Trim(value, " \t")
 			if !ok || !isDNSPersist01Tag(tag) || !isDNSPersist01Value(value) {
 			if !ok || !isDNSPersist01Tag(tag) || !isDNSPersist01Value(value) {
-				return nil, true, NewError(ErrorMalformedType,
+				return nil, true, NewDetailedError(ErrorMalformedType,
 					"TXT record %q has an invalid parameter %q", txt, param)
 					"TXT record %q has an invalid parameter %q", txt, param)
 			}
 			}
 
 
@@ -574,7 +574,7 @@ func parseDNSPersist01Record(txt string, issuerDomainNames []string, accountHash
 			// persistUntil is never ignored because of its case.
 			// persistUntil is never ignored because of its case.
 			tag = strings.ToLower(tag)
 			tag = strings.ToLower(tag)
 			if seen[tag] {
 			if seen[tag] {
-				return nil, true, NewError(ErrorMalformedType,
+				return nil, true, NewDetailedError(ErrorMalformedType,
 					"TXT record %q has a duplicate parameter %q", txt, tag)
 					"TXT record %q has a duplicate parameter %q", txt, tag)
 			}
 			}
 			seen[tag] = true
 			seen[tag] = true
@@ -590,7 +590,7 @@ func parseDNSPersist01Record(txt string, issuerDomainNames []string, accountHash
 			case "persistuntil":
 			case "persistuntil":
 				ts, err := strconv.ParseInt(value, 10, 64)
 				ts, err := strconv.ParseInt(value, 10, 64)
 				if err != nil || strings.Trim(value, "0123456789") != "" {
 				if err != nil || strings.Trim(value, "0123456789") != "" {
-					return nil, true, NewError(ErrorMalformedType,
+					return nil, true, NewDetailedError(ErrorMalformedType,
 						"TXT record %q has an invalid persistUntil value %q", txt, value)
 						"TXT record %q has an invalid persistUntil value %q", txt, value)
 				}
 				}
 				rec.persistUntil = time.Unix(ts, 0).UTC()
 				rec.persistUntil = time.Unix(ts, 0).UTC()
@@ -599,7 +599,7 @@ func parseDNSPersist01Record(txt string, issuerDomainNames []string, accountHash
 	}
 	}
 
 
 	if rec.accountURI == "" {
 	if rec.accountURI == "" {
-		return nil, true, NewError(ErrorMalformedType,
+		return nil, true, NewDetailedError(ErrorMalformedType,
 			"TXT record %q is missing the accounturi parameter", txt)
 			"TXT record %q is missing the accounturi parameter", txt)
 	}
 	}
 	return rec, true, nil
 	return rec, true, nil
@@ -610,16 +610,16 @@ func parseDNSPersist01Record(txt string, issuerDomainNames []string, accountHash
 func validateDNSPersist01AccountURI(value, accountHashPrefix string) *Error {
 func validateDNSPersist01AccountURI(value, accountHashPrefix string) *Error {
 	rest, ok := strings.CutPrefix(value, accountHashPrefix)
 	rest, ok := strings.CutPrefix(value, accountHashPrefix)
 	if !ok {
 	if !ok {
-		return NewError(ErrorMalformedType,
+		return NewDetailedError(ErrorMalformedType,
 			"accounturi %q does not start with %q", value, accountHashPrefix)
 			"accounturi %q does not start with %q", value, accountHashPrefix)
 	}
 	}
 	alg, hash, _ := strings.Cut(rest, "/")
 	alg, hash, _ := strings.Cut(rest, "/")
 	if alg != dnsPersist01HashAlgorithm {
 	if alg != dnsPersist01HashAlgorithm {
-		return NewError(ErrorMalformedType,
+		return NewDetailedError(ErrorMalformedType,
 			"accounturi %q does not use the %s hash algorithm", value, dnsPersist01HashAlgorithm)
 			"accounturi %q does not use the %s hash algorithm", value, dnsPersist01HashAlgorithm)
 	}
 	}
 	if b, err := base64.RawURLEncoding.Strict().DecodeString(hash); err != nil || len(b) != sha256.Size {
 	if b, err := base64.RawURLEncoding.Strict().DecodeString(hash); err != nil || len(b) != sha256.Size {
-		return NewError(ErrorMalformedType,
+		return NewDetailedError(ErrorMalformedType,
 			"accounturi %q does not contain a valid %s hash value", value, dnsPersist01HashAlgorithm)
 			"accounturi %q does not contain a valid %s hash value", value, dnsPersist01HashAlgorithm)
 	}
 	}
 	return nil
 	return nil
@@ -630,13 +630,13 @@ func validateDNSPersist01AccountURI(value, accountHashPrefix string) *Error {
 func verifyDNSPersist01Record(rec *dnsPersist01Record, now time.Time, expected []string, wildcard bool, domain string) *Error {
 func verifyDNSPersist01Record(rec *dnsPersist01Record, now time.Time, expected []string, wildcard bool, domain string) *Error {
 	switch {
 	switch {
 	case !slices.Contains(expected, rec.accountURI):
 	case !slices.Contains(expected, rec.accountURI):
-		return NewError(ErrorUnauthorizedType,
+		return NewDetailedError(ErrorUnauthorizedType,
 			"accounturi does not match; expected %s, but got %s", expected[0], rec.accountURI)
 			"accounturi does not match; expected %s, but got %s", expected[0], rec.accountURI)
 	case !rec.persistUntil.IsZero() && now.After(rec.persistUntil):
 	case !rec.persistUntil.IsZero() && now.After(rec.persistUntil):
-		return NewError(ErrorUnauthorizedType,
+		return NewDetailedError(ErrorUnauthorizedType,
 			"TXT record expired at %s", rec.persistUntil.Format(time.RFC3339))
 			"TXT record expired at %s", rec.persistUntil.Format(time.RFC3339))
 	case wildcard && !rec.wildcard:
 	case wildcard && !rec.wildcard:
-		return NewError(ErrorUnauthorizedType,
+		return NewDetailedError(ErrorUnauthorizedType,
 			"TXT record does not have the policy=wildcard parameter required for *.%s", domain)
 			"TXT record does not have the policy=wildcard parameter required for *.%s", domain)
 	default:
 	default:
 		return nil
 		return nil

+ 21 - 20
acme/challenge_test.go

@@ -5683,20 +5683,20 @@ func TestDNSPersist01Validate(t *testing.T) {
 			value:      "example.com",
 			value:      "example.com",
 			account:    &Account{ID: "123", Status: StatusDeactivated, LocationPrefix: "https://ca.example/acct/"},
 			account:    &Account{ID: "123", Status: StatusDeactivated, LocationPrefix: "https://ca.example/acct/"},
 			wantStatus: StatusInvalid,
 			wantStatus: StatusInvalid,
-			wantChErr:  NewError(ErrorUnauthorizedType, "account 123 is not valid"),
+			wantChErr:  NewDetailedError(ErrorUnauthorizedType, "account 123 is not valid"),
 		},
 		},
 		{
 		{
 			name:       "fail/account-without-location",
 			name:       "fail/account-without-location",
 			value:      "example.com",
 			value:      "example.com",
 			account:    &Account{ID: "123", Status: StatusValid},
 			account:    &Account{ID: "123", Status: StatusValid},
 			wantStatus: StatusInvalid,
 			wantStatus: StatusInvalid,
-			wantChErr:  NewError(ErrorUnauthorizedType, "account 123 does not have the stored location required by dns-persist-01 challenges"),
+			wantChErr:  NewDetailedError(ErrorUnauthorizedType, "account 123 does not have the stored location required by dns-persist-01 challenges"),
 		},
 		},
 		{
 		{
 			name:       "fail/invalid-domain",
 			name:       "fail/invalid-domain",
 			value:      "exa mple.com",
 			value:      "exa mple.com",
 			wantStatus: StatusInvalid,
 			wantStatus: StatusInvalid,
-			wantChErr:  NewError(ErrorMalformedType, "invalid DNS name exa mple.com"),
+			wantChErr:  NewDetailedError(ErrorMalformedType, "invalid DNS name exa mple.com"),
 		},
 		},
 		{
 		{
 			name:       "fail/lookup-error",
 			name:       "fail/lookup-error",
@@ -5710,105 +5710,105 @@ func TestDNSPersist01Validate(t *testing.T) {
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"ca1.example; accounturi=" + accountURI},
 			txtRecords: []string{"ca1.example; accounturi=" + accountURI},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorUnauthorizedType, "no TXT record found at _validation-persist.example.com for issuer domain names authority.example, ca.example.net"),
+			wantChErr:  NewDetailedError(ErrorUnauthorizedType, "no TXT record found at _validation-persist.example.com for issuer domain names authority.example, ca.example.net"),
 		},
 		},
 		{
 		{
 			name:       "fail/missing-account-uri",
 			name:       "fail/missing-account-uri",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; policy=wildcard"},
 			txtRecords: []string{"authority.example; policy=wildcard"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `TXT record "authority.example; policy=wildcard" is missing the accounturi parameter`),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `TXT record "authority.example; policy=wildcard" is missing the accounturi parameter`),
 		},
 		},
 		{
 		{
 			name:       "fail/missing-parameters",
 			name:       "fail/missing-parameters",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example;"},
 			txtRecords: []string{"authority.example;"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `TXT record "authority.example;" is missing the accounturi parameter`),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `TXT record "authority.example;" is missing the accounturi parameter`),
 		},
 		},
 		{
 		{
 			name:       "fail/duplicate-parameter",
 			name:       "fail/duplicate-parameter",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; persistUntil=1; persistuntil=2"},
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; persistUntil=1; persistuntil=2"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; persistUntil=1; persistuntil=2" has a duplicate parameter "persistuntil"`, accountURI),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; persistUntil=1; persistuntil=2" has a duplicate parameter "persistuntil"`, accountURI),
 		},
 		},
 		{
 		{
 			name:       "fail/parameter-without-value",
 			name:       "fail/parameter-without-value",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; policy"},
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; policy"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; policy" has an invalid parameter " policy"`, accountURI),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; policy" has an invalid parameter " policy"`, accountURI),
 		},
 		},
 		{
 		{
 			name:       "fail/empty-parameter",
 			name:       "fail/empty-parameter",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + ";"},
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + ";"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s;" has an invalid parameter ""`, accountURI),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s;" has an invalid parameter ""`, accountURI),
 		},
 		},
 		{
 		{
 			name:       "fail/invalid-tag",
 			name:       "fail/invalid-tag",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; -policy=wildcard"},
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; -policy=wildcard"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; -policy=wildcard" has an invalid parameter " -policy=wildcard"`, accountURI),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; -policy=wildcard" has an invalid parameter " -policy=wildcard"`, accountURI),
 		},
 		},
 		{
 		{
 			name:       "fail/invalid-value",
 			name:       "fail/invalid-value",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; policy=wild card"},
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; policy=wild card"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; policy=wild card" has an invalid parameter " policy=wild card"`, accountURI),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; policy=wild card" has an invalid parameter " policy=wild card"`, accountURI),
 		},
 		},
 		{
 		{
 			name:       "fail/account-uri-prefix",
 			name:       "fail/account-uri-prefix",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=https://ca.example/acct/123"},
 			txtRecords: []string{"authority.example; accounturi=https://ca.example/acct/123"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `accounturi "https://ca.example/acct/123" does not start with "https://ca.example/account-hash/"`),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `accounturi "https://ca.example/acct/123" does not start with "https://ca.example/account-hash/"`),
 		},
 		},
 		{
 		{
 			name:       "fail/account-uri-algorithm",
 			name:       "fail/account-uri-algorithm",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + prefix + "sha-512/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk-kw"},
 			txtRecords: []string{"authority.example; accounturi=" + prefix + "sha-512/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk-kw"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `accounturi "https://ca.example/account-hash/sha-512/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk-kw" does not use the sha-256 hash algorithm`),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `accounturi "https://ca.example/account-hash/sha-512/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk-kw" does not use the sha-256 hash algorithm`),
 		},
 		},
 		{
 		{
 			name:       "fail/account-uri-hash",
 			name:       "fail/account-uri-hash",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + prefix + "sha-256/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk"},
 			txtRecords: []string{"authority.example; accounturi=" + prefix + "sha-256/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `accounturi "https://ca.example/account-hash/sha-256/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk" does not contain a valid sha-256 hash value`),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `accounturi "https://ca.example/account-hash/sha-256/5SQm7n6tPh2-PlLbCKGnViTXX5z19SCN4cPGQHSk" does not contain a valid sha-256 hash value`),
 		},
 		},
 		{
 		{
 			name:       "fail/account-uri-mismatch",
 			name:       "fail/account-uri-mismatch",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + otherAccountURI},
 			txtRecords: []string{"authority.example; accounturi=" + otherAccountURI},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", accountURI, otherAccountURI),
+			wantChErr:  NewDetailedError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", accountURI, otherAccountURI),
 		},
 		},
 		{
 		{
 			name:       "fail/account-uri-other-domain",
 			name:       "fail/account-uri-other-domain",
 			value:      "www.example.com",
 			value:      "www.example.com",
 			txtRecords: []string{"authority.example; accounturi=" + accountURI},
 			txtRecords: []string{"authority.example; accounturi=" + accountURI},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", wwwAccountURI, accountURI),
+			wantChErr:  NewDetailedError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", wwwAccountURI, accountURI),
 		},
 		},
 		{
 		{
 			name:       "fail/persist-until-invalid",
 			name:       "fail/persist-until-invalid",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; persistUntil=+1767225600"},
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; persistUntil=+1767225600"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; persistUntil=+1767225600" has an invalid persistUntil value "+1767225600"`, accountURI),
+			wantChErr:  NewDetailedError(ErrorMalformedType, `TXT record "authority.example; accounturi=%s; persistUntil=+1767225600" has an invalid persistUntil value "+1767225600"`, accountURI),
 		},
 		},
 		{
 		{
 			name:       "fail/persist-until-expired",
 			name:       "fail/persist-until-expired",
 			value:      "example.com",
 			value:      "example.com",
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; persistUntil=1721952000"},
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; persistUntil=1721952000"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorUnauthorizedType, "TXT record expired at 2024-07-26T00:00:00Z"),
+			wantChErr:  NewDetailedError(ErrorUnauthorizedType, "TXT record expired at 2024-07-26T00:00:00Z"),
 		},
 		},
 		{
 		{
 			name:       "fail/wildcard-without-policy",
 			name:       "fail/wildcard-without-policy",
@@ -5816,7 +5816,7 @@ func TestDNSPersist01Validate(t *testing.T) {
 			wildcard:   true,
 			wildcard:   true,
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; policy=other"},
 			txtRecords: []string{"authority.example; accounturi=" + accountURI + "; policy=other"},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorUnauthorizedType, "TXT record does not have the policy=wildcard parameter required for *.example.com"),
+			wantChErr:  NewDetailedError(ErrorUnauthorizedType, "TXT record does not have the policy=wildcard parameter required for *.example.com"),
 		},
 		},
 		{
 		{
 			name:  "fail/first-error",
 			name:  "fail/first-error",
@@ -5826,7 +5826,7 @@ func TestDNSPersist01Validate(t *testing.T) {
 				"ca.example.net; policy=wildcard",
 				"ca.example.net; policy=wildcard",
 			},
 			},
 			wantStatus: StatusPending,
 			wantStatus: StatusPending,
-			wantChErr:  NewError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", accountURI, otherAccountURI),
+			wantChErr:  NewDetailedError(ErrorUnauthorizedType, "accounturi does not match; expected %s, but got %s", accountURI, otherAccountURI),
 		},
 		},
 		{
 		{
 			name:        "fail/update-authorization-error",
 			name:        "fail/update-authorization-error",
@@ -5920,6 +5920,7 @@ func TestDNSPersist01Validate(t *testing.T) {
 			if tt.wantChErr != nil {
 			if tt.wantChErr != nil {
 				if assert.NotNil(t, ch.Error) {
 				if assert.NotNil(t, ch.Error) {
 					assert.Equal(t, tt.wantChErr.Type, ch.Error.Type)
 					assert.Equal(t, tt.wantChErr.Type, ch.Error.Type)
+					assert.Equal(t, tt.wantChErr.Detail, ch.Error.Detail)
 					assert.Equal(t, tt.wantChErr.Status, ch.Error.Status)
 					assert.Equal(t, tt.wantChErr.Status, ch.Error.Status)
 					assert.Equal(t, tt.wantChErr.Err.Error(), ch.Error.Err.Error())
 					assert.Equal(t, tt.wantChErr.Err.Error(), ch.Error.Err.Error())
 				}
 				}

+ 1 - 1
acme/order.go

@@ -174,7 +174,7 @@ func (o *Order) checkPersistentAuthorizations(ctx context.Context, db DB) error
 		}
 		}
 		for _, ch := range az.Challenges {
 		for _, ch := range az.Challenges {
 			if ch.Type == DNSPERSIST01 && ch.Status == StatusValid && now.After(az.ExpiresAt) {
 			if ch.Type == DNSPERSIST01 && ch.Status == StatusValid && now.After(az.ExpiresAt) {
-				return NewError(ErrorUnauthorizedType, "order %s authorization %s has expired", o.ID, az.ID)
+				return NewDetailedError(ErrorUnauthorizedType, "order %s authorization %s has expired", o.ID, az.ID)
 			}
 			}
 		}
 		}
 	}
 	}

+ 1 - 1
acme/order_test.go

@@ -462,7 +462,7 @@ func TestOrder_Finalize(t *testing.T) {
 						}
 						}
 					},
 					},
 				},
 				},
-				err: NewError(ErrorUnauthorizedType, "order oID authorization b has expired"),
+				err: NewDetailedError(ErrorUnauthorizedType, "order oID authorization b has expired"),
 			}
 			}
 		},
 		},
 		"fail/non-matching-permanent-identifier-common-name": func(t *testing.T) test {
 		"fail/non-matching-permanent-identifier-common-name": func(t *testing.T) test {