WFE: Suppress logging of probs.PausedProblem (#7719)
Instead of logging the message shown to the caller, log "429 :: rateLimited :: account/ident pair is paused"
This commit is contained in:
parent
c6849960d3
commit
8c009f2c5e
|
@ -27,6 +27,7 @@ const (
|
||||||
InvalidContactProblem = ProblemType("invalidContact")
|
InvalidContactProblem = ProblemType("invalidContact")
|
||||||
MalformedProblem = ProblemType("malformed")
|
MalformedProblem = ProblemType("malformed")
|
||||||
OrderNotReadyProblem = ProblemType("orderNotReady")
|
OrderNotReadyProblem = ProblemType("orderNotReady")
|
||||||
|
PausedProblem = ProblemType("rateLimited")
|
||||||
RateLimitedProblem = ProblemType("rateLimited")
|
RateLimitedProblem = ProblemType("rateLimited")
|
||||||
RejectedIdentifierProblem = ProblemType("rejectedIdentifier")
|
RejectedIdentifierProblem = ProblemType("rejectedIdentifier")
|
||||||
ServerInternalProblem = ProblemType("serverInternal")
|
ServerInternalProblem = ProblemType("serverInternal")
|
||||||
|
@ -220,7 +221,7 @@ func RateLimited(detail string) *ProblemDetails {
|
||||||
// Paused returns a ProblemDetails representing a RateLimitedProblem error
|
// Paused returns a ProblemDetails representing a RateLimitedProblem error
|
||||||
func Paused(detail string) *ProblemDetails {
|
func Paused(detail string) *ProblemDetails {
|
||||||
return &ProblemDetails{
|
return &ProblemDetails{
|
||||||
Type: RateLimitedProblem,
|
Type: PausedProblem,
|
||||||
Detail: detail,
|
Detail: detail,
|
||||||
HTTPStatus: http.StatusTooManyRequests,
|
HTTPStatus: http.StatusTooManyRequests,
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,15 @@ func SendError(
|
||||||
response.WriteHeader(http.StatusInternalServerError)
|
response.WriteHeader(http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Suppress logging of the "Your account is temporarily prevented from
|
||||||
|
// requesting certificates" error.
|
||||||
|
var primaryDetail = prob.Detail
|
||||||
|
if prob.Type == probs.PausedProblem {
|
||||||
|
primaryDetail = "account/ident pair is paused"
|
||||||
|
}
|
||||||
|
|
||||||
// Record details to the log event
|
// Record details to the log event
|
||||||
logEvent.Error = fmt.Sprintf("%d :: %s :: %s", prob.HTTPStatus, prob.Type, prob.Detail)
|
logEvent.Error = fmt.Sprintf("%d :: %s :: %s", prob.HTTPStatus, prob.Type, primaryDetail)
|
||||||
if len(prob.SubProblems) > 0 {
|
if len(prob.SubProblems) > 0 {
|
||||||
subDetails := make([]string, len(prob.SubProblems))
|
subDetails := make([]string, len(prob.SubProblems))
|
||||||
for i, sub := range prob.SubProblems {
|
for i, sub := range prob.SubProblems {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
berrors "github.com/letsencrypt/boulder/errors"
|
berrors "github.com/letsencrypt/boulder/errors"
|
||||||
"github.com/letsencrypt/boulder/identifier"
|
"github.com/letsencrypt/boulder/identifier"
|
||||||
"github.com/letsencrypt/boulder/log"
|
"github.com/letsencrypt/boulder/log"
|
||||||
|
"github.com/letsencrypt/boulder/probs"
|
||||||
"github.com/letsencrypt/boulder/test"
|
"github.com/letsencrypt/boulder/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -94,3 +95,11 @@ func TestSendErrorSubProbLogging(t *testing.T) {
|
||||||
|
|
||||||
test.AssertEquals(t, logEvent.Error, `400 :: malformed :: dfoop :: bad ["example.com :: malformed :: dfoop :: nop", "what about example.com :: malformed :: dfoop :: nah"]`)
|
test.AssertEquals(t, logEvent.Error, `400 :: malformed :: dfoop :: bad ["example.com :: malformed :: dfoop :: nop", "what about example.com :: malformed :: dfoop :: nah"]`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSendErrorPausedProblemLoggingSuppression(t *testing.T) {
|
||||||
|
rw := httptest.NewRecorder()
|
||||||
|
logEvent := RequestEvent{}
|
||||||
|
SendError(log.NewMock(), rw, &logEvent, probs.Paused("I better not see any of this"), nil)
|
||||||
|
|
||||||
|
test.AssertEquals(t, logEvent.Error, "429 :: rateLimited :: account/ident pair is paused")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue