Skip to content

Commit 242d746

Browse files
authored
wfe: on rate limit error, serve 500 (#7796)
This affects NewAccount and NewOrder.
1 parent ba624ac commit 242d746

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

web/context.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@ type RequestEvent struct {
3535
Slug string `json:",omitempty"`
3636
InternalErrors []string `json:",omitempty"`
3737
Error string `json:",omitempty"`
38-
// If there is an error checking the data store for our rate limits
39-
// we ignore it, but attach the error to the log event for analysis.
40-
// TODO(#7796): Treat errors from the rate limit system as normal
41-
// errors and put them into InternalErrors.
42-
IgnoredRateLimitError string `json:",omitempty"`
43-
UserAgent string `json:"ua,omitempty"`
38+
UserAgent string `json:"ua,omitempty"`
4439
// Origin is sent by the browser from XHR-based clients.
4540
Origin string `json:",omitempty"`
4641
Extra map[string]interface{} `json:",omitempty"`

wfe2/wfe.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,8 @@ func (wfe *WebFrontEndImpl) NewAccount(
798798
wfe.sendError(response, logEvent, probs.RateLimited(err.Error()), err)
799799
return
800800
} else {
801-
logEvent.IgnoredRateLimitError = err.Error()
801+
wfe.sendError(response, logEvent, web.ProblemDetailsForError(err, "While checking rate limits"), err)
802+
return
802803
}
803804
}
804805

@@ -2401,14 +2402,13 @@ func (wfe *WebFrontEndImpl) NewOrder(
24012402
}
24022403

24032404
refundLimits, err := wfe.checkNewOrderLimits(ctx, acct.ID, names, isRenewal)
2404-
if err != nil {
2405+
if err != nil && features.Get().UseKvLimitsForNewOrder {
24052406
if errors.Is(err, berrors.RateLimit) {
2406-
if features.Get().UseKvLimitsForNewOrder {
2407-
wfe.sendError(response, logEvent, probs.RateLimited(err.Error()), err)
2408-
return
2409-
}
2407+
wfe.sendError(response, logEvent, probs.RateLimited(err.Error()), err)
2408+
return
24102409
} else {
2411-
logEvent.IgnoredRateLimitError = err.Error()
2410+
wfe.sendError(response, logEvent, web.ProblemDetailsForError(err, "While checking rate limits"), err)
2411+
return
24122412
}
24132413
}
24142414

0 commit comments

Comments
 (0)