Fix race condition during ACME authz polling #4561
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously after creating an ACME order the client would call
ACMEAuthorizationService
to poll the status of the authorization. Initially the authorization did not have any challenges, so this service would create the challenges for it. In subsequent calls this service would just return the status of the authorization.When the client completes a challenge, the
ACMEChallengeProcessor
will update the authorization by removing the old challenges and adding the new ones. Since these operations are not atomic there is a risk that after the old challenges are removed the client will call theACMEAuthorizationService
and create new challenges which will never be completed by the client.To avoid the problem, the code that creates the challenges has been moved from
ACMEAuthorizationService
intoACMENewOrderService
so the challenges can only be created just once when the order is initially created.The
LDAPDatabase.addAuthorization()
has also been updated to add the challenges after adding the authorization.