Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wfe: Handle empty JSON to /acme/acct like POST-as-GET #7844

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) != "{}" {
Comment on lines +1419 to +1422
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight quibble: it's still reasonable in ACMEv2 to treat "{}" as an update to zero fields, returning the object. It's true that a more recently written client would be more likely to just use "" if it knows its just trying to fetch the account. Perhaps this?

Suggested change
// 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) != "{}" {
// An empty string means POST-as-GET (i.e. no update). A body of "{}" means
// an update of zero fields, returning the unchanged object. This was the
// recommended way to fetch the account object in ACMEv1.

currAcct, prob = wfe.updateAccount(ctx, body, currAcct)
if prob != nil {
wfe.sendError(response, logEvent, prob, nil)
Expand Down
Loading