Skip to content

Commit

Permalink
wfe: Handle empty JSON to /acct like POST-as-GET
Browse files Browse the repository at this point in the history
ACME clients can make an empty request to /acme/acct for their reg object. wfe.Account handles a truly empty request correctly, but has routed empty JSON objects to updateAccount, even though an update is not appropriate. This only happened to work because UpdateRegistration's impl takes an entire Registration and returns it even if unchanged.

This preserves ACMEv1 backwards compatibility when UpdateRegistration is simplified.
  • Loading branch information
jprenken committed Nov 23, 2024
1 parent 7791262 commit e132ca0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wfe2/wfe.go
Original file line number Diff line number Diff line change
Expand Up @@ -1416,8 +1416,10 @@ func (wfe *WebFrontEndImpl) Account(
return
}

// If the body was not empty, then this is an account update request.
if string(body) != "" {
// If the body was not either completely empty or an empty JSON object, then
// this is an account update request. Treating the empty JSON object like a
// POST-as-GET is a holdover from ACMEv1.
if string(body) != "" && string(body) != "{}" {
currAcct, prob = wfe.updateAccount(ctx, body, currAcct)
if prob != nil {
wfe.sendError(response, logEvent, prob, nil)
Expand Down

0 comments on commit e132ca0

Please sign in to comment.