wfe: on rate limit error, serve 500 (#7796)

This affects NewAccount and NewOrder.
This commit is contained in:
Jacob Hoffman-Andrews 2024-12-17 17:09:57 -08:00 committed by GitHub
parent ba624ac5be
commit 242d746040
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 13 deletions

View File

@ -35,12 +35,7 @@ type RequestEvent struct {
Slug string `json:",omitempty"`
InternalErrors []string `json:",omitempty"`
Error string `json:",omitempty"`
// If there is an error checking the data store for our rate limits
// we ignore it, but attach the error to the log event for analysis.
// TODO(#7796): Treat errors from the rate limit system as normal
// errors and put them into InternalErrors.
IgnoredRateLimitError string `json:",omitempty"`
UserAgent string `json:"ua,omitempty"`
UserAgent string `json:"ua,omitempty"`
// Origin is sent by the browser from XHR-based clients.
Origin string `json:",omitempty"`
Extra map[string]interface{} `json:",omitempty"`

View File

@ -798,7 +798,8 @@ func (wfe *WebFrontEndImpl) NewAccount(
wfe.sendError(response, logEvent, probs.RateLimited(err.Error()), err)
return
} else {
logEvent.IgnoredRateLimitError = err.Error()
wfe.sendError(response, logEvent, web.ProblemDetailsForError(err, "While checking rate limits"), err)
return
}
}
@ -2401,14 +2402,13 @@ func (wfe *WebFrontEndImpl) NewOrder(
}
refundLimits, err := wfe.checkNewOrderLimits(ctx, acct.ID, names, isRenewal)
if err != nil {
if err != nil && features.Get().UseKvLimitsForNewOrder {
if errors.Is(err, berrors.RateLimit) {
if features.Get().UseKvLimitsForNewOrder {
wfe.sendError(response, logEvent, probs.RateLimited(err.Error()), err)
return
}
wfe.sendError(response, logEvent, probs.RateLimited(err.Error()), err)
return
} else {
logEvent.IgnoredRateLimitError = err.Error()
wfe.sendError(response, logEvent, web.ProblemDetailsForError(err, "While checking rate limits"), err)
return
}
}