Skip to content

Commit

Permalink
Link failed validation limit errors to new docs page (#6210)
Browse files Browse the repository at this point in the history
Fixes #6194
  • Loading branch information
beautifulentropy committed Jul 1, 2022
1 parent 63f7936 commit 2447a7c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ func DuplicateCertificateError(msg string, args ...interface{}) error {
}
}

func FailedValidationError(msg string, args ...interface{}) error {
return &BoulderError{
Type: RateLimit,
Detail: fmt.Sprintf(msg+": see https://letsencrypt.org/docs/failed-validation-limit/", args...),
}
}

func RejectedIdentifierError(msg string, args ...interface{}) error {
return New(RejectedIdentifier, msg, args...)
}
Expand Down
2 changes: 1 addition & 1 deletion ra/ra.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ func (ra *RegistrationAuthorityImpl) checkInvalidAuthorizationLimit(ctx context.
noKey := ""
if count.Count >= limit.GetThreshold(noKey, regID) {
ra.log.Infof("Rate limit exceeded, InvalidAuthorizationsByRegID, regID: %d", regID)
return berrors.RateLimitError("too many failed authorizations recently")
return berrors.FailedValidationError("too many failed authorizations recently")
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions ra/ra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ func TestAuthzFailedRateLimitingNewOrder(t *testing.T) {
err := ra.checkInvalidAuthorizationLimits(ctx, Registration.Id,
[]string{"charlie.brown.com", "all.i.do.is.lose.com"})
test.AssertError(t, err, "checkInvalidAuthorizationLimits did not encounter expected rate limit error")
test.AssertEquals(t, err.Error(), "too many failed authorizations recently: see https://letsencrypt.org/docs/rate-limits/")
test.AssertEquals(t, err.Error(), "too many failed authorizations recently: see https://letsencrypt.org/docs/failed-validation-limit/")
}

testcase()
Expand Down Expand Up @@ -2115,7 +2115,7 @@ func TestNewOrderCheckFailedAuthorizationsFirst(t *testing.T) {
})

test.AssertError(t, err, "expected error for domain with too many failures")
test.AssertEquals(t, err.Error(), "too many failed authorizations recently: see https://letsencrypt.org/docs/rate-limits/")
test.AssertEquals(t, err.Error(), "too many failed authorizations recently: see https://letsencrypt.org/docs/failed-validation-limit/")
}

// mockSAUnsafeAuthzReuse has a GetAuthorizations implementation that returns
Expand Down

0 comments on commit 2447a7c

Please sign in to comment.