Skip to content

Commit

Permalink
acme/autocert/internal/acmetest: don't validate in goroutine
Browse files Browse the repository at this point in the history
In the test server, rather than spawning a goroutine to validate
challenges, block on the validation before responding to the client.
This prevents a test race, where testing.T.Logf is called after the
test is completed.

While this has a slight behavioral difference to some production
ACME server implementations (although is behavior allowed in the spec),
the change has little material impact on what we are testing, since
previously the validation would happen so quickly that it would be
indistinguishable from the new blocking behavior (i.e. we would not be
sending multiple requests during polling previously.)

Fixes golang/go#52170

Change-Id: I75e3b2da69ddc2302be25a99f1b1151ed0f4af9b
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/405548
Run-TryBot: Roland Shoemaker <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
  • Loading branch information
rolandshoemaker committed May 11, 2022
1 parent 71b9a4b commit 826e77d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion acme/autocert/internal/acmetest/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func (ca *CAServer) handle(w http.ResponseWriter, r *http.Request) {
ca.httpErrorf(w, http.StatusBadRequest, "challenge accept: %v", err)
return
}
go ca.validateChallenge(a, typ)
ca.validateChallenge(a, typ)
w.Write([]byte("{}"))

// Get authorization status requests.
Expand Down

0 comments on commit 826e77d

Please sign in to comment.